/* ===== RESET & BASE ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --primary: #143c5a;
    --primary-dark: #0f2d44;
    --primary-light: #2c5a7d;
    --bg-app: #F3F3F3;
    --bg-surface: #FFFFFF;
    --bg-sidebar: #F0F3F9;
    --text-primary: #143c5a;
    --text-secondary: #476685;
    --text-disabled: #6a89a5;
    --success: #107C10;
    --warning: #f97316;
    --secondary: #fb923c;
    --accent: #1e4b6e;
    --danger: #ef4444;
    --info: #143c5a;
    --orange-primary: #f97316;
    --orange-light: #fff7ed;
    --orange-dark: #ea580c;
    --orange-accent: #ffedd5;
    --emerald-primary: #10b981;
    --emerald-light: #ecfdf5;
    --emerald-dark: #059669;
    --emerald-accent: #d1fae5;
    --white: #FFFFFF;
    --gray-50: #F9F9F9;
    --gray-100: #F3F3F3;
    --gray-200: #E5E5E5;
    --gray-300: #D1D1D1;
    --gray-400: #8da9c4;
    --gray-500: #6a89a5;
    --gray-600: #476685;
    --gray-700: #285a82;
    --gray-800: #1e4b6e;
    --gray-900: #143c5a;
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.04);
    --shadow: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-md: 0 8px 16px rgba(0,0,0,0.1);
    --shadow-lg: 0 16px 32px rgba(0,0,0,0.12);
    --shadow-xl: 0 24px 48px rgba(0,0,0,0.14);
    --radius-sm: 4px;
    --radius: 8px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --transition: all 0.2s cubic-bezier(0.33, 0, 0.67, 1);
}

body {
    font-family: 'Segoe UI Variable', 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-app);
    -webkit-font-smoothing: antialiased;
}

/* ===== LAYOUT ===== */
.dashboard-wrapper { display: flex; min-height: 100vh; }

/* ===== SIDEBAR ===== */
.sidebar {
    width: 240px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: var(--transition);
}

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

.sidebar-menu { padding: 12px 0; flex: 1; overflow-y: auto; }

.menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: var(--transition);
}
.menu-item:hover { background: var(--gray-200); color: var(--primary); }
.menu-item.active {
    background: rgba(20,60,90,0.08);
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 600;
}
.menu-icon { font-size: 18px; width: 22px; text-align: center; }

.sidebar-menu .menu-group-title {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gray-400);
    padding: 16px 20px 4px;
    font-weight: 600;
}

.user-profile {
    padding: 16px 20px;
    border-top: 1px solid var(--gray-200);
}
.user-info { display: flex; align-items: center; gap: 10px; }
.user-details h4 { font-size: 13px; font-weight: 600; color: var(--text-primary); margin: 0; }
.user-details p { font-size: 11px; color: var(--text-secondary); margin: 0; }

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-left: 240px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    padding: 16px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: var(--shadow-sm);
}
.topbar-left h2 { font-size: 18px; font-weight: 700; color: var(--gray-900); margin: 0; }
.topbar-left p { font-size: 13px; color: var(--text-secondary); margin: 2px 0 0; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.content-area { padding: 24px 28px; flex: 1; }

/* ===== STATS GRID ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--white);
    padding: 20px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.stat-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.stat-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--gray-500); font-weight: 600; }
.stat-icon { width: 36px; height: 36px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--gray-900); margin: 0 0 4px; }
.stat-label { font-size: 12px; color: var(--gray-500); margin: 0; }
.stat-card.info .stat-icon { background: #EFF6FF; color: #2563EB; }
.stat-card.success .stat-icon { background: var(--emerald-light); color: var(--emerald-primary); }
.stat-card.warning .stat-icon { background: var(--orange-light); color: var(--orange-primary); }
.stat-card.danger .stat-icon { background: #FFF1F2; color: var(--danger); }

/* ===== CARDS ===== */
.card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-title { font-size: 15px; font-weight: 600; color: var(--gray-900); margin: 0; display: flex; align-items: center; gap: 8px; }
.card-body { padding: 20px; }

/* ===== TABLES ===== */
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
    background: var(--gray-50);
    color: var(--gray-600);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 700;
    padding: 10px 14px;
    text-align: left;
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
}
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--gray-100); color: var(--gray-800); vertical-align: middle; }
tbody tr:hover { background: var(--gray-50); }
tbody tr:last-child td { border-bottom: none; }

