/* ============================================================
   Arsip Digital Madrasah - ZI WBK
   Modern Design System CSS
   ============================================================ */

:root {
    --primary: #4f46e5;
    --primary-light: #818cf8;
    --primary-dark: #3730a3;
    --secondary: #0ea5e9;
    --accent: #f59e0b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #06b6d4;

    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #1e293b;
    --bg-input: #334155;
    --bg-hover: #334155;
    --bg-body: #0f172a;

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;

    --border: #334155;
    --border-light: #475569;
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.3), 0 2px 4px -2px rgba(0,0,0,0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.4), 0 4px 6px -4px rgba(0,0,0,0.3);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --sidebar-width: 260px;
    --header-height: 64px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

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

/* ============================================================
   APP WRAPPER
   ============================================================ */
.app-wrapper { display: flex; min-height: 100vh; }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #1a1f3a 0%, #0f172a 100%);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    display: flex; flex-direction: column;
    z-index: 100;
    transition: var(--transition);
    overflow-y: auto;
}

.sidebar.collapsed { transform: translateX(-100%); }

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

.sidebar-logo {
    display: flex; align-items: center; gap: 12px;
    font-size: 1.25rem; font-weight: 700;
    background: linear-gradient(135deg, var(--primary-light), var(--secondary));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

.sidebar-logo i { font-size: 1.5rem; -webkit-text-fill-color: var(--primary-light); }

.sidebar-toggle {
    background: none; border: none; color: var(--text-secondary);
    cursor: pointer; font-size: 1.1rem; padding: 6px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.sidebar-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }

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

.user-avatar i { font-size: 2.5rem; color: var(--primary-light); }
.user-info { display: flex; flex-direction: column; }
.user-name { font-weight: 600; font-size: 0.9rem; }
.user-role {
    font-size: 0.75rem; color: var(--text-muted);
    background: var(--bg-hover); padding: 2px 8px; border-radius: 20px;
    display: inline-block; margin-top: 2px;
}

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

.sidebar-nav .nav-section {
    padding: 16px 20px 6px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted);
}

.sidebar-nav li a {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 20px;
    color: var(--text-secondary);
    font-size: 0.875rem; font-weight: 500;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.sidebar-nav li a:hover {
    background: rgba(79, 70, 229, 0.1);
    color: var(--text-primary);
    border-left-color: var(--primary-light);
}

.sidebar-nav li.active a {
    background: linear-gradient(90deg, rgba(79, 70, 229, 0.2), transparent);
    color: var(--primary-light);
    border-left-color: var(--primary-light);
    font-weight: 600;
}

.sidebar-nav li a i { width: 20px; text-align: center; font-size: 1rem; }

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

.btn-logout {
    width: 100%; display: flex; align-items: center; gap: 10px;
    padding: 10px 16px; border: none; border-radius: var(--radius-sm);
    background: rgba(239, 68, 68, 0.1);
    color: #f87171; cursor: pointer;
    font-size: 0.875rem; font-weight: 500;
    transition: var(--transition);
}
.btn-logout:hover { background: rgba(239, 68, 68, 0.2); }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main-content {
    flex: 1; margin-left: var(--sidebar-width);
    transition: var(--transition);
    min-height: 100vh;
}
.main-content.expanded { margin-left: 0; }

.top-header {
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 16px;
    padding: 0 24px;
    position: sticky; top: 0; z-index: 50;
    backdrop-filter: blur(12px);
}

.mobile-toggle { display: none; background: none; border: none; color: var(--text-secondary); font-size: 1.2rem; cursor: pointer; }

.header-search { flex: 1; max-width: 400px; position: relative; }
.header-search i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.header-search input {
    width: 100%; padding: 10px 16px 10px 42px;
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: 30px; color: var(--text-primary);
    font-size: 0.875rem; transition: var(--transition);
}
.header-search input:focus { outline: none; border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(79,70,229,0.2); }
.header-search input::placeholder { color: var(--text-muted); }

.header-actions { display: flex; align-items: center; gap: 16px; margin-left: auto; }
.header-date { color: var(--text-secondary); font-size: 0.85rem; display: flex; align-items: center; gap: 6px; }

.content-wrapper { padding: 24px; }

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 24px; flex-wrap: wrap; gap: 12px;
}
.page-title { font-size: 1.5rem; font-weight: 700; }
.page-subtitle { color: var(--text-secondary); font-size: 0.9rem; margin-top: 4px; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--transition);
}
.card:hover { border-color: var(--border-light); box-shadow: var(--shadow); }
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.card-header h3 { font-size: 1rem; font-weight: 600; }
.card-body { padding: 20px; }
.card-footer { padding: 12px 20px; border-top: 1px solid var(--border); }

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

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex; align-items: center; gap: 16px;
    transition: var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.stat-icon {
    width: 52px; height: 52px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
}
.stat-icon.purple { background: rgba(79,70,229,0.15); color: var(--primary-light); }
.stat-icon.blue { background: rgba(14,165,233,0.15); color: var(--secondary); }
.stat-icon.green { background: rgba(16,185,129,0.15); color: var(--success); }
.stat-icon.orange { background: rgba(245,158,11,0.15); color: var(--accent); }

