/* Modern Custom Theme for Admin Dashboard */

:root {
    --bg-app: #f8fafc;
    --bg-card: #ffffff;
    --bg-sidebar: #0f172a;
    --text-main: #334155;
    --text-muted: #64748b;
    --text-light: #ffffff;
    --border-color: #e2e8f0;
    --primary: #0ea5e9;
    --primary-hover: #0284c7;
    --primary-light: rgba(14, 165, 233, 0.1);
    --accent: #6366f1;
    --success-bg: #ecfdf5;
    --success-text: #047857;
    --error-bg: #fff1f2;
    --error-text: #be123c;
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
}

html.dark {
    --bg-app: #09090b;
    --bg-card: #18181b;
    --bg-sidebar: #09090b;
    --text-main: #e4e4e7;
    --text-muted: #a1a1aa;
    --border-color: #27272a;
    --primary-light: rgba(14, 165, 233, 0.15);
    --success-bg: #064e3b;
    --success-text: #a7f3d0;
    --error-bg: #4c0519;
    --error-text: #fecdd3;
    --shadow-sm: 0 0 0 1px rgba(255, 255, 255, 0.03);
    --shadow-md: 0 4px 10px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.4);
}

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

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg-app);
    color: var(--text-main);
    min-height: 100vh;
    transition: background 0.3s ease, color 0.3s ease;
    line-height: 1.5;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ---- Login Screen ---- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: radial-gradient(circle at 10% 20%, rgba(14, 165, 233, 0.05) 0%, rgba(99, 102, 241, 0.05) 90.1%);
}

.login-box {
    max-width: 400px;
    width: 100%;
    padding: 40px 32px;
    border-radius: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    transition: transform 0.2s ease;
}

.login-box h1 {
    font-size: 1.6rem;
    font-weight: 800;
    margin: 12px 0 6px;
    letter-spacing: -0.02em;
}

.login-box .sub {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 28px;
}

.login-box label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.login-box input {
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    font-size: 0.95rem;
    margin-bottom: 20px;
    background: var(--bg-app);
    color: var(--text-main);
    transition: all 0.2s ease;
}

.login-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.login-box button {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(14, 165, 233, 0.3);
    transition: all 0.2s ease;
}

.login-box button:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(14, 165, 233, 0.4);
}

.login-error {
    background: var(--error-bg);
    color: var(--error-text);
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 0.85rem;
    margin-bottom: 20px;
    border-left: 3px solid #f43f5e;
}

/* ---- Shell Layout ---- */
.admin-shell {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    color: #94a3b8;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 40;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.brand-badge {
    font-size: 1.4rem;
}

.brand-info {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-weight: 800;
    font-size: 1rem;
    color: var(--text-main);
    letter-spacing: -0.01em;
}

.brand-subtitle {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
}

.sidebar nav {
    padding: 20px 16px;
    flex: 1;
    overflow-y: auto;
}

.sidebar nav a {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    font-size: 0.92rem;
    font-weight: 500;
    border-radius: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
    transition: all 0.25s ease;
}

.sidebar nav a:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.sidebar nav a.active {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #ffffff;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.25);
}

.logout-link {
    color: #ef4444 !important;
    margin-top: 24px;
}

.logout-link:hover {
    background: rgba(239, 68, 68, 0.1) !important;
}

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

.sidebar .theme-toggle-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.sidebar .view-site {
    display: block;
    padding: 12px;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 700;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 12px;
    margin-top: 12px;
    transition: all 0.2s ease;
}

.sidebar .view-site:hover {
    opacity: 0.85;
    transform: translateY(-1px);
}

/* Main Area */
.main-area {
    margin-left: 260px;
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 30;
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow-sm);
}

