/* ============================================
   assets/css/style.css
   Global Stylesheet - Gereja Kristus Cibinong (Modern Clean UI)
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Lora:wght@500;600;700&display=swap');

/* ---- CSS Variables (Clean & Modern Palette) ---- */
:root {
    --primary:        #C59F23; /* Sedikit dilembutkan agar elegan */
    --primary-light:  #FDF8E9;
    --primary-dark:   #A38015;
    --secondary:      #17234D; /* Navy yang lebih deep dan modern */
    --secondary-light:#F0F3F9;
    
    /* Background keabu-abuan dingin khas iOS, membuat Surface putih menonjol */
    --bg:             #F4F6F9; 
    --surface:        #FFFFFF;
    --border:         #E2E6EC; /* Border yang lebih halus, tidak kaku */
    
    --text:           #1F2937; /* Abu-abu gelap yang lebih nyaman dibaca daripada hitam pekat/navy */
    --text-muted:     #64748B;
    --text-light:     #94A3B8;
    
    --success:        #10B981; /* Warna sukses yang lebih segar */
    --success-light:  #ECFDF5;
    --warning:        #F59E0B;
    --warning-light:  #FEF3C7;
    --danger:         #EF4444; /* Merah modern */
    --danger-light:   #FEF2F2;
    --hover:          #F8FAFC;
    
    /* Rounded corners gaya iOS */
    --radius:         16px; 
    --radius-sm:      10px;
    
    /* Shadow lembut terdistribusi */
    --shadow:         0 2px 10px rgba(23, 35, 77, 0.04), 0 1px 2px rgba(23, 35, 77, 0.02);
    --shadow-md:      0 12px 24px rgba(23, 35, 77, 0.06), 0 4px 8px rgba(23, 35, 77, 0.03);
    
    --sidebar-w:      250px;
    --header-h:       68px;
    --nav-h:          65px;
    
    /* iOS fluid spring animation */
    --transition:     all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-fast:all 0.15s ease-out;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden; /* Cegah horizontal scroll tanpa merusak position:fixed */
}
a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; border-radius: var(--radius-sm); }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }

/* ============================================
   LAYOUT
   ============================================ */

.app-layout { display: flex; min-height: 100vh; width: 100%; overflow-x: hidden; }

/* ---- Sidebar ---- */
.sidebar {
    width: var(--sidebar-w);
    background: var(--secondary);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 2px 0 12px rgba(0,0,0,0.05);
}

.sidebar-brand {
    padding: 22px 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-brand .brand-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-brand .brand-cross {
    width: 32px; height: 32px;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.sidebar-brand .brand-name {
    font-size: 13px;
    font-weight: 700;
    color: #FFFFFF;
    line-height: 1.2;
    letter-spacing: 0.02em;
}

.sidebar-brand .brand-sub {
    font-size: 10.5px;
    color: rgba(255,255,255,0.5);
    margin-top: 2px;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.nav-section-label {
    font-size: 10px;
    font-weight: 700;
    color: rgba(255,255,255,0.35);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 12px 20px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    margin: 2px 10px;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.65);
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.nav-item:hover {
    background: rgba(255,255,255,0.05);
    color: #FFFFFF;
    transform: translateX(4px);
}

.nav-item.active {
    background: var(--primary);
    color: var(--secondary);
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(197, 159, 35, 0.2);
}

.nav-item.active:hover { transform: none; }

.nav-item .nav-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nav-item .nav-icon svg { width: 17px; height: 17px; }

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    background: rgba(0,0,0,0.15);
}

.sidebar-user:hover { background: rgba(255,255,255,0.08); }

.user-avatar {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: var(--surface);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.user-info .user-name {
    font-size: 13px;
    font-weight: 600;
    color: #FFFFFF;
}

.user-info .user-role {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    text-transform: capitalize;
}

/* ---- Main Content ---- */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
    overflow-x: hidden;
}

/* ---- Header (Glassmorphism) ---- */
.app-header {
    height: var(--header-h);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(226, 230, 236, 0.7);
    display: flex;
    align-items: center;
    padding: 0 28px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-title { flex: 1; }

.header-title h1 {
    font-family: 'Lora', serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--secondary);
    letter-spacing: -0.01em;
}

.header-title p {
    font-size: 12.5px;
    color: var(--text-muted);
    margin-top: 2px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ---- Page Content ---- */
.page-content {
    flex: 1;
    padding: 28px;
    width: 100%;
    min-width: 0;
    overflow-x: hidden;
}

/* ============================================
   CARDS
   ============================================ */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: var(--transition);
}

.card-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: rgba(255,255,255,0.5);
}

.card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--secondary);
    font-family: 'Lora', serif;
}