.stat-info h4 { font-size: 0.8rem; color: var(--text-secondary); font-weight: 500; }
.stat-number { font-size: 1.75rem; font-weight: 800; line-height: 1.2; }

/* ============================================================
   GRID LAYOUTS
   ============================================================ */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }

/* ============================================================
   AREA CARDS (ZI WBK)
   ============================================================ */
.area-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.area-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--primary-light); }
.area-card::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
}
.area-card-icon { font-size: 2rem; margin-bottom: 12px; color: var(--primary-light); }
.area-card h3 { font-size: 1rem; font-weight: 600; margin-bottom: 6px; }
.area-card p { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 16px; line-height: 1.5; }

/* Progress Bar */
.progress-bar {
    width: 100%; height: 8px;
    background: var(--bg-input);
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 6px;
}
.progress-fill {
    height: 100%;
    border-radius: 20px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transition: width 0.8s ease;
}
.progress-text { font-size: 0.75rem; color: var(--text-muted); text-align: right; }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrapper { overflow-x: auto; }

table {
    width: 100%; border-collapse: collapse;
    font-size: 0.875rem;
}
table th {
    padding: 12px 16px; text-align: left;
    background: var(--bg-input);
    color: var(--text-secondary);
    font-weight: 600; font-size: 0.75rem;
    text-transform: uppercase; letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
}
table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
table tr:hover td { background: rgba(79,70,229,0.05); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 20px;
    border: none; border-radius: var(--radius-sm);
    font-size: 0.875rem; font-weight: 600;
    cursor: pointer; transition: var(--transition);
    text-decoration: none;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: white; }
