/* =============================================
   Knowledge Base — style.css
   Clean, modern, professional design
   ============================================= */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #1a56ff;
    --primary-dark: #1040cc;
    --primary-light: #eff3ff;
    --surface: #ffffff;
    --surface-alt: #f8f9fc;
    --border: #e8eaef;
    --text: #0f1117;
    --text-muted: #6b7280;
    --success: #059669;
    --success-bg: #ecfdf5;
    --error: #dc2626;
    --error-bg: #fef2f2;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.1), 0 4px 8px rgba(0,0,0,0.04);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
}

html { font-size: 16px; scroll-behavior: smooth; }
body {
    font-family: 'DM Sans', sans-serif;
    background: var(--surface-alt);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== HEADER ===== */
.hc-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}
.hc-header-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0.9rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}
.hc-brand, .hc-brand-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
}
.hc-logo-icon { font-size: 1.5rem; }
.hc-logo-text { font-family: 'Sora', sans-serif; font-weight: 700; font-size: 1.05rem; color: var(--text); }

/* Search */
.hc-search-form { flex: 1; max-width: 550px; margin-left: auto; }
.hc-search-wrap {
    display: flex;
    align-items: center;
    background: var(--surface-alt);
    border: 1.5px solid var(--border);
    border-radius: 50px;
    padding: 0.35rem 0.35rem 0.35rem 1rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.hc-search-wrap:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,86,255,0.1);
    background: white;
}
.hc-search-icon { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }
.hc-search-input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text);
    padding: 0 0.6rem;
}
.hc-search-input::placeholder { color: var(--text-muted); }
.hc-search-btn {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 0.45rem 1.1rem;
    font-family: 'Sora', sans-serif;
    font-weight: 600;
    font-size: 0.82rem;
    cursor: pointer;
    transition: background 0.15s;
}
.hc-search-btn:hover { background: var(--primary-dark); }

/* ===== MAIN ===== */
.hc-main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}
.hc-inner-page { max-width: 1000px; }

/* Hero */
.hc-hero {
    text-align: center;
    padding: 3rem 0 2rem;
}
.hc-hero-title {
    font-family: 'Sora', sans-serif;
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.6rem;
    letter-spacing: -0.02em;
}
.hc-hero-sub {
    color: var(--text-muted);
    font-size: 1.05rem;
}

/* Categories Grid */
.hc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1rem;
    margin-bottom: 3rem;
}
.hc-card {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    text-decoration: none;
    color: var(--text);
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.hc-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    text-decoration: none;
}
.hc-card-icon { font-size: 2rem; margin-bottom: 0.3rem; }
.hc-card-title {
    font-family: 'Sora', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    color: var(--text);
}
.hc-card-desc {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.5;
    flex: 1;
}
.hc-card-count {
    font-size: 0.8rem;
    color: var(--primary);
    font-weight: 500;
    margin-top: 0.5rem;
}

/* Popular / Article List */
.hc-section-title {
    font-family: 'Sora', sans-serif;
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--text);
}
.hc-article-list {
    list-style: none;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.hc-article-list--full .hc-article-item { padding: 0; }
.hc-article-item { border-bottom: 1px solid var(--border); }
.hc-article-item:last-child { border-bottom: none; }
.hc-article-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    color: var(--text);
    text-decoration: none;
    gap: 1rem;
    transition: background 0.12s;
}
.hc-article-link:hover { background: var(--surface-alt); text-decoration: none; }
.hc-article-title {
    display: block;
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text);
}
.hc-article-cat {
    display: inline-block;
    font-size: 0.75rem;
    color: var(--primary);
    background: var(--primary-light);
    padding: 0.15rem 0.6rem;
    border-radius: 50px;
    margin-top: 0.2rem;
    font-weight: 500;
}
.hc-article-excerpt {
    display: block;
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}
.hc-arrow { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }

/* Breadcrumb */
.hc-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}
.hc-breadcrumb a { color: var(--text-muted); }
.hc-breadcrumb a:hover { color: var(--primary); }

/* Page Header */
.hc-page-header {
    margin-bottom: 2rem;
}
.hc-page-icon { font-size: 2.5rem; display: block; margin-bottom: 0.5rem; }
.hc-page-title {
    font-family: 'Sora', sans-serif;
    font-weight: 700;
    font-size: clamp(1.4rem, 3vw, 2rem);
    letter-spacing: -0.02em;
    margin-bottom: 0.4rem;
}
.hc-page-desc { color: var(--text-muted); font-size: 0.95rem; }

