/* ============================================================
   Mobile Message Help Centre — app.css
   ============================================================ */

/* --- Custom font via local woff2 -------------------------- */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('/assets/fonts/inter/inter-variable.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
                   U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
                   U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* --- Root variables --------------------------------------- */
:root {
    --primary:      #1F73B7;
    --primary-dark: #1557A0;
    --primary-light:#EBF5FB;
    --text:         #1F2937;
    --muted:        #6B7280;
    --border:       #E5E7EB;
    --bg:           #F9FAFB;
    --white:        #FFFFFF;
    --radius:       8px;
    --shadow-sm:    0 1px 3px rgba(0,0,0,.08);
    --shadow-md:    0 4px 12px rgba(0,0,0,.10);
    --sidebar-w:    240px;
}

/* --- Base ------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text);
    background: var(--bg);
    font-size: 15px;
    line-height: 1.6;
    margin: 0;
}

a { color: var(--primary); }
a:hover { color: var(--primary-dark); }

.font-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85em; }

/* ============================================================
   PUBLIC SITE
   ============================================================ */

/* Navbar */
.site-nav {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: .75rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.site-nav .navbar-brand {
    font-size: 1rem;
    color: var(--text);
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1.2;
}

.site-nav .navbar-brand strong { font-weight: 700; color: var(--primary); }
.navbar-logo { height: 26px; width: auto; display: block; }
.nav-help-label { font-size: .75rem; color: var(--muted); }

.nav-search-form .form-control {
    width: 240px;
    border-radius: 20px;
    font-size: .875rem;
    border-color: var(--border);
}

/* Footer */
.site-footer {
    background: var(--white);
    border-top: 1px solid var(--border);
    padding: 1.5rem 0;
    margin-top: 4rem;
    font-size: .875rem;
}

/* ---- Hero ------------------------------------------------ */
.hero {
    background: linear-gradient(135deg, #EBF5FB 0%, #DBEAFE 100%);
    padding: 4rem 0;
    text-align: center;
}

.hero-title {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: .5rem;
}

.hero-subtitle {
    color: var(--muted);
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

.hero-search-wrap {
    display: flex;
    max-width: 560px;
    margin: 0 auto;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 40px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.hero-search-input {
    flex: 1;
    border: none;
    outline: none;
    padding: .85rem 1.25rem;
    font-size: 1rem;
    font-family: inherit;
    color: var(--text);
    background: transparent;
}

.hero-search-btn {
    background: var(--primary);
    color: var(--white);
    border: none;
    padding: .85rem 1.75rem;
    font-size: .95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
    border-radius: 0 40px 40px 0;
}

.hero-search-btn:hover { background: var(--primary-dark); }

/* ---- Section headings ------------------------------------ */
.section-heading {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    padding-bottom: .5rem;
    margin-bottom: 1.25rem;
}

/* ---- Category cards -------------------------------------- */
.category-card {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-decoration: none;
    color: var(--text);
    transition: box-shadow .15s, border-color .15s;
    height: 100%;
}

.category-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
    color: var(--text);
}

.category-icon {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: .55rem;
    background: #1494ba;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.category-body { flex: 1; min-width: 0; }

.category-name { font-size: 1rem; font-weight: 600; margin: 0 0 .25rem; }

.category-desc {
    font-size: .875rem;
    color: var(--muted);
    margin: 0 0 .5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.category-count { font-size: .8rem; color: var(--muted); }

.category-arrow { color: var(--muted); margin-top: .25rem; }

/* ---- Category header ------------------------------------- */
.category-header {
    background: linear-gradient(135deg, var(--primary-light) 0%, #DBEAFE 100%);
    border-bottom: 1px solid var(--border);
    padding: 2rem 0;
}

.category-header-inner { display: flex; align-items: center; gap: 1rem; margin-top: .5rem; }
.category-header-icon {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: .7rem;
    background: #1494ba;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.category-header-title { font-size: 1.75rem; font-weight: 700; margin: 0; }
.category-header-desc { color: var(--muted); margin: .25rem 0 0; }

.category-icon .bi { font-size: 1.35rem; color: white; }
.category-header-icon .bi { font-size: 1.7rem; color: white; }

/* ---- Section groups -------------------------------------- */
.section-group-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary);
    border-bottom: 1px solid var(--border);
    padding-bottom: .5rem;
    margin-bottom: 1rem;
}

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

/* ---- Article card grid ----------------------------------- */
.article-card-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: .6rem;
}

@media (max-width: 600px) {
    .article-card-grid { grid-template-columns: 1fr; }
}

.article-card {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .9rem 1rem;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    transition: border-color .15s, box-shadow .15s;
}

.article-card:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(0,0,0,.06);
    color: var(--primary);
}

.article-card-title {
    flex: 1;
    font-size: .9rem;
    font-weight: 500;
    line-height: 1.4;
}

.article-card-arrow {
    flex-shrink: 0;
    color: var(--muted);
    transition: color .15s;
}

.article-card:hover .article-card-arrow { color: var(--primary); }

/* ---- Article body ---------------------------------------- */
.article-title { font-size: 1.75rem; font-weight: 700; margin-bottom: .5rem; }
.article-meta { font-size: .875rem; margin-bottom: 1.5rem; }

.article-content { line-height: 1.8; }
.article-content h2 { font-size: 1.3rem; font-weight: 600; margin-top: 2rem; }
.article-content h3 { font-size: 1.1rem; font-weight: 600; margin-top: 1.5rem; }
.article-content p { margin-bottom: 1rem; }
.article-content ul, .article-content ol { padding-left: 1.5rem; margin-bottom: 1rem; }
.article-content li { margin-bottom: .3rem; }
.article-content code { background: #F3F4F6; padding: .1em .35em; border-radius: 3px; font-size: .9em; }
.article-content pre { background: #1E293B; color: #E2E8F0; padding: 1.25rem; border-radius: var(--radius); overflow-x: auto; }
.article-content pre code { background: none; color: inherit; padding: 0; }
.article-content blockquote { border-left: 3px solid var(--primary); padding-left: 1rem; color: var(--muted); margin: 1rem 0; }
.article-content table { width: 100%; border-collapse: collapse; margin-bottom: 1rem; font-size: .9rem; }
.article-content th, .article-content td { border: 1px solid var(--border); padding: .5rem .75rem; text-align: left; }
.article-content th { background: var(--bg); font-weight: 600; }
.article-content img { max-width: min(500px, 100%); width: auto; height: auto; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: 0 2px 6px rgba(0,0,0,.08); display: block; margin: 1.25rem 0; }
.article-content hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }
.article-content .video-embed { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; margin: 1.5rem 0; border-radius: var(--radius); }
.article-content .video-embed iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0; }

/* ---- TOC Sidebar ----------------------------------------- */
.toc-sidebar {
    position: sticky;
    top: 80px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    font-size: .875rem;
}

.toc-title { font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: .75rem; }

.toc-list { list-style: none; margin: 0; padding: 0; }
.toc-item { margin: 0; }
.toc-level-2 { padding-left: 0; }
.toc-level-3 { padding-left: 1rem; }

.toc-link {
    display: block;
    padding: .3rem .5rem;
    color: var(--muted);
    text-decoration: none;
    border-radius: 4px;
    transition: color .1s, background .1s;
    line-height: 1.4;
}

.toc-link:hover { color: var(--text); background: var(--bg); }
.toc-link.active { color: var(--primary); font-weight: 500; background: var(--primary-light); }

/* ---- Feedback bar ---------------------------------------- */
.feedback-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .75rem;
    margin-top: 3rem;
    padding: 1rem 1.5rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 40px;
    font-size: .9rem;
}

.feedback-question { color: var(--muted); }

.feedback-btn {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: .3rem .9rem;
    font-size: .875rem;
    cursor: pointer;
    transition: all .15s;
}

.feedback-btn:hover { border-color: var(--primary); color: var(--primary); }

/* ---- Related articles ------------------------------------ */
.related-title { font-size: 1rem; font-weight: 600; margin-bottom: .75rem; }

/* ---- Search results -------------------------------------- */
.search-result-item {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: .75rem;
    transition: box-shadow .15s;
}

.search-result-item:hover { box-shadow: var(--shadow-sm); }

.search-result-category { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--primary); font-weight: 600; margin-bottom: .25rem; }

.search-result-title { font-size: 1.05rem; font-weight: 600; margin: 0 0 .3rem; }
.search-result-title a { text-decoration: none; color: var(--text); }
.search-result-title a:hover { color: var(--primary); }

.search-result-excerpt { color: var(--muted); font-size: .9rem; margin: 0; }

/* ---- Empty state ----------------------------------------- */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--muted); }

