/* ============================================
   WA Rotator Pro - Admin Dashboard Styles
   ============================================ */

:root {
    /* Color Palette - Emerald + Slate (warna Dauroh-friendly: hijau Islam + netral) */
    --primary: #059669;
    --primary-dark: #047857;
    --primary-light: #d1fae5;
    --accent: #f59e0b;
    --danger: #dc2626;
    --danger-light: #fee2e2;
    --warning: #f59e0b;
    --info: #3b82f6;
    --success: #10b981;
    
    /* Neutrals */
    --bg: #f8fafc;
    --bg-card: #ffffff;
    --border: #e2e8f0;
    --text: #0f172a;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    
    /* Spacing */
    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 16px;
    --shadow: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.03);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
}

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

body {
    font-family: 'Plus Jakarta Sans', -apple-system, system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary);
    text-decoration: none;
}

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

.sidebar {
    width: 240px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    padding: 24px 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar-brand {
    padding: 0 24px 24px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}

.sidebar-brand h1 {
    font-size: 18px;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.02em;
}

.sidebar-brand small {
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sidebar-nav {
    list-style: none;
    padding: 0 12px;
}

.sidebar-nav li {
    margin-bottom: 2px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-weight: 500;
    transition: all 0.15s;
}

.sidebar-nav a:hover {
    background: var(--bg);
    color: var(--text);
}

.sidebar-nav a.active {
    background: var(--primary-light);
    color: var(--primary-dark);
    font-weight: 600;
}

.sidebar-nav .icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.main {
    flex: 1;
    margin-left: 240px;
    padding: 32px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-title {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.page-subtitle {
    color: var(--text-muted);
    margin-top: 4px;
    font-size: 14px;
}

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

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

.card-title {
    font-size: 15px;
    font-weight: 700;
}

/* Summary cards grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
}

.stat-card.danger::before { background: var(--danger); }
.stat-card.warning::before { background: var(--warning); }
.stat-card.info::before { background: var(--info); }

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

.stat-value {
    font-size: 32px;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1;
}

.stat-meta {
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

/* Charts grid */
.chart-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.chart-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

@media (max-width: 1024px) {
    .chart-grid, .chart-grid-3 {
        grid-template-columns: 1fr;
    }
}

.chart-container {
    position: relative;
    height: 280px;
}

.chart-container.tall {
    height: 320px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text);
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
    text-decoration: none;
}

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

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

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

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

.btn-danger:hover {
    background: #b91c1c;
    color: white;
}

.btn-sm {
    padding: 6px 10px;
    font-size: 12px;
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    background: white;
    transition: border-color 0.15s;
}

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

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Tables */
.table-wrap {
    overflow-x: auto;
}

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

.table th {
    text-align: left;
    padding: 12px;
    background: var(--bg);
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.table td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
}

.table tr:hover {
    background: var(--bg);
}

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

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-success { background: var(--primary-light); color: var(--primary-dark); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #dbeafe; color: #1e40af; }
.badge-gray { background: #f1f5f9; color: var(--text-muted); }

/* Filter bar */
.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-bar select,
.filter-bar input {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: white;
    font-size: 13px;
    font-family: inherit;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: white;
    border-radius: var(--radius);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
    box-shadow: var(--shadow-lg);
}

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

.modal-title {
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
}

.modal-footer {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* Login */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.login-card {
    background: white;
    padding: 40px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
}

.login-brand {
    text-align: center;
    margin-bottom: 32px;
}

.login-brand h1 {
    font-size: 24px;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.02em;
}

.login-brand p {
    color: var(--text-muted);
    margin-top: 4px;
    font-size: 13px;
}

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 13px;
}

.alert-error {
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid #fecaca;
}

.alert-success {
    background: var(--primary-light);
    color: var(--primary-dark);
}

/* Utilities */
.text-mono {
    font-family: 'JetBrains Mono', 'SF Mono', Monaco, monospace;
    font-size: 12px;
}

.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mt-3 { margin-top: 16px; }
.flex { display: flex; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 16px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }

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

.empty-state svg {
    margin-bottom: 16px;
    opacity: 0.5;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--text);
    color: white;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    z-index: 200;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.2s;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.success { background: var(--primary); }
.toast.error { background: var(--danger); }

/* Mobile responsiveness */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.2s;
        z-index: 50;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main {
        margin-left: 0;
        padding: 16px;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: 1px solid var(--border);
    padding: 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

@media (max-width: 768px) {
    .mobile-menu-btn { display: block; }
}