.btn-primary:hover { background: linear-gradient(135deg, var(--primary-light), var(--primary)); color: white; }
.btn-secondary { background: var(--bg-input); color: var(--text-primary); border: 1px solid var(--border); }
.btn-success { background: linear-gradient(135deg, var(--success), #059669); color: white; }
.btn-danger { background: linear-gradient(135deg, var(--danger), #dc2626); color: white; }
.btn-warning { background: linear-gradient(135deg, var(--warning), #d97706); color: white; }
.btn-info { background: linear-gradient(135deg, var(--info), #0891b2); color: white; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text-primary); }
.btn-outline:hover { border-color: var(--primary-light); color: var(--primary-light); }

.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 20px; }
.form-label {
    display: block; margin-bottom: 6px;
    font-size: 0.85rem; font-weight: 600;
    color: var(--text-secondary);
}
.form-control {
    width: 100%; padding: 10px 14px;
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary); font-size: 0.9rem;
    transition: var(--transition);
    font-family: inherit;
}
.form-control:focus {
    outline: none; border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.15);
}
.form-control::placeholder { color: var(--text-muted); }

select.form-control { appearance: none; cursor: pointer; }
textarea.form-control { min-height: 100px; resize: vertical; }

.form-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.form-inline { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    display: inline-flex; align-items: center; padding: 4px 10px;
    border-radius: 20px; font-size: 0.7rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.5px;
}
.badge-primary { background: rgba(79,70,229,0.15); color: var(--primary-light); }
.badge-success { background: rgba(16,185,129,0.15); color: var(--success); }
.badge-warning { background: rgba(245,158,11,0.15); color: var(--accent); }
.badge-danger { background: rgba(239,68,68,0.15); color: var(--danger); }
.badge-info { background: rgba(6,182,212,0.15); color: var(--info); }
.badge-secondary { background: var(--bg-input); color: var(--text-secondary); }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    display: flex; align-items: center; gap: 10px;
    font-size: 0.875rem;
    animation: slideDown 0.3s ease;
    transition: opacity 0.5s ease;
    position: relative;
}
.alert-success { background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.3); color: var(--success); }
.alert-danger { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); color: var(--danger); }
.alert-warning { background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.3); color: var(--warning); }
.alert-info { background: rgba(6,182,212,0.1); border: 1px solid rgba(6,182,212,0.3); color: var(--info); }
.alert-close {
    position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
    background: none; border: none; color: inherit; cursor: pointer; opacity: 0.6;
}
.alert-close:hover { opacity: 1; }

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
    display: flex; gap: 4px; justify-content: center;
    margin-top: 20px; flex-wrap: wrap;
}
.pagination a, .pagination span {
    padding: 8px 14px; border-radius: var(--radius-sm);
    font-size: 0.8rem; font-weight: 500;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    transition: var(--transition);
}
.pagination a:hover { background: var(--bg-hover); color: var(--text-primary); }
.pagination .active span {
    background: var(--primary); border-color: var(--primary);
    color: white;
}

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

.login-card {
    width: 100%; max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-lg);
    animation: fadeIn 0.5s ease;
}

.login-header { text-align: center; margin-bottom: 32px; }
.login-header i { font-size: 3rem; color: var(--primary-light); margin-bottom: 16px; display: block; }
.login-header h1 { font-size: 1.5rem; font-weight: 700; margin-bottom: 4px; }
.login-header p { color: var(--text-secondary); font-size: 0.85rem; }

.login-form .form-group { margin-bottom: 20px; }
.login-form .form-control { padding: 12px 16px; }

.login-btn {
    width: 100%; padding: 14px; border: none; border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white; font-size: 1rem; font-weight: 700;
    cursor: pointer; transition: var(--transition);
}
.login-btn:hover { background: linear-gradient(135deg, var(--primary-light), var(--primary)); transform: translateY(-1px); box-shadow: var(--shadow-lg); }

.remember-me { display: flex; align-items: center; gap: 8px; margin-bottom: 20px; }
.remember-me input { accent-color: var(--primary); }
.remember-me label { font-size: 0.85rem; color: var(--text-secondary); cursor: pointer; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
    text-align: center; padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state i { font-size: 4rem; margin-bottom: 16px; opacity: 0.3; }
.empty-state h3 { font-size: 1.1rem; margin-bottom: 8px; color: var(--text-secondary); }
.empty-state p { font-size: 0.85rem; }

/* ============================================================
   FILE ICON
   ============================================================ */
.file-icon { font-size: 1.2rem; }
.file-icon.pdf { color: #ef4444; }
.file-icon.doc { color: #3b82f6; }
.file-icon.xls { color: #10b981; }
.file-icon.img { color: #f59e0b; }

/* ============================================================
   FILTER BAR
   ============================================================ */
.filter-bar {
    display: flex; gap: 12px; margin-bottom: 20px;
    flex-wrap: wrap; align-items: center;
}
.filter-bar .form-control { width: auto; min-width: 160px; padding: 8px 12px; font-size: 0.8rem; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.collapsed { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .mobile-toggle { display: block; }
    .header-date { display: none; }
    .content-wrapper { padding: 16px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .form-row { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .login-card { padding: 24px; }
}