/* ---- Error page ------------------------------------------ */
.error-page { padding: 4rem 0; }
.error-code { font-size: 6rem; font-weight: 800; color: var(--border); line-height: 1; }
.error-title { font-size: 1.5rem; font-weight: 700; margin-top: .5rem; }

/* Breadcrumb */
.breadcrumb { font-size: .875rem; }
.breadcrumb-item + .breadcrumb-item::before { content: '/'; }

/* ============================================================
   ADMIN
   ============================================================ */

.admin-body { background: #F1F5F9; }

.admin-wrapper { display: flex; min-height: 100vh; }

/* Sidebar */
.admin-sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--white);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 200;
}

.sidebar-brand {
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-brand a { text-decoration: none; display: flex; flex-direction: column; align-items: center; line-height: 1.3; }
.sidebar-brand strong { color: var(--primary); font-size: .95rem; }
.sidebar-logo { height: 22px; width: auto; display: block; }
.sidebar-brand span { font-size: .75rem; color: var(--muted); }

.sidebar-nav { flex: 1; padding: .75rem 0; }
.sidebar-nav ul { list-style: none; margin: 0; padding: 0; }

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .55rem 1.25rem;
    color: var(--muted);
    text-decoration: none;
    font-size: .875rem;
    font-weight: 500;
    transition: color .1s, background .1s;
    border-left: 2px solid transparent;
}

