/* assets/css/style.css - S Feeder UI Stylesheet matching Client Mockup */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #006837;
    /* JAIS Dark Green */
    --primary-dark: #004d28;
    --primary-light: #e6f4ed;
    --secondary-color: #1e3a8a;
    /* Professional Dark Blue */
    --bg-light: #f4f6f9;
    --card-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    --border-radius: 12px;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-light);
    color: #333333;
    overflow-x: hidden;
}

/* Layout Container */
.wrapper {
    display: flex;
    width: 100%;
    align-items: stretch;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Sidebar Styles */
#sidebar {
    min-width: 260px;
    max-width: 260px;
    background: #ffffff;
    color: #333;
    transition: all 0.3s ease;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
    z-index: 999;
    display: flex;
    flex-direction: column;
}

#sidebar.active {
    margin-left: -260px;
}

/* Sidebar Backdrop for Mobile */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 1040;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* Page Content - flex item fix to prevent overflowing the screen */
#content {
    flex: 1 1 0%;
    min-width: 0;
    max-width: 100%;
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

#sidebar .sidebar-header {
    padding: 20px;
    background: #ffffff;
    border-bottom: 1px solid #f0f0f0;
    text-align: center;
}

#sidebar .sidebar-header img {
    max-height: 48px;
}

#sidebar ul.components {
    padding: 15px 0;
    flex-grow: 1;
}

#sidebar ul li {
    padding: 0 15px;
    margin-bottom: 5px;
}

#sidebar ul li a {
    padding: 12px 18px;
    font-size: 0.92rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    color: #555;
    border-radius: 10px;
    text-decoration: none;
    transition: all 0.2s ease;
}

#sidebar ul li a i {
    font-size: 1.15rem;
    margin-right: 12px;
    width: 24px;
    text-align: center;
}

#sidebar ul li a:hover,
#sidebar ul li.active>a {
    color: var(--primary-color);
    background: var(--primary-light);
    font-weight: 600;
}

/* Top Navigation Bar */
.top-navbar {
    background: #ffffff;
    border-bottom: 1px solid #e9ecef;
    padding: 10px 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
    min-height: 58px;
}

.top-navbar .logo-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.top-navbar .logo-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.top-navbar .logo-item img {
    height: 40px;
    width: auto;
    object-fit: contain;
    flex-shrink: 0;
}

.top-navbar .logo-text {
    line-height: 1.15;
}

.top-navbar .logo-text strong {
    font-size: 0.88rem;
    color: var(--primary-color);
    display: block;
    letter-spacing: 0.4px;
}

.top-navbar .logo-text span {
    font-size: 0.68rem;
    color: #666;
    letter-spacing: 0.3px;
    display: block;
}

