/* =============================================
   PPL MA Salafiyah Syafi'iyah - Modern & Mobile Friendly
   ============================================= */

:root {
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
    --navbar-height: 62px;
    --primary: #047857;
    --primary-dark: #064e3b;
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --info: #0284c7;
    --sidebar-bg: #022c22;
    --sidebar-hover: #064e3b;
    --sidebar-active: #059669;
    --sidebar-text: #a7f3d0;
    --sidebar-text-active: #ffffff;
    --bg-light: #f8fafc;
    --card-shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --card-shadow-hover: 0 10px 25px -5px rgba(0,0,0,.08);
    --border-radius: 12px;
    --transition: all .2s ease-in-out;
}

* { box-sizing: border-box; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-light);
    color: #1e293b;
    margin: 0;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
}

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 1050;
    transition: var(--transition);
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    gap: 12px;
    min-height: 70px;
}
.brand-logo {
    width: 42px; height: 42px;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 1.3rem;
    flex-shrink: 0;
    box-shadow: 0 4px 10px rgba(37,99,235,.3);
}
.brand-name {
    display: block;
    color: white;
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: -.5px;
}
.brand-sub {
    color: var(--sidebar-text);
    font-size: 0.68rem;
    line-height: 1.3;
    display: block;
}

.sidebar-user {
    display: flex;
    align-items: center;
    padding: 14px 18px;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    background: rgba(255,255,255,.02);
}
.user-avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: #334155;
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 1.5rem;
    overflow: hidden; flex-shrink: 0;
    border: 2px solid rgba(255,255,255,.1);
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-name { color: white; font-size: .88rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role .badge { font-size: .65rem; padding: 4px 8px; }

.sidebar-nav {
    padding: 12px;
    flex: 1;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 10px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: .875rem;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 3px;
}
.nav-item:hover {
    background: var(--sidebar-hover);
    color: white;
}
.nav-item.active {
    background: var(--primary);
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(37,99,235,.35);
}
.nav-item i { font-size: 1.15rem; flex-shrink: 0; min-width: 22px; }

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid rgba(255,255,255,.08);
}

/* ===== SIDEBAR COLLAPSED STATE (DESKTOP MINI SIDEBAR) ===== */
body.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed);
    overflow-x: hidden;
}
body.sidebar-collapsed .main-wrapper {
    margin-left: var(--sidebar-collapsed);
}
body.sidebar-collapsed .sidebar-brand {
    justify-content: center;
    padding: 16px 8px;
}
body.sidebar-collapsed .sidebar-brand .brand-text,
body.sidebar-collapsed .sidebar-user .user-info,
body.sidebar-collapsed .sidebar-nav .nav-item span,
body.sidebar-collapsed .sidebar-footer .nav-item span {
    display: none !important;
}
body.sidebar-collapsed .sidebar-user {
    justify-content: center;
    padding: 12px 8px;
}
body.sidebar-collapsed .sidebar-nav {
    padding: 12px 8px;
}
body.sidebar-collapsed .sidebar-footer {
    padding: 12px 8px;
}
body.sidebar-collapsed .nav-item {
    justify-content: center;
    padding: 12px 0;
    gap: 0;
    position: relative;
}
body.sidebar-collapsed .nav-item i {
    min-width: auto;
    font-size: 1.25rem;
    margin: 0;
}
body.sidebar-collapsed .btn-sidebar-toggle i::before {
    content: "\f479"; /* bi-layout-sidebar-inset */
}

/* ===== MAIN WRAPPER ===== */
.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