.sidebar-nav a:hover { color: var(--text); background: var(--bg); }
.sidebar-nav a.active { color: var(--primary); background: var(--primary-light); border-left-color: var(--primary); }

.sidebar-divider { border-top: 1px solid var(--border); margin: .5rem 0; }

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
}

.btn-logout {
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: .35rem .75rem;
    font-size: .8rem;
    color: var(--muted);
    cursor: pointer;
    width: 100%;
    transition: all .15s;
}

.btn-logout:hover { background: #FEE2E2; border-color: #FCA5A5; color: #DC2626; }

/* Main area */
.admin-main { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

/* Topbar */
.admin-topbar {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: .75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-breadcrumb { font-size: .875rem; color: var(--muted); }
.topbar-breadcrumb a { color: var(--muted); text-decoration: none; }
.topbar-breadcrumb a:hover { color: var(--text); }
.breadcrumb-sep { margin: 0 .4rem; }

/* Content */
.admin-content { padding: 1.75rem 1.5rem; flex: 1; }

/* Page header */
.page-header { margin-bottom: 1.5rem; }
.page-title { font-size: 1.4rem; font-weight: 700; margin: 0; }

/* Cards */
.card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-header { background: var(--white); border-bottom: 1px solid var(--border); padding: .85rem 1.25rem; }
.card-title { font-size: 1rem; font-weight: 600; }
.card-body { padding: 1.25rem; }

/* Stats */
.stat-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.stat-card-success { border-top: 3px solid #10B981; }
.stat-card-warning { border-top: 3px solid #F59E0B; }

.stat-number { font-size: 2.5rem; font-weight: 800; color: var(--text); line-height: 1; }
.stat-label { font-size: .875rem; color: var(--muted); margin-top: .25rem; }

/* Article grouped list */
.article-groups { display: flex; flex-direction: column; gap: 2rem; }
.article-group-heading {
    font-size: .7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--muted);
    margin: 0 0 .5rem;
    display: flex;
    align-items: center;
    gap: .5rem;
}
.article-group-count {
    background: var(--border);
    color: var(--muted);
    border-radius: 99px;
    padding: 0 .45em;
    font-size: .9em;
    font-weight: 600;
}
.article-group-list {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.article-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .7rem 1rem;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: var(--text);
    transition: background .1s;
}
.article-row:last-child { border-bottom: none; }
.article-row:hover { background: var(--bg); color: var(--primary); }
.article-row-title { flex: 1; font-size: .9rem; font-weight: 500; min-width: 0; }
.article-row-right { display: flex; align-items: center; gap: .5rem; flex-shrink: 0; }
.article-row-section { font-size: .78rem; color: var(--muted); }
.article-row-date { font-size: .78rem; color: var(--muted); white-space: nowrap; }

/* Tables */
.admin-table { font-size: .875rem; margin: 0; }
.admin-table th { font-weight: 600; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; background: var(--bg); }
.admin-table td, .admin-table th { padding: .65rem 1rem; vertical-align: middle; }
.admin-table tbody tr:hover { background: var(--bg); }

/* Editor layout */
.editor-layout { display: grid; grid-template-columns: 1fr 300px; gap: 1.5rem; align-items: start; }
.editor-main { min-width: 0; }
.editor-sidebar { position: sticky; top: 65px; max-height: calc(100vh - 80px); overflow-y: auto; padding-right: 2px; }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); }
.login-card { background: var(--white); border: 1px solid var(--border); border-radius: 12px; padding: 2.5rem; width: 100%; max-width: 400px; box-shadow: var(--shadow-md); }
.login-logo { text-align: center; margin-bottom: 1.75rem; }
.login-logo strong { display: block; font-size: 1.2rem; color: var(--primary); font-weight: 700; }
.login-logo span { font-size: .875rem; color: var(--muted); }

/* Media grid */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem; }

.media-item {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: box-shadow .15s;
}

.media-item:hover { box-shadow: var(--shadow-md); }

.media-thumb { aspect-ratio: 4/3; overflow: hidden; background: var(--bg); }
.media-thumb img { width: 100%; height: 100%; object-fit: cover; }
.media-info { padding: .75rem; }
.media-filename { font-size: .8rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