/* Article Layout */
.hc-article-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 2rem;
    align-items: start;
}
@media (max-width: 768px) {
    .hc-article-layout { grid-template-columns: 1fr; }
}

.hc-article-h1 {
    font-family: 'Sora', sans-serif;
    font-weight: 700;
    font-size: clamp(1.3rem, 3vw, 1.8rem);
    letter-spacing: -0.02em;
    margin-bottom: 0.6rem;
}
.hc-article-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}
.hc-article-content {
    font-size: 0.97rem;
    line-height: 1.8;
    color: #2d3748;
}
.hc-article-content h2 {
    font-family: 'Sora', sans-serif;
    font-size: 1.25rem;
    font-weight: 600;
    margin: 1.5rem 0 0.6rem;
    color: var(--text);
}
.hc-article-content h3 {
    font-family: 'Sora', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    margin: 1.2rem 0 0.4rem;
    color: var(--text);
}
.hc-article-content p { margin-bottom: 1rem; }
.hc-article-content ol, .hc-article-content ul {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}
.hc-article-content li { margin-bottom: 0.4rem; }
.hc-article-content strong { font-weight: 600; color: var(--text); }
.hc-article-content a { color: var(--primary); }
.hc-article-content code {
    background: var(--surface-alt);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-size: 0.88em;
    font-family: 'Courier New', monospace;
}

/* Helpful */
.hc-helpful {
    margin-top: 2.5rem;
    padding: 1.5rem;
    background: var(--surface-alt);
    border-radius: var(--radius);
    text-align: center;
}
.hc-helpful p { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 0.8rem; }
.hc-helpful-btns { display: flex; gap: 0.7rem; justify-content: center; }
.hc-helpful-btn {
    border: 1.5px solid var(--border);
    background: white;
    padding: 0.4rem 1.2rem;
    border-radius: 50px;
    cursor: pointer;
    font-size: 0.9rem;
    font-family: inherit;
    transition: all 0.15s;
}
.hc-helpful-btn:hover { border-color: var(--primary); background: var(--primary-light); }
.hc-helpful-thanks { color: var(--success) !important; font-weight: 500; }

/* Sidebar */
.hc-sidebar-box {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
}
.hc-sidebar-box h4 {
    font-family: 'Sora', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}
.hc-sidebar-list { list-style: none; }
.hc-sidebar-list li { border-bottom: 1px solid var(--border); }
.hc-sidebar-list li:last-child { border-bottom: none; }
.hc-sidebar-list a {
    display: block;
    padding: 0.5rem 0;
    font-size: 0.88rem;
    color: var(--text);
    transition: color 0.12s;
}
.hc-sidebar-list a:hover { color: var(--primary); text-decoration: none; }
.hc-sidebar-contact { background: var(--primary-light); border-color: rgba(26,86,255,0.2); }
.hc-sidebar-contact p { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.75rem; }
.hc-contact-btn {
    display: block;
    background: var(--primary);
    color: white;
    text-align: center;
    padding: 0.6rem 1rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.875rem;
    transition: background 0.15s;
}
.hc-contact-btn:hover { background: var(--primary-dark); text-decoration: none; }
.hc-sidebar-empty { font-size: 0.85rem; color: var(--text-muted); }

/* Contact Form */
.hc-contact-page { max-width: 560px; }
.hc-form { margin-top: 1.5rem; }
.hc-form-group { margin-bottom: 1.2rem; }
.hc-form-row { display: flex; gap: 1rem; }
.hc-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 0.4rem;
}
.hc-input, .hc-textarea, select.hc-input {
    width: 100%;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.85rem;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text);
    background: white;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    appearance: auto;
}
.hc-input:focus, .hc-textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,86,255,0.1);
}
.hc-input--lg { font-size: 1.05rem; padding: 0.75rem 1rem; }
.hc-textarea { resize: vertical; min-height: 130px; }
.hc-submit-btn {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.75rem 1.8rem;
    font-family: 'Sora', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}
.hc-submit-btn:hover { background: var(--primary-dark); transform: translateY(-1px); }