.card-body { padding: 24px; }

.card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    background: var(--hover);
}

/* ---- Stat Cards ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card:hover { 
    box-shadow: var(--shadow-md); 
    transform: translateY(-4px); 
}

.stat-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--secondary);
    line-height: 1;
    font-family: 'Lora', serif;
    letter-spacing: -0.02em;
}

.stat-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 16px;
    background: var(--secondary-light);
    color: var(--secondary);
}

.stat-icon svg { width: 22px; height: 22px; }

/* ============================================
   BUTTONS (Smooth Interaction)
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    font-weight: 600;
    font-family: 'Inter', inherit;
    cursor: pointer;
    border: none;
    transition: var(--transition-fast);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.4;
    user-select: none;
}

/* Sentuhan iOS: Mengecil sedikit saat diklik */
.btn:active { transform: scale(0.96); } 
.btn svg { width: 16px; height: 16px; }

.btn-primary { 
    background: var(--primary); 
    color: var(--surface); 
    box-shadow: 0 4px 10px rgba(197, 159, 35, 0.2);
}
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 6px 14px rgba(197, 159, 35, 0.3); }

.btn-secondary { 
    background: var(--surface); 
    color: var(--text); 
    border: 1px solid var(--border); 
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.btn-secondary:hover { background: var(--hover); border-color: #D1D5DB; }

.btn-navy { background: var(--secondary); color: #fff; }
.btn-navy:hover { background: #111A3A; box-shadow: 0 4px 12px rgba(23, 35, 77, 0.25); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #DC2626; }

.btn-outline { background: transparent; color: var(--secondary); border: 1.5px solid var(--secondary); }
.btn-outline:hover { background: var(--secondary-light); }

.btn-sm  { padding: 6px 12px; font-size: 12.5px; border-radius: 8px; }
.btn-lg  { padding: 12px 28px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; box-shadow: none; }

/* ============================================
   FORMS
   ============================================ */

.form-group { margin-bottom: 20px; }

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: 'Inter', inherit;
    color: var(--text);
    background: var(--surface);
    transition: var(--transition);
    outline: none;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02) inset;
}

.form-control:hover { border-color: #CBD5E1; }

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(197, 159, 35, 0.15);
    background: #FFFFFF;
}

.form-control::placeholder { color: var(--text-light); }

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748B' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

.form-hint  { font-size: 12.5px; color: var(--text-muted); margin-top: 6px; }
.form-error { font-size: 12.5px; color: var(--danger); margin-top: 6px; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* Input with icon */
.input-wrapper { position: relative; }
.input-wrapper .input-icon {
    position: absolute;
    left: 14px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    display: flex; align-items: center;
}
.input-wrapper .input-icon svg { width: 18px; height: 18px; }
.input-wrapper .form-control { padding-left: 42px; }

.show-pass {
    position: absolute;
    right: 14px; top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--text-light);
    background: none;
    border: none;
    padding: 4px;
    transition: var(--transition-fast);
    display: flex; align-items: center;
    border-radius: 6px;
}
.show-pass svg { width: 18px; height: 18px; }
.show-pass:hover { color: var(--text); background: var(--hover); }

/* ============================================
   TABLES
   ============================================ */

.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    background: var(--surface);
    width: 100%;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    font-size: 13.5px;
}

.table th {
    padding: 14px 18px;
    text-align: left;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--hover);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.table td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    vertical-align: middle;
}

.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: background 0.2s ease; }
.table tbody tr:hover { background: var(--hover); }

.table-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.table-empty svg { width: 48px; height: 48px; margin: 0 auto 16px; display: block; color: var(--border); }
.table-empty p { font-size: 14.5px; }