.badge-session {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #334155;
    padding: 6px 13px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Responsif Mobile untuk Header (Logo JAWI & Sesi) */
@media (max-width: 767.98px) {
    .top-navbar {
        padding: 8px 12px;
        min-height: 52px;
    }

    .top-navbar .logo-item {
        gap: 6px;
    }

    .top-navbar .logo-item img {
        height: 32px;
    }

    .top-navbar .logo-text strong {
        font-size: 0.78rem;
        line-height: 1.1;
    }

    .top-navbar .logo-text span {
        font-size: 0.52rem;
        line-height: 1.1;
        letter-spacing: 0.1px;
    }

    .badge-session {
        padding: 4px 8px;
        font-size: 0.72rem;
        gap: 4px;
        border-radius: 14px;
    }

    .badge-session i {
        font-size: 0.75rem;
    }
}

@media (max-width: 440px) {
    .top-navbar {
        padding: 6px 8px;
    }

    .top-navbar .logo-item img {
        height: 28px;
    }

    .top-navbar .logo-text strong {
        font-size: 0.74rem;
    }

    .top-navbar .logo-text span {
        font-size: 0.48rem;
        max-width: 110px;
        line-height: 1.05;
    }

    .badge-session {
        padding: 3px 6px;
        font-size: 0.66rem;
    }

    .badge-session span {
        font-size: 0.66rem;
    }
}

@media (max-width: 345px) {
    .top-navbar .logo-text span {
        display: none !important;
    }
}

/* Hero Banner matching mockup */
.hero-banner {
    background: linear-gradient(135deg, rgba(0, 77, 40, 0.92) 0%, rgba(0, 104, 55, 0.85) 100%),
        url('../image/sekolah-agama.jpeg') center/cover no-repeat;
    color: #ffffff;
    padding: 35px 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    margin-bottom: 25px;
    position: relative;
    overflow: hidden;
}

.hero-banner h1 {
    font-size: 2.2rem;
    font-weight: 800;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.hero-banner p.subtitle {
    font-size: 0.95rem;
    opacity: 0.9;
    letter-spacing: 0.5px;
}

.banner-search-box {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 30px;
    padding: 4px 6px 4px 20px;
    display: flex;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.banner-search-box input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
    font-size: 0.9rem;
    color: #333;
}

.banner-search-box button {
    background: var(--primary-color);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.banner-search-box button:hover {
    background: var(--primary-dark);
}

/* Stat Cards */
.stat-card {
    background: #ffffff;
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--card-shadow);
    border: 1px solid #f0f0f0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: block;
    height: 100%;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    margin-bottom: 12px;
}

.stat-card .stat-title {
    font-size: 0.78rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.stat-card .stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: #1e293b;
    line-height: 1;
}

.stat-card .stat-badge {
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 6px;
}

/* Custom Icon Colors for Cards */
.icon-bg-green {
    background: #dcfce7;
    color: #166534;
}

.icon-bg-purple {
    background: #f3e8ff;
    color: #6b21a8;
}

.icon-bg-blue {
    background: #dbeafe;
    color: #1e40af;
}

.icon-bg-teal {
    background: #ccfbf1;
    color: #115e59;
}

.icon-bg-warning {
    background: #fef3c7;
    color: #92400e;
}

.icon-bg-danger {
    background: #ffe4e6;
    color: #9f1239;
}

/* Section Cards */
.dashboard-card {
    background: #ffffff;
    border-radius: var(--border-radius);
    padding: 22px;
    box-shadow: var(--card-shadow);
    border: 1px solid #f0f0f0;
    margin-bottom: 25px;
}

.dashboard-card .card-header-custom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 15px;
    margin-bottom: 18px;
    border-bottom: 1px solid #f1f5f9;
}

.dashboard-card .card-header-custom h5 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    color: #1e293b;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Activity List */
.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
    padding: 12px 0;
    border-bottom: 1px solid #f8fafc;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

/* Table Styling & Responsive Scrollbar */
.table-responsive {
    width: 100%;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    display: block;
}

/* Custom scrollbar untuk semua table responsive */
.table-responsive::-webkit-scrollbar {
    height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.table-custom {
    width: 100%;
    min-width: 720px;
    border-collapse: separate;
    border-spacing: 0;
}

.table-custom th {
    background: #f8fafc;
    color: #475569;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 12px 16px;
    border-bottom: 2px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.table-custom td {
    padding: 12px 16px;
    font-size: 0.88rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.table-custom tbody tr:hover {
    background-color: #f8fafc;
}

/* Status Badges */
.badge-status {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
}

.badge-tiada {
    background-color: #e2e8f0;
    color: #475569;
}

.badge-berdaftar {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-belum {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-rayuan {
    background-color: #fee2e2;
    color: #991b1b;
}

/* Pintasan Footer Bar */
.pintasan-bar {
    background: #ffffff;
    border-radius: var(--border-radius);
    padding: 15px 25px;
    box-shadow: var(--card-shadow);
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.pintasan-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #475569;
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 8px;
    background: #f8fafc;
    transition: all 0.2s;
}

.pintasan-item:hover {
    background: var(--primary-light);
    color: var(--primary-color);
}

/* ============================================
   RESPONSIVE — Zoom & Skrin Kecil
   ============================================ */

/* Tablet / Zoom ~125% ke atas */
@media (max-width: 992px) {
    #sidebar {
        min-width: 220px;
        max-width: 220px;
    }

    #sidebar.active {
        margin-left: -220px;
    }

    .hero-banner {
        padding: 25px 20px;
    }

    .hero-banner h1 {
        font-size: 1.8rem;
    }

    .stat-card .stat-value {
        font-size: 1.5rem;
    }
}

/* Mobile / Zoom ~150% ke atas */
@media (max-width: 768px) {
    /* Backdrop aktif di mobile */
    .sidebar-backdrop {
        display: block;
    }

    .sidebar-backdrop.active {
        opacity: 1;
        pointer-events: auto;
    }

    /* Kunci scroll latar belakang semasa sidebar dibuka */
    body.sidebar-open {
        overflow: hidden !important;
        touch-action: none;
    }

    #sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        height: 100vh;
        height: 100dvh;
        max-height: 100dvh;
        width: 280px;
        min-width: 280px;
        max-width: 85vw;
        margin-left: -290px;
        z-index: 1050;
        display: flex;
        flex-direction: column;
        overflow: hidden; /* Header & footer kekal statik, list menu di tengah scroll lancar */
        background: #ffffff;
        box-shadow: none;
        transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        touch-action: pan-y;
    }

    #sidebar.active {
        margin-left: 0;
        box-shadow: 6px 0 25px rgba(0, 0, 0, 0.2);
    }

    #sidebar .sidebar-header {
        flex-shrink: 0;
        padding: 16px 20px;
        background: #ffffff;
        border-bottom: 1px solid #f0f0f0;
    }

    #sidebar .sidebar-close-btn {
        display: block !important;
    }

    #sidebar ul.components {
        flex: 1 1 auto;
        min-height: 0; /* Penting untuk scrolling item flex */
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch; /* Momentum scrolling lancar untuk iOS / WebKit */
        overscroll-behavior: contain;
        overscroll-behavior-y: contain; /* Elak scroll chaining ke halaman latar */
        padding: 12px 0 20px 0;
        margin: 0;
    }

    /* Scrollbar halus & kemas */
    #sidebar ul.components::-webkit-scrollbar {
        width: 4px;
    }
    #sidebar ul.components::-webkit-scrollbar-track {
        background: transparent;
    }
    #sidebar ul.components::-webkit-scrollbar-thumb {
        background: rgba(0, 0, 0, 0.15);
        border-radius: 4px;
    }

    #sidebar .sidebar-footer {
        flex-shrink: 0;
        background: #ffffff;
        border-top: 1px solid #f0f0f0;
        padding: 12px 16px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 12px));
        margin-top: 0 !important;
    }

    #content {
        width: 100% !important;
        min-width: 0;
    }

    .hero-banner h1 {
        font-size: 1.5rem;
    }

    .hero-banner p.subtitle {
        font-size: 0.82rem;
    }

    .top-navbar {
        padding: 10px 15px;
    }

    .stat-card {
        padding: 15px;
    }

    .stat-card .stat-value {
        font-size: 1.4rem;
    }

    .dashboard-card {
        padding: 16px;
    }
}