/* ===== TOP NAVBAR ===== */
.top-navbar {
    position: sticky; top: 0;
    height: var(--navbar-height);
    background: rgba(255,255,255,0.92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    z-index: 100;
}
.btn-sidebar-toggle {
    background: #f1f5f9; border: none;
    font-size: 1.25rem;
    color: #475569;
    cursor: pointer;
    width: 40px; height: 40px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
}
.btn-sidebar-toggle:hover { background: #e2e8f0; color: var(--primary); }
.navbar-title { flex: 1; }
.navbar-title h6 { color: #0f172a; font-weight: 700; margin: 0; font-size: .95rem; }

/* ===== PAGE CONTENT ===== */
.page-content {
    padding: 24px;
    flex: 1;
}

/* ===== CARDS & STATS ===== */
.card {
    border: 1px solid #e2e8f0;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    transition: var(--transition);
    background: white;
}
.card-header {
    background: white;
    border-bottom: 1px solid #e2e8f0;
    padding: 16px 20px;
    font-weight: 600;
}
.stat-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 18px;
    box-shadow: var(--card-shadow);
    display: flex;
    align-items: center;
    gap: 16px;
    border: 1px solid #e2e8f0;
    transition: var(--transition);
}
.stat-card:hover {
    box-shadow: var(--card-shadow-hover);
    transform: translateY(-2px);
}
.stat-icon {
    width: 50px; height: 50px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}
.stat-info .stat-value { font-size: 1.6rem; font-weight: 800; line-height: 1; }
.stat-info .stat-label { color: #64748b; font-size: .78rem; font-weight: 500; margin-top: 4px; }

/* ===== TABLES ===== */
.table th {
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .4px;
    border-bottom: 2px solid #e2e8f0;
    padding: 12px 14px;
}
.table td { padding: 12px 14px; vertical-align: middle; font-size: .875rem; }

/* ===== MOBILE BOTTOM BAR ===== */
.mobile-bottom-bar {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 64px;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(12px);
    border-top: 1px solid #e2e8f0;
    z-index: 1040;
    justify-content: space-around;
    align-items: center;
    padding: 0 8px;
    box-shadow: 0 -4px 15px rgba(0,0,0,.05);
}
.mobile-bottom-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #64748b;
    font-size: .7rem;
    font-weight: 600;
    gap: 3px;
    padding: 6px 10px;
    border-radius: 8px;
    transition: var(--transition);
}
.mobile-bottom-item i { font-size: 1.25rem; }
.mobile-bottom-item.active, .mobile-bottom-item:hover { color: var(--primary); }

/* ===== PUBLIC PORTAL STYLES ===== */
.public-hero {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #1e3a8a 100%);
    color: white;
    padding: 70px 20px 80px;
    position: relative;
    overflow: hidden;
}
.public-hero::before {
    content: '';
    position: absolute;
    top: -50%; right: -20%;
    width: 600px; height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(37,99,235,0.25) 0%, transparent 70%);
}
.news-card {
    border-radius: var(--border-radius);
    overflow: hidden;
    transition: var(--transition);
    border: 1px solid #e2e8f0;
    background: white;
}
.news-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-shadow-hover);
}
.news-card-img {
    height: 200px;
    object-fit: cover;
    width: 100%;
}

/* ===== RESPONSIVE BREAKPOINTS (SMARTPHONE) ===== */
@media (max-width: 768px) {
    .sidebar { left: calc(-1 * var(--sidebar-width)); }
    .sidebar.mobile-open { left: 0; box-shadow: 0 0 50px rgba(0,0,0,.5); }
    .main-wrapper { margin-left: 0 !important; margin-bottom: 64px; }
    .page-content { padding: 14px; }
    .top-navbar { padding: 0 14px; height: 56px; }
    .mobile-bottom-bar { display: flex; }
    .stat-card { padding: 14px; gap: 12px; }
    .stat-icon { width: 44px; height: 44px; font-size: 1.25rem; }
    .stat-info .stat-value { font-size: 1.35rem; }
    .btn { font-size: .82rem; padding: 7px 12px; }
    .table th, .table td { padding: 9px 10px; font-size: .8rem; }
    .modal-dialog { margin: 12px; }
}

/* Overlay for mobile drawer */
.sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(15,23,42,0.6);
    backdrop-filter: blur(4px);
    z-index: 1049;
}
.sidebar-overlay.show { display: block; }