/* ============================================
   BADGES
   ============================================ */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.badge-warning { background: var(--warning-light); color: #925C05; }
.badge-success { background: var(--success-light); color: #047857; }
.badge-danger  { background: var(--danger-light); color: #B91C1C; }
.badge-navy    { background: var(--secondary-light); color: var(--secondary); }
.badge-primary { background: var(--primary-light); color: var(--primary-dark); }

/* ============================================
   ALERTS
   ============================================ */

.alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    font-size: 13.5px;
    margin-bottom: 20px;
    animation: slideDown 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid transparent;
}

.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 2px; }

.alert-success { background: var(--success-light); color: #047857; border-color: #A7F3D0; }
.alert-danger  { background: var(--danger-light); color: #B91C1C; border-color: #FECACA; }
.alert-warning { background: var(--warning-light); color: #925C05; border-color: #FDE68A; }
.alert-info    { background: var(--secondary-light); color: var(--secondary); border-color: #BFDBFE; }

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ============================================
   LOGIN PAGE
   ============================================ */

.login-page {
    min-height: 100vh;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    position: relative;
    overflow: hidden;
}

/* Soft gradient background orbs */
.login-page::before {
    content: '';
    position: absolute;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(197, 159, 35, 0.08) 0%, transparent 60%);
    top: -150px; left: -100px;
    pointer-events: none;
}

.login-page::after {
    content: '';
    position: absolute;
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(23, 35, 77, 0.06) 0%, transparent 60%);
    bottom: -100px; right: -100px;
    pointer-events: none;
}

.login-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 20px;
    box-shadow: 0 24px 48px rgba(23, 35, 77, 0.08);
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
    animation: fadeUpSpring 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeUpSpring {
    0% { opacity: 0; transform: translateY(30px) scale(0.95); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

.login-brand { text-align: center; margin-bottom: 32px; }

.login-brand .brand-cross-lg { 
    width: 52px; height: 52px; 
    margin: 0 auto 16px; 
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
}

.login-brand h1 {
    font-family: 'Lora', serif;
    font-size: 22px;
    font-weight: 700;
    color: var(--secondary);
    margin-bottom: 6px;
    letter-spacing: -0.01em;
}

.login-brand p { font-size: 14px; color: var(--text-muted); }

/* ============================================
   MODAL (iOS Style Pop-up)
   ============================================ */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.3);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
    background: var(--surface);
    border-radius: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    width: 100%;
    max-width: 540px;
    /* Flex column: header & footer fixed, body scroll */
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Desktop: muncul dari tengah dengan scale */
    max-height: 90vh;
    transform: scale(0.95) translateY(10px);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.open .modal { transform: scale(1) translateY(0); }

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0; /* Jangan menyusut */
}

.modal-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--secondary);
    font-family: 'Lora', serif;
}

.modal-close {
    width: 32px; height: 32px;
    border: none;
    background: var(--hover);
    border-radius: 50%; /* Bulat khas iOS */
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-muted);
    transition: var(--transition-fast);
    flex-shrink: 0;
}
.modal-close svg { width: 14px; height: 14px; }
.modal-close:hover { background: #E2E8F0; color: var(--text); transform: scale(1.05); }

/* Body modal yang bisa di-scroll */
.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch; /* Smooth scroll iOS */
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    background: var(--hover);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    flex-shrink: 0; /* Jangan menyusut — tetap di bawah */
    /* Pastikan footer terlihat di atas safe-area iPhone */
    padding-bottom: max(16px, calc(16px + env(safe-area-inset-bottom)));
}

/* ============================================
   BOTTOM NAVIGATION (Mobile Glassmorphism)
   ============================================ */

.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: var(--nav-h);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(226, 230, 236, 0.7);
    z-index: 100;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.03);
    padding-bottom: env(safe-area-inset-bottom); /* iOS safe area */
}

.bottom-nav-inner { display: flex; height: 100%; }

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--text-light);
    font-size: 9.5px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
    position: relative;
    padding: 0 2px;
}