/* ===== BADGES ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}
.badge-success { background: var(--emerald-light); color: var(--emerald-dark); }
.badge-danger { background: #FFF1F2; color: #BE123C; }
.badge-warning { background: var(--orange-light); color: var(--orange-dark); }
.badge-info { background: #EFF6FF; color: #1D4ED8; }
.badge-gray { background: var(--gray-100); color: var(--gray-600); }

/* ===== FORMS ===== */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; color: var(--gray-700); font-size: 13px; }
.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gray-300);
    border-bottom-width: 2px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    background: var(--white);
    color: var(--text-primary);
    transition: var(--transition);
    outline: none;
}
.form-control:hover { border-color: var(--gray-500); }
.form-control:focus { border-color: var(--primary); border-bottom-color: var(--primary); }
.form-control-sm { padding: 7px 10px; font-size: 13px; }
textarea.form-control { resize: vertical; min-height: 90px; }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 9px 18px; border: 1px solid transparent; border-radius: var(--radius-sm);
    font-size: 13.5px; font-weight: 600; font-family: inherit; cursor: pointer;
    transition: var(--transition); text-decoration: none; line-height: 1.4;
}
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-secondary { background: var(--white); color: var(--text-primary); border-color: var(--gray-300); }
.btn-secondary:hover { background: var(--gray-50); border-color: var(--gray-400); }
.btn-success { background: var(--emerald-primary); color: #fff; }
.btn-success:hover { background: var(--emerald-dark); transform: translateY(-1px); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #DC2626; transform: translateY(-1px); }
.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: var(--orange-dark); transform: translateY(-1px); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===== ALERTS ===== */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 18px; font-size: 13.5px; }
.alert-success { background: var(--emerald-light); color: var(--emerald-dark); border-left: 4px solid var(--emerald-primary); }
.alert-error, .alert-danger { background: #FFF1F2; color: #9F1239; border-left: 4px solid var(--danger); }
.alert-warning { background: var(--orange-light); color: var(--orange-dark); border-left: 4px solid var(--warning); }
.alert-info { background: #EFF6FF; color: #1D4ED8; border-left: 4px solid #3B82F6; }

/* ===== MODALS ===== */
.modal {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5); z-index: 1000;
    align-items: center; justify-content: center;
    animation: fadeIn 0.2s ease;
}
.modal.active { display: flex; }
.modal-content {
    background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow-xl);
    width: 90%; max-width: 560px; max-height: 90vh; overflow-y: auto;
    animation: slideUp 0.25s ease;
}
.modal-lg .modal-content { max-width: 800px; }
.modal-header {
    padding: 18px 22px; border-bottom: 1px solid var(--gray-200);
    display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 15px; font-weight: 700; color: var(--gray-900); margin: 0; display: flex; align-items: center; gap: 8px; }
.modal-body { padding: 22px; }
.modal-footer { padding: 16px 22px; border-top: 1px solid var(--gray-100); display: flex; gap: 10px; justify-content: flex-end; }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--gray-500); line-height: 1; padding: 2px; }
.modal-close:hover { color: var(--danger); }

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

