/* Admin Panel Styles */

:root {
    --color-primary: #d62828;
    --color-secondary: #1d3557;
    --color-accent: #f4d35e;
    --color-background: #f4f1ec;
    --color-surface: #ffffff;
    --color-ink: #121212;
    --color-muted: #666666;
    --color-light-border: #e0e0e0;
    --radius: 10px;
    --shadow-soft: 0 4px 16px rgba(0, 0, 0, 0.06);
    --shadow-medium: 0 10px 32px rgba(0, 0, 0, 0.12);
    --font-sm: clamp(13px, 1.2vw, 14px);
    --font-base: clamp(14px, 1.4vw, 16px);
    --font-lg: clamp(16px, 1.8vw, 18px);
    --font-xl: clamp(18px, 2.2vw, 22px);
    --font-2xl: clamp(22px, 3vw, 28px);
}

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

html, body {
    height: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--color-background);
    color: var(--color-ink);
}

/* Layout */
.admin-layout {
    display: block;
    min-height: 100vh;
}

/* Mobile Topbar — hidden on desktop */
.mobile-topbar {
    display: none;
}

/* Sidebar */
.admin-sidebar {
    background: var(--color-secondary);
    color: white;
    padding: 24px 0;
    position: fixed;
    left: 0;
    top: 0;
    width: 280px;
    height: 100vh;
    overflow-y: auto;
    box-shadow: 2px 0 16px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.sidebar-brand {
    padding: 0 24px 32px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-brand-logo {
    width: 44px;
    height: 44px;
    background: white;
    border-radius: 8px;
    padding: 4px;
    flex-shrink: 0;
}

.sidebar-brand-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.sidebar-brand-text h2 {
    font-family: 'Playfair Display', serif;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 2px;
    line-height: 1;
}

.sidebar-brand-text .subtitle {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.sidebar-nav {
    padding: 24px 12px;
}

.nav-section {
    margin-bottom: 28px;
}

.nav-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 700;
    padding: 0 12px 12px;
    display: block;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    margin-bottom: 6px;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 200ms ease;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-link.active {
    background: var(--color-primary);
    color: white;
    font-weight: 600;
}

.nav-link-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.sidebar-user {
    padding: 24px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: auto;
}

.user-info {
    margin-bottom: 12px;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
    color: white;
}

.user-role {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.logout-btn {
    width: 100%;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 200ms;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Main Content */
.admin-main {
    margin-left: 280px;
    padding: 40px 60px;
    background: var(--color-background);
    max-width: calc(100% - 280px);
    width: 100%;
}

.admin-header {
    margin-bottom: 40px;
}

.admin-title {
    font-family: 'Playfair Display', serif;
    font-size: var(--font-2xl);
    font-weight: 700;
    color: var(--color-ink);
    margin-bottom: 8px;
}

.admin-subtitle {
    color: var(--color-muted);
    font-size: var(--font-base);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 28px;
    margin-bottom: 48px;
}

.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--color-light-border);
    display: flex;
    flex-direction: column;
    transition: all 300ms ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-medium);
}

.stat-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, rgba(214, 40, 40, 0.1), rgba(214, 40, 40, 0.05));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: 16px;
}

.stat-label {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-muted);
    font-weight: 600;
    margin-bottom: 8px;
}

.stat-value {
    font-family: 'Playfair Display', serif;
    font-size: 32px;
    font-weight: 700;
    color: var(--color-ink);
    margin-bottom: 12px;
}

.stat-trend {
    font-size: 12px;
    color: #28a745;
}

/* Sections */
.admin-section {
    background: white;
    border-radius: var(--radius);
    padding: 36px;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--color-light-border);
    margin-bottom: 48px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--color-primary);
}

.section-title {
    font-family: 'Playfair Display', serif;
    font-size: var(--font-xl);
    font-weight: 700;
    color: var(--color-ink);
}

.section-actions {
    display: flex;
    gap: 12px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 200ms ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    background: #a01e1e;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(214, 40, 40, 0.25);
}

.btn-secondary {
    background: var(--color-secondary);
    color: white;
}

.btn-secondary:hover {
    background: #142840;
    transform: translateY(-2px);
}

.btn-ghost {
    background: transparent;
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
}

.btn-ghost:hover {
    background: rgba(214, 40, 40, 0.05);
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    min-height: 32px;
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    border-bottom: 2px solid var(--color-light-border);
}

.data-table th {
    padding: 16px;
    text-align: left;
    font-weight: 700;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-muted);
}

.data-table td {
    padding: 16px;
    border-bottom: 1px solid var(--color-light-border);
}

.data-table tbody tr:hover {
    background: rgba(0, 0, 0, 0.02);
}