.bottom-nav-item .nav-ico svg {
    width: 20px; height: 20px;
    display: block;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.bottom-nav-item.active { color: var(--primary); }
.bottom-nav-item.active .nav-ico svg { transform: scale(1.15) translateY(-2px); }
.bottom-nav-item:active .nav-ico svg { transform: scale(0.9); }

/* ============================================
   SECTION TITLES
   ============================================ */

.section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--secondary);
    margin-bottom: 16px;
    font-family: 'Lora', serif;
    letter-spacing: -0.01em;
}

.section-subtitle {
    font-size: 13.5px;
    color: var(--text-muted);
    margin-top: -12px;
    margin-bottom: 20px;
}

/* ============================================
   UTILITY (Sama dengan sebelumnya)
   ============================================ */

.text-muted    { color: var(--text-muted) !important; }
.text-small    { font-size: 12.5px; }
.text-right    { text-align: right; }
.text-center   { text-align: center; }
.text-navy     { color: var(--secondary); }
.text-gold     { color: var(--primary); }
.d-flex        { display: flex; }
.d-none        { display: none; }
.align-center  { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1        { flex: 1; }
.gap-6  { gap: 6px; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mb-4   { margin-bottom: 4px; }
.mb-8   { margin-bottom: 8px; }
.mb-12  { margin-bottom: 12px; }
.mb-16  { margin-bottom: 16px; }
.mb-24  { margin-bottom: 24px; }
.mt-8   { margin-top: 8px; }
.mt-16  { margin-top: 16px; }
.mt-24  { margin-top: 24px; }
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

.mw-640 { max-width: 640px; width: 100%; }
.mw-480 { max-width: 480px; width: 100%; }

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .sidebar        { transform: translateX(-100%); overflow: hidden; }
    .main-content   { margin-left: 0; padding-bottom: calc(var(--nav-h) + 20px); width: 100%; min-width: 0; overflow-x: hidden; }
    /* overflow-x di main-content mencegah konten apapun mendorong lebar page */
    .bottom-nav     { display: block; }
    
    .app-header     { padding: 0 16px; height: 60px; }
    .header-title h1 { font-size: 16px; }

    .page-content   { padding: 16px; width: 100%; min-width: 0; }

    .stats-grid     { grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 20px; }
    .stat-card      { padding: 16px; }
    .stat-value     { font-size: 26px; }

    .card-header    { padding: 16px; flex-wrap: wrap; gap: 10px; }
    .card-body      { padding: 16px; }
    .card-footer    { padding: 14px 16px; }

    .form-row       { grid-template-columns: 1fr; gap: 16px; }

    .table th, .table td { padding: 12px; font-size: 12.5px; }
    .table th       { font-size: 11px; }

    .btn            { font-size: 13px; padding: 8px 14px; }
    .header-actions .btn span { display: none; }

    /* ---- Modal mobile: centered, pas di layar ---- */
    .modal-overlay {
        padding: 16px;
        align-items: center;
    }
    .modal {
        max-width: 100%;
        width: 100%;
        border-radius: 14px;
        /* Viewport penuh dikurangi padding overlay (32px) */
        max-height: calc(100dvh - 32px);
    }

    .login-card     { padding: 36px 24px; border-radius: 24px; }
    .login-brand h1 { font-size: 20px; }
}

@media (max-width: 480px) {
    .stats-grid     { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat-value     { font-size: 22px; }
    .stat-icon      { width: 36px; height: 36px; margin-bottom: 12px; }

    .page-content   { padding: 12px; width: 100%; min-width: 0; }

    .table th, .table td { padding: 10px; font-size: 12px; white-space: nowrap; }

    .modal-overlay  { padding: 10px; }
    .modal          {
        border-radius: 12px;
        max-height: calc(100dvh - 20px);
    }
    .modal-body     { padding: 14px; }
    .modal-header   { padding: 16px 14px; }
    .modal-footer   { padding: 12px 14px; }

    .login-page     { padding: 16px; }
    .login-card     { padding: 32px 20px; }
}

/* ============================================
   PAGE TRANSITION ANIMATION (iOS Style)
   ============================================ */
@keyframes pageSlideIn {
    0% { 
        opacity: 0; 
        transform: translateY(12px) scale(0.99); 
    }
    100% { 
        opacity: 1; 
        transform: translateY(0) scale(1); 
    }
}

.page-animate {
    animation: pageSlideIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}