/* ===== TABS ===== */
.tabs-header { display: flex; border-bottom: 2px solid var(--gray-200); margin-bottom: 20px; }
.tab-btn { padding: 10px 20px; background: none; border: none; border-bottom: 2px solid transparent; font-size: 13.5px; font-weight: 600; color: var(--gray-500); cursor: pointer; margin-bottom: -2px; transition: all 0.2s; }
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ===== LOGIN PAGE ===== */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--gray-50); padding: 20px; }
.login-container { display: grid; grid-template-columns: 1fr 1fr; max-width: 1000px; width: 100%; background: var(--white); border-radius: var(--radius-xl); overflow: hidden; box-shadow: var(--shadow-xl); animation: slideUp 0.4s ease; }
.login-left { background: var(--primary); color: #fff; padding: 60px 40px; display: flex; align-items: center; justify-content: center; }
.login-illustration { text-align: center; }
.login-illustration h1 { font-size: 28px; font-weight: 700; margin-bottom: 12px; line-height: 1.3; }
.login-illustration p { font-size: 15px; opacity: 0.85; line-height: 1.6; }
.mosque-icon { font-size: 80px; margin-bottom: 22px; animation: float 3s ease-in-out infinite; }
.login-right { padding: 60px 40px; display: flex; align-items: center; justify-content: center; }
.login-box { width: 100%; max-width: 380px; }
.login-header { margin-bottom: 28px; }
.login-header h2 { font-size: 26px; font-weight: 700; color: var(--gray-900); }
.login-header p { color: var(--gray-500); font-size: 14px; margin-top: 4px; }
.login-footer { margin-top: 24px; text-align: center; }

/* ===== UTILITIES ===== */
.text-muted { color: var(--gray-500); font-size: 12.5px; }
.text-success { color: var(--emerald-primary) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 20px; } .mt-4 { margin-top: 28px; }
.mb-1 { margin-bottom: 6px; } .mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 20px; } .mb-4 { margin-bottom: 28px; }
.p-0 { padding: 0; }
.fw-bold { font-weight: 700; }
.fw-600 { font-weight: 600; }

/* ===== SECTION DIVIDER ===== */
.section-divider { height: 1px; background: var(--gray-200); margin: 18px 0; position: relative; }
.section-divider span { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: var(--white); padding: 0 10px; color: var(--gray-500); font-size: 11px; font-weight: 600; }

/* ===== QUICK ACTION BUTTONS ===== */
.quick-action-group { background: var(--white); padding: 20px; border-radius: var(--radius-lg); border: 1px solid var(--gray-200); box-shadow: var(--shadow-sm); transition: all 0.3s ease; }
.quick-action-group:hover { box-shadow: var(--shadow); }
.quick-action-group h4 { border-bottom: 2px solid var(--gray-100); padding-bottom: 12px; margin-bottom: 16px !important; font-size: 14px; display: flex; align-items: center; gap: 7px; }
.btn-quick-action { flex: 1; min-width: 130px; background: var(--white); border: 1px solid var(--gray-200); padding: 11px 14px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.2s; gap: 8px; }
.btn-quick-action:hover { transform: translateY(-2px); background: var(--gray-50); border-color: var(--gray-400); }
.btn-quick-action i { font-size: 20px; }
.btn-quick-action span { font-size: 13px; font-weight: 600; color: var(--gray-800); }

/* ===== SEARCH DROPDOWN ===== */
.search-container { position: relative; }
.search-results { position: absolute; top: 100%; left: 0; right: 0; background: white; border: 1px solid #ddd; border-radius: 8px; max-height: 200px; overflow-y: auto; z-index: 1000; box-shadow: var(--shadow-md); display: none; }
.search-item { padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--gray-100); transition: background 0.2s; }
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: var(--gray-50); }
.search-item strong { color: var(--primary); }

/* ===== PAGINATION ===== */
.pagination { display: flex; gap: 4px; align-items: center; margin-top: 16px; }
.page-btn { padding: 6px 12px; border: 1px solid var(--gray-200); background: var(--white); border-radius: var(--radius-sm); font-size: 13px; cursor: pointer; color: var(--gray-700); transition: var(--transition); }
.page-btn:hover, .page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Progress bar */
.progress-bar { background: var(--gray-200); border-radius: 99px; height: 6px; overflow: hidden; }
.progress-bar-fill { background: var(--primary); height: 100%; border-radius: 99px; transition: width 0.5s ease; }

/* ===== ANIMATIONS ===== */
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) { .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .main-content { margin-left: 0; }
    .login-container { grid-template-columns: 1fr; }
    .login-left { display: none; }
    .grid-2 { grid-template-columns: 1fr; }
    .grid-3 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}
