/* ============================================================
   admin.css — CBSE CMS Admin Panel
   Font: Plus Jakarta Sans + JetBrains Mono
   Theme: Deep navy sidebar, clean white content area
   ============================================================ */

:root {
    --sidebar-w:       240px;
    --sidebar-bg:      #0f172a;
    --sidebar-border:  #1e293b;
    --nav-hover:       #1e293b;
    --nav-active-bg:   #2563eb;
    --nav-active-text: #fff;
    --nav-text:        #94a3b8;
    --nav-text-hover:  #e2e8f0;
    --brand-accent:    #3b82f6;

    --topbar-h:        60px;
    --topbar-bg:       #ffffff;
    --topbar-border:   #e2e8f0;

    --body-bg:         #f1f5f9;
    --card-bg:         #ffffff;
    --card-border:     #e2e8f0;
    --card-shadow:     0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);

    --text-primary:    #0f172a;
    --text-secondary:  #475569;
    --text-muted:      #94a3b8;

    --accent:          #2563eb;
    --accent-light:    #eff6ff;
    --success:         #16a34a;
    --danger:          #dc2626;
    --warning:         #d97706;

    --radius:          10px;
    --radius-sm:       6px;
    --transition:      .18s ease;

    --font-main:  'Plus Jakarta Sans', system-ui, sans-serif;
    --font-mono:  'JetBrains Mono', 'Courier New', monospace;
}

/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font-main);
    font-size: 14px;
    background: var(--body-bg);
    color: var(--text-primary);
    overflow-x: hidden;
}

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

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform var(--transition);
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--sidebar-border);
}

.brand-icon {
    width: 38px; height: 38px;
    background: var(--accent);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; color: #fff;
    flex-shrink: 0;
}

.brand-name {
    display: block;
    font-size: 15px;
    font-weight: 700;
    color: #f1f5f9;
    line-height: 1.2;
}

.brand-sub {
    display: block;
    font-size: 11px;
    color: var(--nav-text);
    font-weight: 400;
}

.sidebar-nav {
    padding: 16px 12px;
    flex: 1;
}

.nav-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #475569;
    padding: 0 8px;
    margin-bottom: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--nav-text);
    font-weight: 500;
    font-size: 13.5px;
    margin-bottom: 2px;
    transition: background var(--transition), color var(--transition);
    text-decoration: none;
}

.nav-item i { font-size: 16px; }
.nav-item:hover { background: var(--nav-hover); color: var(--nav-text-hover); text-decoration: none; }
.nav-item.active { background: var(--nav-active-bg); color: var(--nav-active-text); }
.nav-item.text-danger-soft { color: #f87171; }
.nav-item.text-danger-soft:hover { background: #450a0a; color: #fca5a5; }

.sidebar-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--sidebar-border);
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--nav-text);
    font-size: 13px;
    font-weight: 500;
}
.sidebar-footer i { font-size: 18px; }

/* ===== MAIN WRAPPER ===== */
.main-wrapper {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin var(--transition);
}

/* ===== TOPBAR ===== */
.topbar {
    height: var(--topbar-h);
    background: var(--topbar-bg);
    border-bottom: 1px solid var(--topbar-border);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 24px;
    position: sticky; top: 0;
    z-index: 500;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}

.sidebar-toggle {
    background: none; border: none;
    font-size: 22px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: var(--radius-sm);
    display: none;
}

.topbar-title {
    font-weight: 700;
    font-size: 16px;
    color: var(--text-primary);
    flex: 1;
}

/* ===== PAGE CONTENT ===== */
.page-content {
    padding: 28px 28px 40px;
    flex: 1;
}

/* ===== CARDS ===== */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
}

.card-header-custom {
    padding: 16px 20px;
    border-bottom: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-header-custom h5 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

/* ===== STAT CARDS ===== */
.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--card-shadow);
    transition: transform .15s, box-shadow .15s;
}

.stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.09); }

