/* ============================================
   SIRAT - Sistem Informasi RT Custom CSS
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

/* ─── Root Variables ──────────────────────── */
:root {
    --sidebar-width: 260px;
    --topbar-height: 70px;
    --primary:      #0f766e;
    --primary-light: #14b8a6;
    --primary-dark: #115e59;
    --secondary:    #1e293b;
    --sidebar-bg:   #0f766e; /* Updated to Teal */
    --sidebar-text: rgba(255, 255, 255, 0.7);
    --sidebar-active: #fff;
    --body-bg:      #f1f5f9;
    --card-radius:  16px;
    --shadow-card:  0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --transition:   all .3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Base ────────────────────────────────── */
* { box-sizing: border-box; }

body {
    font-family: 'Poppins', sans-serif;
    background: var(--body-bg);
    color: #2d3748;
    font-size: 14px;
}

/* ─── Auth Layout ─────────────────────────── */
.auth-body {
    background: linear-gradient(135deg, #0f9b58 0%, #1a2744 60%, #0f2460 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-wrapper { width: 100%; max-width: 900px; }

.auth-card {
    background: #fff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0,0,0,.3);
    display: flex;
    min-height: 520px;
}

.auth-left {
    background: linear-gradient(160deg, #0f9b58 0%, #0b7a45 40%, #1a2744 100%);
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 32px;
    color: #fff;
}

.auth-illustration { text-align: center; }

.auth-logo-big {
    width: 90px; height: 90px;
    background: rgba(255,255,255,.15);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 20px;
    font-size: 2.5rem;
    backdrop-filter: blur(5px);
}

.auth-illustration h2 { font-size: 2rem; font-weight: 700; margin-bottom: 4px; }
.auth-illustration p  { opacity: .8; margin-bottom: 24px; font-size: 1rem; }

.auth-features { text-align: left; }
.feature-item {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 0; font-size: .9rem; opacity: .9;
}
.feature-item i { color: #a8f0c8; font-size: 1rem; }

.auth-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 40px;
}

.auth-form-container { width: 100%; max-width: 360px; }
.auth-header { margin-bottom: 28px; }
.auth-header h3 { font-size: 1.5rem; font-weight: 700; color: #1a2744; margin-bottom: 4px; }

.btn-login {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border: none;
    padding: 12px;
    font-weight: 600;
    letter-spacing: .5px;
    border-radius: 10px;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(15,155,88,.4);
}
.btn-login:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(15,155,88,.5); }

/* ─── Sidebar ─────────────────────────────── */
.sirat-sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    position: fixed;
    top: 0; left: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    transition: var(--transition);
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.1) transparent;
}

.sirat-sidebar::-webkit-scrollbar { width: 4px; }
.sirat-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 4px; }

/* Brand */
.sidebar-brand {
    display: flex; align-items: center; gap: 12px;
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    min-height: var(--topbar-height);
}

.brand-logo {
    width: 42px; height: 42px;
    background: linear-gradient(135deg, var(--primary), #0b7a45);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; color: #fff;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(15,155,88,.4);
}

.brand-name { display: block; color: #fff; font-weight: 700; font-size: 1.1rem; line-height: 1.2; }
.brand-sub  { display: block; color: rgba(255,255,255,.7); font-size: .75rem; }

/* User Avatar Circle */
.user-avatar-circle {
    width: 42px; height: 42px;
    background: var(--primary);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 1.2rem;
    overflow: hidden;
}
.user-avatar-circle img { width: 100%; height: 100%; object-fit: cover; }

/* Main Heading Card */
.main-heading-card {
    background: var(--primary);
    color: #fff;
    padding: 16px 24px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}
.main-heading-card i { font-size: 1.5rem; }
.main-heading-card h5 { margin: 0; font-weight: 700; }
.main-heading-card .breadcrumb { margin: 0; background: none; padding: 0; font-size: .75rem; }
.main-heading-card .breadcrumb-item { color: rgba(255,255,255,.8); }
.main-heading-card .breadcrumb-item.active { color: #fff; }

/* Menu */
.sidebar-menu { padding: 12px 0 24px; flex: 1; }

.nav-section {
    color: rgba(255, 255, 255, 0.4);
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: 1.8px;
    text-transform: uppercase;
    padding: 24px 24px 8px;
}

.sidebar-menu .nav-link {
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--sidebar-text);
    padding: 12px 24px;
    border-radius: 0;
    font-size: .88rem;
    font-weight: 500;
    transition: var(--transition);
    position: relative;
    border-left: 4px solid transparent;
    margin: 1px 0;
}

.sidebar-menu .nav-link i { font-size: 1.1rem; flex-shrink: 0; opacity: 0.7; width: 20px; text-align: center; }

.sidebar-menu .nav-link:hover {
    color: #fff;
    background: rgba(255,255,255,.1);
}

.sidebar-menu .nav-link.active {
    color: #fff;
    background: rgba(0,0,0,.1);
    border-left-color: #fff;
    font-weight: 700;
}

.sidebar-menu .nav-link.active i { opacity: 1; }

.sidebar-menu .nav-link.nav-toggle { cursor: pointer; }
.toggle-icon { font-size: .75rem !important; transition: transform .3s; }
.nav-link[aria-expanded="true"] .toggle-icon { transform: rotate(180deg); }

/* Submenu */
.submenu { padding: 4px 0; background: rgba(0,0,0,0.05); }
.submenu .nav-link { padding: 10px 16px 10px 58px; font-size: .84rem; border-left: none; }
.submenu .nav-link:hover { background: rgba(255,255,255,.05); }
.submenu .nav-link.active { 
    background: transparent; 
    color: #fff; 
    font-weight: 700; 
}

/* ─── Main Layout ─────────────────────────── */
.sirat-body { overflow-x: hidden; }

.sirat-main {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

/* Topbar */
.sirat-topbar {
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid #e8ecf0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 8px rgba(0,0,0,.06);
}

.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-breadcrumb h5 { margin: 0; font-size: .95rem; color: #1a2744; }

.sidebar-toggle {
    color: #6c7fa8;
    padding: 6px;
    border-radius: 8px;
    border: none;
    background: none;
}
.sidebar-toggle:hover { background: #f0f4f8; color: #1a2744; }

.topbar-right { display: flex; align-items: center; gap: 8px; }

.topbar-user {
    display: flex; align-items: center;
    gap: 10px;
    color: #2d3748;
    text-decoration: none;
    border: none;
    background: none;
    padding: 4px;
    border-radius: 10px;
    transition: var(--transition);
}
.topbar-user:hover { background: #f0f4f8; }
.topbar-user::after { display: none; }

.user-avatar {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #0b7a45);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: .9rem;
    overflow: hidden;
    border: 2px solid rgba(15,155,88,.3);
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Content area */
.sirat-content {
    flex: 1;
    padding: 24px;
    max-width: 100%;
}

.sirat-footer {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    border-top: 1px solid #e8ecf0;
    font-size: .75rem;
    color: #9ba3b8;
    background: #fff;
}

/* ─── Sidebar Collapsed ───────────────────── */
.sidebar-collapsed .sirat-sidebar { width: 72px; }
.sidebar-collapsed .sirat-sidebar .brand-text,
.sidebar-collapsed .sirat-sidebar .nav-link span,
.sidebar-collapsed .sirat-sidebar .nav-section,
.sidebar-collapsed .sirat-sidebar .toggle-icon { display: none; }
.sidebar-collapsed .sirat-sidebar .nav-link { justify-content: center; padding: 12px; }
.sidebar-collapsed .sirat-sidebar .submenu { display: none; }
.sidebar-collapsed .sirat-main { margin-left: 72px; }

/* ─── Cards ───────────────────────────────── */
.sirat-card {
    border: none;
    border-radius: var(--card-radius);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.sirat-card .card-header {
    background: #fff;
    border-bottom: 1px solid #f0f4f8;
    padding: 14px 20px;
    font-weight: 600;
}

.sirat-card .card-body { padding: 20px; }

/* ─── Stat Cards ──────────────────────────── */
.stat-card {
    border-radius: var(--card-radius);
    padding: 20px 20px 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    color: #fff;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,.15);
    transition: var(--transition);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: 0 8px 28px rgba(0,0,0,.2); }

.stat-card::before {
    content: '';
    position: absolute;
    top: -20px; right: -20px;
    width: 100px; height: 100px;
    border-radius: 50%;
    background: rgba(255,255,255,.1);
}
.stat-card::after {
    content: '';
    position: absolute;
    bottom: -30px; right: 20px;
    width: 70px; height: 70px;
    border-radius: 50%;
    background: rgba(255,255,255,.07);
}

.stat-icon {
    width: 54px; height: 54px;
    background: rgba(255,255,255,.2);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.6rem;
    flex-shrink: 0;
    z-index: 1;
}
.stat-body { flex: 1; z-index: 1; }
.stat-label { font-size: .65rem; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; opacity: .85; }
.stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1.2; margin: 2px 0; }
.stat-sub   { font-size: .75rem; opacity: .8; }

/* Color variants */
.stat-teal   { background: linear-gradient(135deg, #0f9b58, #0b7a45); }
.stat-green  { background: linear-gradient(135deg, #28a745, #1e7e34); }
.stat-red    { background: linear-gradient(135deg, #dc3545, #b02a37); }
.stat-blue   { background: linear-gradient(135deg, #007bff, #0056b3); }
.stat-indigo { background: linear-gradient(135deg, #6610f2, #4a0ab5); }
.stat-orange { background: linear-gradient(135deg, #fd7e14, #d96306); }
.stat-pink   { background: linear-gradient(135deg, #e83e8c, #c01f6e); }
.stat-warning{ background: linear-gradient(135deg, #ffc107, #d39e00); color: #212529 !important; }

/* ─── Table Styles ────────────────────────── */
.table-head-dark th {
    background: #1a2744;
    color: #a8b5d8;
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    border: none;
    padding: 12px 16px;
}
.table td { padding: 12px 16px; border-color: #f0f4f8; vertical-align: middle; }
.table-hover tbody tr:hover { background: #f8fafc; }

/* ─── Avatar ──────────────────────────────── */
.avatar-xs {
    width: 32px; height: 32px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 600; font-size: .8rem;
    flex-shrink: 0;
}
.avatar-lg {
    width: 90px; height: 90px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700;
}

/* ─── Buttons ─────────────────────────────── */
.btn-xs {
    padding: 4px 8px;
    font-size: .75rem;
    border-radius: 6px;
    line-height: 1.5;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

/* ─── Welcome Banner ──────────────────────── */
.welcome-banner {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: var(--card-radius);
    padding: 32px;
    color: #fff;
    box-shadow: 0 10px 25px -5px rgba(5, 150, 105, 0.4);
    position: relative;
    overflow: hidden;
}

.welcome-banner::after {
    content: '';
    position: absolute;
    top: -50px; right: -50px;
    width: 200px; height: 200px;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    border-radius: 50%;
}

.rt-info-badge {
    background: rgba(255,255,255,.15);
    border-radius: 10px;
    padding: 12px 16px;
    font-size: .82rem;
    backdrop-filter: blur(5px);
}
.rt-info-badge > div { padding: 2px 0; }

/* ─── Notifications / Tipe Badge ─────────── */
.notif-dot {
    width: 36px; height: 36px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem; flex-shrink: 0;
}
.notif-info    { background: #e3f2fd; color: #0288d1; }
.notif-penting { background: #fff8e1; color: #f9a825; }
.notif-darurat { background: #fce4ec; color: #c62828; }

.badge-tipe-info    { background: #0288d1 !important; }
.badge-tipe-penting { background: #f9a825 !important; color: #000 !important; }
.badge-tipe-darurat { background: #c62828 !important; }

/* ─── Dashboard: Mini Stat ────────────────── */
.mini-stat-card {
    border-radius: 10px;
    padding: 14px;
}
.mini-stat-label { font-size: .75rem; font-weight: 500; }
.mini-stat-value { font-size: 1rem; margin-top: 4px; }

.saldo-total {
    display: flex; justify-content: space-between; align-items: center;
    background: #f8fafc; border-radius: 10px;
    padding: 14px 16px;
    border: 1px solid #e8ecf0;
}
.saldo-amount { font-size: 1.1rem; font-weight: 700; color: #0f9b58; }

/* ─── Quick Links ─────────────────────────── */
.quick-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 8px;
    border-radius: 12px;
    background: #f8fafc;
    border: 1px solid #e8ecf0;
    color: #2d3748;
    text-decoration: none;
    font-size: .78rem;
    font-weight: 500;
    transition: var(--transition);
    text-align: center;
}
.quick-link i { font-size: 1.4rem; color: var(--primary); }
.quick-link:hover { background: var(--primary); color: #fff; border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 6px 16px rgba(15,155,88,.3); }
.quick-link:hover i { color: #fff; }

/* ─── Mini Badge ──────────────────────────── */
.mini-badge {
    border-radius: 8px;
    padding: 8px 14px;
    font-size: .8rem;
    display: flex;
    align-items: center;
}

/* ─── Detail Row ──────────────────────────── */
.detail-row {
    display: flex;
    flex-direction: column;
    padding: 8px 0;
    border-bottom: 1px solid #f0f4f8;
}
.detail-label { font-size: .72rem; color: #9ba3b8; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 2px; }
.detail-val   { font-size: .9rem; color: #2d3748; }

/* ─── Inventaris Card ─────────────────────── */
.inventaris-card { transition: var(--transition); }
.inventaris-card:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,.12); }

/* ─── Pengumuman Card ─────────────────────── */
.pengumuman-card { border-left-width: 4px !important; transition: var(--transition); }
.pengumuman-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,.1); }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ─── Foto Preview ────────────────────────── */
.foto-preview {
    width: 110px; height: 110px;
    border-radius: 50%;
    background: #f0f4f8;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto;
    border: 3px dashed #d0d7e2;
    overflow: hidden;
}

/* ─── Alerts ──────────────────────────────── */
.alert { border-radius: 10px; border: none; }
.alert-success { background: #d1fae5; color: #065f46; }
.alert-danger  { background: #fee2e2; color: #7f1d1d; }
.alert-warning { background: #fef3c7; color: #78350f; }
.alert-info    { background: #dbeafe; color: #1e3a8a; }

/* ─── Forms ───────────────────────────────── */
.form-control, .form-select {
    border-radius: 8px;
    border-color: #d0d7e2;
    font-size: .88rem;
    padding: 8px 12px;
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(15,155,88,.15);
}
.input-group-text {
    border-radius: 8px 0 0 8px;
    background: #f8fafc;
    border-color: #d0d7e2;
    font-size: .85rem;
}

/* ─── Dashboard Tabs (Mobile) ────────────── */
.dashboard-tabs {
    display: flex;
    background: #fff;
    padding: 6px;
    border-radius: 14px;
    box-shadow: 0 4px 12px rgba(0,0,0,.05);
}

.dashboard-tabs .tab-item {
    flex: 1;
    border: none;
    background: none;
    padding: 8px 4px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: #9ba3b8;
    transition: var(--transition);
}

.dashboard-tabs .tab-item i {
    font-size: 1.2rem;
}

.dashboard-tabs .tab-item span {
    font-size: .65rem;
    font-weight: 600;
}

.dashboard-tabs .tab-item.active {
    background: #fff;
    color: var(--primary);
    box-shadow: 0 4px 10px rgba(0,0,0,.08);
}

/* ─── Dashboard Layout (Desktop vs Mobile) ─── */
@media (min-width: 992px) {
    .dashboard-layout {
        display: flex;
        gap: 24px;
        align-items: flex-start;
    }
    .dashboard-main {
        flex: 1;
        min-width: 0;
    }
    .dashboard-sidebar {
        width: 340px;
        flex-shrink: 0;
        display: flex;
        flex-direction: column;
        gap: 24px;
    }
    .dashboard-tab {
        display: block !important;
    }
}

@media (max-width: 991.98px) {
    .dashboard-tab {
        display: none;
    }
    .dashboard-tab.active {
        display: block;
    }
}

/* ─── Mobile Bottom Nav ──────────────────── */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-shadow: 0 -8px 24px rgba(0,0,0,0.06);
    z-index: 1050;
    border-top: 1px solid rgba(243, 244, 246, 0.8);
    padding-bottom: env(safe-area-inset-bottom);
}

.mobile-bottom-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #6b7280;
    font-size: 10px;
    font-weight: 600;
    transition: var(--transition);
    flex: 1;
    height: 100%;
}

.mobile-bottom-nav .nav-item i {
    font-size: 22px;
    margin-bottom: 4px;
}

.mobile-bottom-nav .nav-item.active {
    color: var(--primary);
}

.mobile-bottom-nav .nav-item.active i {
    transform: scale(1.1);
    text-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
}

/* Filter Bar (Reference Style) */
.filter-bar {
    background: #fff;
    padding: 16px;
    border-radius: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
    margin-bottom: 24px;
    box-shadow: var(--shadow-card);
}
.filter-bar .form-group { flex: 1; min-width: 150px; }
.filter-bar label { font-size: .75rem; font-weight: 600; color: #64748b; margin-bottom: 4px; display: block; }
.filter-bar .btn-filter { background: var(--primary-light); color: #fff; border: none; padding: 8px 24px; border-radius: 8px; font-weight: 600; }

/* Stat Cards (Reference Style) */
.reference-stat-card {
    border-radius: 12px;
    padding: 20px;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
    position: relative;
    overflow: hidden;
}
.reference-stat-card .stat-val { font-size: 2rem; font-weight: 800; line-height: 1; }
.reference-stat-card .stat-label { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }
.reference-stat-card .stat-icon-bg {
    font-size: 2.5rem; opacity: .2;
    position: absolute; right: 15px; top: 50%; transform: translateY(-50%);
}

.bg-teal-gradient   { background: linear-gradient(135deg, #0d9488 0%, #14b8a6 100%); }
.bg-green-gradient  { background: linear-gradient(135deg, #059669 0%, #10b981 100%); }
.bg-orange-gradient { background: linear-gradient(135deg, #d97706 0%, #fbbf24 100%); }
.bg-blue-gradient   { background: linear-gradient(135deg, #2563eb 0%, #60a5fa 100%); }

/* Responsive */
@media (max-width: 768px) {
    .sirat-sidebar  { transform: translateX(-100%); width: 280px; }
    .sirat-main     { margin-left: 0; padding-bottom: 70px; }
    .sidebar-open .sirat-sidebar { transform: translateX(0); }
    .auth-card      { flex-direction: column; }
    .auth-left      { display: none; }
    .sirat-content  { padding: 12px; }
    .stat-value     { font-size: 1.2rem; }
    
    .page-header-wrapper { margin-top: 10px; }
    .user-avatar-circle { width: 34px; height: 34px; }
}