.topbar .menu-btn {
    color: var(--text-main);
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.content {
    padding: 40px 40px 80px;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

.page-title {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 30px;
    letter-spacing: -0.02em;
    color: var(--text-main);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 35;
    backdrop-filter: blur(4px);
}

@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-area {
        margin-left: 0;
    }
    .topbar {
        display: flex;
    }
    .sidebar-overlay.show {
        display: block;
    }
    .content {
        padding: 24px 16px 60px;
    }
    .page-title {
        display: none;
    }
}

/* ---- Cards & Sections ---- */
.card {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px 28px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
}

.card h2 {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 20px;
    letter-spacing: -0.01em;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
}

.form-row {
    margin-bottom: 20px;
}

.form-row label {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-main);
}

.form-row .hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 6px;
}

.form-row input, .form-row textarea, .form-row select,
.list-row input, .list-row select {
    width: 100%;
    padding: 11px 14px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    font-size: 0.92rem;
    font-family: inherit;
    background: var(--bg-app);
    color: var(--text-main);
    transition: all 0.2s ease;
}

.form-row input:focus, .form-row textarea:focus, .form-row select:focus,
.list-row input:focus, .list-row select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.faq-row-top input {
    width: 100%;
    padding: 11px 14px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    font-size: 0.92rem;
    font-family: inherit;
    background: var(--bg-card);
    color: var(--text-main);
    transition: all 0.2s ease;
}

.faq-row-top input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-row textarea {
    resize: vertical;
    min-height: 100px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 22px;
    border-radius: 10px;
    border: none;
    background: var(--primary);
    color: #ffffff;
    font-weight: 700;
    font-size: 0.92rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.2);
    transition: all 0.2s ease;
}

.btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn.secondary {
    background: #64748b;
    box-shadow: 0 4px 12px rgba(100, 116, 139, 0.2);
}

.btn.secondary:hover {
    background: #475569;
}

.btn.danger {
    background: #ef4444;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.btn.danger:hover {
    background: #dc2626;
}

.alert-success {
    background: var(--success-bg);
    color: var(--success-text);
    padding: 12px 18px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 24px;
    border-left: 4px solid #10b981;
}

.alert-error {
    background: var(--error-bg);
    color: var(--error-text);
    padding: 12px 18px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 24px;
    border-left: 4px solid #f43f5e;
}

/* ---- Dashboard Analytics Tiles ---- */
.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 16px;
    margin-bottom: 30px;
}

.tile {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 20px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease;
}

.tile:hover {
    transform: translateY(-2px);
}

.tile .num {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--primary);
}

.tile .label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 4px;
}

/* ---- Data Tables ---- */
.table-scroll {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

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

th, td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

th {
    background: var(--bg-app);
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: var(--primary-light);
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge.ok {
    background: var(--success-bg);
    color: var(--success-text);
}

.badge.error {
    background: var(--error-bg);
    color: var(--error-text);
}

.empty-note {
    color: var(--text-muted);
    padding: 30px 0;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 500;
}

.list-row {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.grow {
    flex: 1;
    min-width: 160px;
}

.switch-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 8px;
    cursor: pointer;
}

.switch-row input[type="checkbox"] {
    width: 1.15rem;
    height: 1.15rem;
    accent-color: var(--primary);
    cursor: pointer;
}

.faq-row {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 14px;
    background: var(--bg-app);
}

.faq-row-top {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 10px;
}

.faq-row textarea {
    width: 100%;
    padding: 11px 14px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    font-size: 0.9rem;
    font-family: inherit;
    background: var(--bg-card);
    color: var(--text-main);
    resize: vertical;
    min-height: 60px;
    transition: all 0.2s ease;
}

.faq-row textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.icon-btn {
    background: var(--error-bg);
    color: var(--error-text);
    border: none;
    border-radius: 8px;
    padding: 11px 14px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.icon-btn:hover {
    opacity: 0.85;
}

/* ---- Theme Toggle Button ---- */
button.theme-toggle-btn {
    width: 2.3rem;
    height: 2.3rem;
    border-radius: 9999px;
    background: var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    transition: transform 0.2s ease;
}

button.theme-toggle-btn:hover {
    transform: scale(1.05);
}