.stat-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-icon.blue   { background: #eff6ff; color: #2563eb; }
.stat-icon.green  { background: #f0fdf4; color: #16a34a; }
.stat-icon.orange { background: #fff7ed; color: #ea580c; }
.stat-icon.red    { background: #fef2f2; color: #dc2626; }

.stat-num {
    font-size: 26px;
    font-weight: 800;
    line-height: 1;
    color: var(--text-primary);
}

.stat-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-top: 2px;
}

/* ===== TABLES ===== */
.table-wrapper {
    overflow-x: auto;
    border-radius: 0 0 var(--radius) var(--radius);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

.data-table thead th {
    background: #f8fafc;
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 11.5px;
    letter-spacing: .05em;
    text-transform: uppercase;
    padding: 10px 14px;
    border-bottom: 1px solid var(--card-border);
    white-space: nowrap;
}

.data-table tbody tr { border-bottom: 1px solid #f1f5f9; transition: background .1s; }
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: #f8fafc; }
.data-table tbody td { padding: 11px 14px; vertical-align: middle; }

.badge-status {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 9px;
    border-radius: 99px;
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: opacity .15s;
}

.badge-status.active   { background: #dcfce7; color: #15803d; }
.badge-status.inactive { background: #fee2e2; color: #b91c1c; }
.badge-status:hover { opacity: .75; }

.action-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 30px; height: 30px;
    border-radius: 7px;
    border: 1px solid var(--card-border);
    background: #fff;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: all .15s;
    text-decoration: none;
}
.action-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.action-btn.delete:hover { background: var(--danger); border-color: var(--danger); color: #fff; }

/* ===== FORMS ===== */
.form-label {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.form-control, .form-select {
    border-color: var(--card-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: var(--font-main);
    transition: border-color .15s, box-shadow .15s;
}

.form-control:focus, .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

.form-hint {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 4px;
}

.input-group-text {
    background: #f8fafc;
    border-color: var(--card-border);
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 12px;
}

/* Character counters */
.char-count {
    font-family: var(--font-mono);
    font-size: 11px;
    float: right;
    margin-top: 4px;
}
.char-count.ok    { color: var(--success); }
.char-count.warn  { color: var(--warning); }
.char-count.error { color: var(--danger);  }

/* Slug field */
.slug-wrapper { position: relative; }
.slug-preview {
    font-family: var(--font-mono);
    font-size: 12.5px;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    color: #0369a1;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    margin-top: 5px;
    word-break: break-all;
}

/* SEO fields */
.seo-section {
    background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
    border: 1px dashed #93c5fd;
    border-radius: var(--radius);
    padding: 20px;
    margin-top: 8px;
}

.seo-section h6 {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #1d4ed8;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ===== MEDIA MANAGER ===== */
.upload-zone {
    border: 2px dashed #cbd5e1;
    border-radius: var(--radius);
    padding: 40px 20px;
    text-align: center;
    background: #f8fafc;
    transition: all .2s;
    cursor: pointer;
}
.upload-zone:hover, .upload-zone.drag-over {
    border-color: var(--accent);
    background: var(--accent-light);
}
.upload-zone i { font-size: 40px; color: #94a3b8; display: block; margin-bottom: 10px; }
.upload-zone p { margin: 0; color: var(--text-muted); font-size: 13.5px; }
.upload-zone strong { color: var(--accent); }

.upload-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.upload-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--card-shadow);
}

.upload-card-img {
    width: 100%; height: 140px;
    object-fit: cover;
    display: block;
}

.upload-card-body {
    padding: 10px;
}

.upload-card-url {
    font-family: var(--font-mono);
    font-size: 10.5px;
    background: #f1f5f9;
    padding: 5px 8px;
    border-radius: 4px;
    word-break: break-all;
    color: var(--text-secondary);
    margin-bottom: 8px;
    cursor: pointer;
}

.copy-btn {
    display: inline-flex; align-items: center; gap: 4px;
    font-size: 11px;
    padding: 3px 8px;
    border-radius: 5px;
}

/* ===== PROGRESS BAR ===== */
.upload-progress {
    height: 4px;
    background: #e2e8f0;
    border-radius: 99px;
    overflow: hidden;
    margin-top: 12px;
}
.upload-progress-bar {
    height: 100%;
    background: var(--accent);
    border-radius: 99px;
    transition: width .3s ease;
    width: 0%;
}

/* ===== SEARCH & FILTER BAR ===== */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    padding: 14px 20px;
    background: #f8fafc;
    border-bottom: 1px solid var(--card-border);
}
.filter-bar .form-control,
.filter-bar .form-select { font-size: 13px; }

/* ===== LOGIN PAGE ===== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
}

.login-card {
    width: 100%; max-width: 400px;
    background: #fff;
    border-radius: 16px;
    padding: 40px 36px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}

.login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 28px;
}

.login-logo-icon {
    width: 50px; height: 50px;
    background: var(--accent);
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; color: #fff;
}

.login-logo-text strong { display: block; font-size: 18px; font-weight: 800; }
.login-logo-text span   { font-size: 12px; color: var(--text-muted); }

.login-card h2 { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.login-card p  { color: var(--text-muted); font-size: 13.5px; margin-bottom: 24px; }

/* ===== RECENT ARTICLES TABLE (dashboard) ===== */
.article-title-cell {
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}

.category-badge {
    background: #eff6ff;
    color: #1d4ed8;
    border-radius: 99px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
}

/* ===== TINYMCE WRAPPER ===== */
.tox-tinymce { border-radius: var(--radius-sm) !important; border-color: var(--card-border) !important; }
.tox-tinymce:focus-within { border-color: var(--accent) !important; }

/* ===== RESPONSIVE ===== */
@media (max-width: 991px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-wrapper { margin-left: 0; }
    .sidebar-toggle { display: flex; }
    .page-content { padding: 20px 16px 40px; }
    .topbar { padding: 0 16px; }
}

@media (max-width: 575px) {
    .stat-card { flex-direction: column; text-align: center; }
    .filter-bar { flex-direction: column; }
    .filter-bar .form-control,
    .filter-bar .form-select { width: 100%; }
}

/* ===== UTILITIES ===== */
.text-mono { font-family: var(--font-mono); }
.fw-700 { font-weight: 700; }
.gap-8  { gap: 8px; }
.btn-accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-accent:hover { background: #1d4ed8; border-color: #1d4ed8; color: #fff; }