/* Zoom ~175%+ / Skrin sangat kecil */
@media (max-width: 576px) {
    .hero-banner h1 {
        font-size: 1.3rem;
    }

    .hero-banner {
        padding: 20px 15px;
    }

    .banner-search-box {
        padding: 3px 5px 3px 14px;
    }

    .stat-card .stat-title {
        font-size: 0.7rem;
    }

    .stat-card .stat-value {
        font-size: 1.2rem;
    }
}

/* Global Page Loader Overlay Animation */
.page-loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

.page-loader-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-content {
    background: #ffffff;
    padding: 30px 40px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 104, 55, 0.15);
    max-width: 320px;
    width: 90%;
    animation: loaderPop 0.4s ease-out;
}

@keyframes loaderPop {
    0% {
        transform: scale(0.9);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.loader-icon-wrap {
    width: 60px;
    height: 60px;
    margin: 0 auto;
    background: var(--primary-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loader-icon {
    font-size: 2rem;
    color: var(--primary-color);
    animation: loaderPulse 1.4s infinite ease-in-out;
}

@keyframes loaderPulse {
    0% {
        transform: scale(1);
        opacity: 0.85;
    }

    50% {
        transform: scale(1.18);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 0.85;
    }
}

/* Custom Accordion Styling for Additional Information */
#accordionMaklumatTambahan .accordion-button {
    font-size: 0.9rem;
    transition: background-color 0.2s ease, color 0.2s ease;
}

#accordionMaklumatTambahan .accordion-button:not(.collapsed) {
    background-color: #f0fdf4;
    color: #166534;
    box-shadow: none;
    border-bottom: 1px solid #dcfce7;
}

#accordionMaklumatTambahan .accordion-button:focus {
    box-shadow: none;
    border-color: rgba(0, 104, 55, 0.25);
}

/* ==========================================================================
   GAYA PLACEHOLDER KONTRA & JELAS (BEZAKAN DARIPADA NILAI YANG TELAH DIISI)
   ========================================================================== */
/* Warna kelabu lembut, teks condong (italic), dan membatalkan huruf besar paksa
   supaya placeholder nampak jelas sebagai panduan/contoh sahaja. */
input::placeholder,
textarea::placeholder,
.form-control::placeholder {
    color: #94a3b8 !important;
    font-style: italic !important;
    font-weight: 400 !important;
    font-size: 0.88rem !important;
    text-transform: none !important;
    opacity: 0.85 !important;
    letter-spacing: normal !important;
}

input::-webkit-input-placeholder,
textarea::-webkit-input-placeholder,
.form-control::-webkit-input-placeholder {
    color: #94a3b8 !important;
    font-style: italic !important;
    font-weight: 400 !important;
    font-size: 0.88rem !important;
    text-transform: none !important;
    opacity: 0.85 !important;
    letter-spacing: normal !important;
}

input::-moz-placeholder,
textarea::-moz-placeholder,
.form-control::-moz-placeholder {
    color: #94a3b8 !important;
    font-style: italic !important;
    font-weight: 400 !important;
    font-size: 0.88rem !important;
    text-transform: none !important;
    opacity: 0.85 !important;
    letter-spacing: normal !important;
}

input:-ms-input-placeholder,
textarea:-ms-input-placeholder,
.form-control:-ms-input-placeholder {
    color: #94a3b8 !important;
    font-style: italic !important;
    font-weight: 400 !important;
    font-size: 0.88rem !important;
    text-transform: none !important;
    opacity: 0.85 !important;
    letter-spacing: normal !important;
}

/* Apabila medan input diklik/difokuskan, pudar sedikit placeholder */
input:focus::placeholder,
textarea:focus::placeholder,
.form-control:focus::placeholder {
    opacity: 0.3 !important;
}

/* Teks sebenar yang telah diisi pengguna: warna gelap (#0f172a), tegak dan kemas */
.form-control,
.form-select {
    color: #0f172a;
    font-weight: 500;
}