/* Alerts */
.hc-alert {
    padding: 0.9rem 1.1rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    margin-bottom: 1.2rem;
}
.hc-alert--success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(5,150,105,0.2); }
.hc-alert--error { background: var(--error-bg); color: var(--error); border: 1px solid rgba(220,38,38,0.2); }

.hc-empty {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    background: white;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
}

/* Footer */
.hc-footer {
    text-align: center;
    padding: 2rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    margin-top: 2rem;
}
.hc-footer a { color: var(--primary); }

/* ===== ADMIN PANEL ===== */
.hc-admin-body {
    background: #f0f2f5;
}
.hc-admin-nav {
    background: #0f1117;
    padding: 0 1.5rem;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}
.hc-admin-nav-brand {
    font-family: 'Sora', sans-serif;
    font-weight: 600;
    color: white;
    font-size: 0.95rem;
}
.hc-admin-nav-links {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    font-size: 0.875rem;
}
.hc-admin-nav-links a { color: #9ca3af; transition: color 0.12s; }
.hc-admin-nav-links a:hover { color: white; text-decoration: none; }
.hc-admin-btn-sm {
    background: var(--primary) !important;
    color: white !important;
    padding: 0.35rem 0.9rem;
    border-radius: 6px;
    font-weight: 600;
}
.hc-admin-logout { color: #ef4444 !important; }

.hc-admin-container {
    max-width: 1100px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

.hc-admin-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}
.hc-stat-card {
    background: white;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
}
.hc-stat-num {
    font-family: 'Sora', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}
.hc-stat-label { font-size: 0.85rem; color: var(--text-muted); }

.hc-admin-section {
    background: white;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 2rem;
}
.hc-admin-section-header {
    padding: 1.1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.hc-admin-section-header h2 {
    font-family: 'Sora', sans-serif;
    font-size: 1rem;
    font-weight: 600;
}
.hc-admin-btn {
    background: var(--primary);
    color: white;
    padding: 0.4rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
}
.hc-admin-btn:hover { background: var(--primary-dark); text-decoration: none; }

.hc-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.hc-table thead { background: var(--surface-alt); }
.hc-table th {
    text-align: left;
    padding: 0.7rem 1.25rem;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}
.hc-table td {
    padding: 0.85rem 1.25rem;
    border-top: 1px solid var(--border);
    color: var(--text);
}
.hc-table tr:hover td { background: var(--surface-alt); }
.hc-table-actions { display: flex; gap: 0.75rem; }
.hc-action-link { font-weight: 500; font-size: 0.85rem; }
.hc-action-link--danger { color: var(--error) !important; }

.hc-badge {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
}
.hc-badge--green { background: var(--success-bg); color: var(--success); }
.hc-badge--gray { background: #f3f4f6; color: #6b7280; }

/* Edit Form */
.hc-edit-form { background: white; border: 1.5px solid var(--border); border-radius: var(--radius); padding: 2rem; margin-top: 1rem; }
.hc-edit-actions { display: flex; gap: 1rem; align-items: center; margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.hc-cancel-btn { color: var(--text-muted); font-size: 0.9rem; padding: 0.7rem 1.2rem; border-radius: var(--radius-sm); border: 1.5px solid var(--border); background: white; }
.hc-cancel-btn:hover { background: var(--surface-alt); text-decoration: none; color: var(--text); }
.hc-checkbox-label { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; cursor: pointer; padding-bottom: 0.55rem; }

/* Login */
.hc-login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}
.hc-login-box {
    background: white;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}
.hc-login-logo {
    text-align: center;
    margin-bottom: 2rem;
}
.hc-login-logo span { font-size: 2.5rem; display: block; margin-bottom: 0.5rem; }
.hc-login-logo h2 { font-family: 'Sora', sans-serif; font-weight: 700; font-size: 1.2rem; }
.hc-login-logo p { color: var(--text-muted); font-size: 0.85rem; margin-top: 0.2rem; }

/* ===== WIDGET ===== */
/* (widget.js handles its own injected styles) */

/* ===== RESPONSIVE ===== */
@media (max-width: 640px) {
    .hc-header-inner { flex-wrap: wrap; }
    .hc-search-form { order: 3; width: 100%; }
    .hc-admin-stats { grid-template-columns: 1fr; }
    .hc-form-row { flex-direction: column; }
}
