/* ============================================================
   ZenithCMS Admin & Editorial Suite CSS
   Minimalist Medium-Inspired Writing Environment
   ============================================================ */

:root {
    --adm-bg: #090d16;
    --adm-surface: #111827;
    --adm-surface-alt: #1a2234;
    --adm-border: #1f2937;
    --adm-border-hover: #374151;
    --adm-text: #f9fafb;
    --adm-text-muted: #9ca3af;
    --adm-primary: #0284c7;
    --adm-primary-hover: #0369a1;
    --adm-accent: #38bdf8;
    --adm-success: #10b981;
    --adm-warning: #f59e0b;
    --adm-danger: #ef4444;
    --adm-sidebar-width: 260px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--adm-bg);
    color: var(--adm-text);
    min-height: 100vh;
    display: flex;
}

a { color: var(--adm-accent); text-decoration: none; }
a:hover { color: #7dd3fc; }

/* Admin Sidebar */
.adm-sidebar {
    width: var(--adm-sidebar-width);
    background: var(--adm-surface);
    border-right: 1px solid var(--adm-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.adm-brand {
    padding: 1.5rem 1.25rem;
    font-size: 1.25rem;
    font-weight: 800;
    border-bottom: 1px solid var(--adm-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.adm-brand a { color: #fff; }
.adm-version-tag { font-size: 0.72rem; color: var(--adm-accent); font-weight: 600; background: rgba(56, 189, 248, 0.1); padding: 2px 6px; border-radius: 4px; }

.adm-nav {
    list-style: none;
    padding: 1rem 0.75rem;
    flex: 1;
}

.adm-nav-item { margin-bottom: 4px; }

.adm-nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    border-radius: 8px;
    color: var(--adm-text-muted);
    font-size: 0.92rem;
    font-weight: 500;
    transition: all 0.15s ease;
}

.adm-nav-link:hover, .adm-nav-link.active {
    background: var(--adm-surface-alt);
    color: #fff;
}

.adm-nav-badge {
    margin-left: auto;
    background: var(--adm-primary);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 9999px;
}

.adm-nav-badge.warning { background: var(--adm-warning); color: #000; }

.adm-user-panel {
    padding: 1rem;
    border-top: 1px solid var(--adm-border);
    background: #0d131f;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.adm-user-info { display: flex; align-items: center; gap: 0.6rem; font-size: 0.88rem; }
.adm-user-avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: #1e293b; }

/* Main Admin Workspace */
.adm-workspace {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.adm-topbar {
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--adm-border);
    background: rgba(17, 24, 39, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.adm-page-title { font-size: 1.45rem; font-weight: 700; color: #fff; letter-spacing: -0.3px; }

.adm-body {
    padding: 2rem;
    flex: 1;
    overflow-y: auto;
}

/* Stats Cards Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--adm-surface);
    border: 1px solid var(--adm-border);
    border-radius: 12px;
    padding: 1.5rem;
}

.stat-label { font-size: 0.82rem; font-weight: 600; text-transform: uppercase; color: var(--adm-text-muted); letter-spacing: 0.5px; margin-bottom: 0.5rem; }
.stat-value { font-size: 2rem; font-weight: 800; color: #fff; }
.stat-sub { font-size: 0.82rem; color: var(--adm-text-muted); margin-top: 0.25rem; }

/* Pure CSS Bar Chart for 7-Day Analytics */
.chart-box {
    background: var(--adm-surface);
    border: 1px solid var(--adm-border);
    border-radius: 12px;
    padding: 1.75rem;
    margin-bottom: 2rem;
}

.chart-bars-wrap {
    display: flex;
    align-items: flex-end;
    gap: 1.25rem;
    height: 180px;
    padding-top: 20px;
    border-bottom: 1px solid var(--adm-border);
}

.chart-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
}

.chart-bar {
    width: 100%;
    max-width: 42px;
    background: linear-gradient(180deg, var(--adm-accent) 0%, var(--adm-primary) 100%);
    border-radius: 6px 6px 0 0;
    transition: height 0.3s ease;
    min-height: 4px;
    position: relative;
}

.chart-bar:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    top: -28px;
    left: 50%;
    transform: translateX(-50%);
    background: #000;
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
}

.chart-label { font-size: 0.75rem; color: var(--adm-text-muted); margin-top: 8px; }

/* Tables */
.table-container {
    background: var(--adm-surface);
    border: 1px solid var(--adm-border);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 2rem;
}

.adm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
    text-align: left;
}

.adm-table th {
    background: var(--adm-surface-alt);
    padding: 12px 18px;
    color: var(--adm-text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--adm-border);
}

.adm-table td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--adm-border);
    color: #e2e8f0;
}

.adm-table tr:last-child td { border-bottom: none; }
.adm-table tr:hover td { background: rgba(255, 255, 255, 0.02); }

/* Badges */
.badge-status {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-published { background: rgba(16, 185, 129, 0.15); color: #34d399; }
.badge-pending { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.badge-draft { background: rgba(100, 116, 139, 0.2); color: #94a3b8; }
.badge-rejected { background: rgba(239, 68, 68, 0.15); color: #f87171; }

/* Forms & Medium-Style Canvas */
.form-panel {
    background: var(--adm-surface);
    border: 1px solid var(--adm-border);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
}

.editor-wrapper {
    max-width: 860px;
    margin: 0 auto;
}

.medium-title-input {
    width: 100%;
    background: transparent;
    border: none;
    font-size: 2.25rem;
    font-weight: 800;
    color: #fff;
    line-height: 1.25;
    outline: none;
    padding: 0.5rem 0;
    margin-bottom: 0.5rem;
    font-family: inherit;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

.medium-title-input:focus { border-bottom-color: var(--adm-border); }

/* Title Counter Badge */
.title-counter-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--adm-text-muted);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--adm-border);
}

.counter-badge {
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 4px;
}

.counter-good { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.counter-warn { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.counter-bad { background: rgba(239, 68, 68, 0.2); color: #f87171; }

/* Medium-Style Editor Toolbar & Body */
.medium-toolbar {
    display: flex;
    gap: 8px;
    padding: 8px;
    background: #0f172a;
    border: 1px solid var(--adm-border);
    border-radius: 8px;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.tool-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--adm-text-muted);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.88rem;
    cursor: pointer;
    font-weight: 600;
}

.tool-btn:hover { background: #1e293b; color: #fff; border-color: var(--adm-border); }

.medium-content-textarea {
    width: 100%;
    min-height: 450px;
    background: #0a0e17;
    border: 1px solid var(--adm-border);
    border-radius: 8px;
    padding: 1.25rem;
    color: #e2e8f0;
    font-size: 1.15rem;
    line-height: 1.8;
    outline: none;
    font-family: inherit;
    resize: vertical;
}

.medium-content-textarea:focus { border-color: var(--adm-accent); }

/* Inputs and Buttons */
.adm-input, .adm-textarea, .adm-select {
    width: 100%;
    padding: 10px 14px;
    background: #0a0e17;
    border: 1px solid var(--adm-border);
    border-radius: 8px;
    color: #fff;
    font-size: 0.95rem;
}

.adm-input:focus, .adm-textarea:focus, .adm-select:focus {
    outline: none;
    border-color: var(--adm-accent);
}

.adm-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: 8px;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background 0.15s ease;
}

.adm-btn-primary { background: var(--adm-primary); color: #fff; }
.adm-btn-primary:hover { background: var(--adm-primary-hover); }
.adm-btn-success { background: var(--adm-success); color: #fff; }
.adm-btn-danger { background: var(--adm-danger); color: #fff; }
.adm-btn-secondary { background: #1e293b; color: #fff; }
.adm-btn-secondary:hover { background: #334155; }

/* Alerts */
.adm-alert {
    padding: 14px 18px;
    border-radius: 8px;
    font-size: 0.92rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.adm-alert-success { background: rgba(16, 185, 129, 0.15); border: 1px solid var(--adm-success); color: #6ee7b7; }
.adm-alert-danger { background: rgba(239, 68, 68, 0.15); border: 1px solid var(--adm-danger); color: #fca5a5; }
.adm-alert-warning { background: rgba(245, 158, 11, 0.15); border: 1px solid var(--adm-warning); color: #fde68a; }

/* Professional Gating Progress Card */
.gating-card {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid #38bdf8;
    border-radius: 12px;
    padding: 1.75rem;
    margin-bottom: 2rem;
}

.progress-bar-container {
    background: #1e293b;
    border-radius: 9999px;
    height: 12px;
    overflow: hidden;
    margin: 1rem 0;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #38bdf8, #10b981);
    transition: width 0.4s ease;
}

/* Modals */
.adm-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.adm-modal-overlay.active { opacity: 1; visibility: visible; }

.adm-modal-box {
    background: var(--adm-surface);
    border: 1px solid var(--adm-border);
    border-radius: 14px;
    padding: 24px;
    width: 100%;
    max-width: 520px;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.6);
}

@media (max-width: 900px) {
    body { flex-direction: column; }
    .adm-sidebar { width: 100%; height: auto; position: static; }
    .adm-body { padding: 1.25rem; }
}