.table-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.status-published {
    background: rgba(40, 167, 69, 0.1);
    color: #28a745;
}

.status-draft {
    background: rgba(255, 193, 7, 0.1);
    color: #ffc107;
}

.status-archived {
    background: rgba(108, 117, 125, 0.1);
    color: #6c757d;
}

/* Quick Actions Grid */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.action-card {
    background: white;
    border: 2px solid var(--color-light-border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    transition: all 200ms ease;
    cursor: pointer;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.action-card:hover {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-soft);
    transform: translateY(-2px);
}

.action-icon {
    font-size: 32px;
}

.action-title {
    font-weight: 700;
    font-size: 16px;
    color: var(--color-ink);
}

.action-desc {
    font-size: 12px;
    color: var(--color-muted);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--color-muted);
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-ink);
    margin-bottom: 8px;
}

.empty-text {
    margin-bottom: 24px;
}

/* Responsive */
@media (max-width: 1024px) {
    .admin-sidebar {
        width: 240px;
    }
    
    .admin-main {
        margin-left: 240px;
        padding: 32px 40px;
        max-width: calc(100% - 240px);
    }
    
    .dashboard-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

@media (max-width: 768px) {
    /* --- Mobile Topbar --- */
    .mobile-topbar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 58px;
        background: var(--color-secondary);
        padding: 0 16px;
        z-index: 999;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    }

    .mobile-topbar-brand {
        display: flex;
        align-items: center;
        gap: 10px;
        color: white;
        font-family: 'Playfair Display', serif;
        font-size: 16px;
        font-weight: 700;
    }

    .mobile-topbar-brand img {
        width: 32px;
        height: 32px;
        border-radius: 6px;
        background: white;
        padding: 2px;
        object-fit: contain;
    }

    .hamburger-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(255, 255, 255, 0.15);
        border: none;
        font-size: 22px;
        cursor: pointer;
        color: white;
        width: 40px;
        height: 40px;
        border-radius: 8px;
        transition: background 0.2s ease;
        flex-shrink: 0;
    }

    .hamburger-btn:hover {
        background: rgba(255, 255, 255, 0.25);
    }

    .mobile-logout-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(255, 255, 255, 0.15);
        border: none;
        font-size: 20px;
        cursor: pointer;
        color: white;
        width: 40px;
        height: 40px;
        border-radius: 8px;
        transition: background 0.2s ease;
    }

    .mobile-logout-btn:hover {
        background: rgba(214, 40, 40, 0.5);
    }

    /* --- Sidebar as drawer --- */
    .admin-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        height: 100vh;
        z-index: 1001;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        padding-top: 24px;
    }

    .admin-sidebar.open {
        transform: translateX(0);
    }

    /* --- Main content pushed down for topbar --- */
    .admin-main {
        margin-left: 0;
        max-width: 100%;
        padding: 24px 16px;
        padding-top: calc(58px + 24px);
    }

    /* --- Overlay --- */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.55);
        z-index: 1000;
    }

    .sidebar-overlay.active {
        display: block;
    }

    /* --- Stat cards: 2 columns on tablet --- */
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .data-table {
        font-size: 13px;
    }

    .data-table th,
    .data-table td {
        padding: 12px 8px;
    }

    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }

    .admin-section {
        padding: 20px 16px;
        margin-bottom: 24px;
    }
}

@media (max-width: 640px) {
    .admin-main {
        padding: calc(58px + 16px) 12px 16px;
    }

    .admin-title {
        font-size: 22px;
    }

    /* Stat cards: 2 columns on phone */
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        margin-bottom: 24px;
    }

    .stat-card {
        padding: 16px 12px;
    }

    .stat-icon {
        width: 44px;
        height: 44px;
        font-size: 22px;
        margin-bottom: 10px;
    }

    .stat-value {
        font-size: 26px;
    }

    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .action-card {
        padding: 16px 10px;
    }

    .action-icon {
        font-size: 24px;
    }

    .action-title {
        font-size: 13px;
    }

    .action-desc {
        display: none;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    /* Card-style table for mobile */
    .data-table {
        display: block;
        overflow-x: auto;
    }

    .data-table thead {
        display: none;
    }

    .data-table tbody,
    .data-table tr,
    .data-table td {
        display: block;
    }

    .data-table td::before {
        content: attr(data-label);
        font-weight: 700;
        display: block;
        margin-bottom: 4px;
        font-size: 12px;
        color: var(--color-muted);
    }

    .data-table tr {
        margin-bottom: 12px;
        border: 1px solid var(--color-light-border);
        border-radius: 8px;
        overflow: hidden;
    }

    .data-table td {
        border-bottom: none;
        padding: 10px 12px;
    }

    .admin-section {
        padding: 16px 12px;
        margin-bottom: 16px;
    }
}
