/* =====================================================
   SINORATIS DESIGN SYSTEM FINAL v1
   Admin Panel Modern (Login + Dashboard + Sidebar)
===================================================== */

/* =========================
   ROOT VARIABLES
========================= */
:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --secondary: #0f172a;
    --light: #f4f6f9;
    --text: #334155;
    --muted: #94a3b8;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #fbbf24;
}

/* =========================
   GLOBAL RESET
========================= */
* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    background: var(--light);
    color: var(--text);
    overflow-x: hidden;
}



/* ==========================================================================
   [INDEX.PHP] - MAIN STRUCTURE LAYOUT
   Mengatur pembungkus utama agar Sidebar dan Konten sinkron
   ========================================================================== */

/* Wrapper Utama */
.main-wrapper {
    display: flex;
    width: 100%;
    align-items: stretch; /* KUNCI: Membuat Sidebar & Konten sama tinggi */
    min-height: 100vh;
    overflow-x: hidden;
}

/* Sidebar Adjustment */
.sidebar {
    width: 260px;
    background: var(--secondary);
    flex-shrink: 0; /* Mencegah sidebar menyusut */
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: all 0.3s;
}

/* Area Konten Utama */
#content-area {
    flex-grow: 1; /* Mengambil sisa ruang layar */
    background: var(--light);
    display: flex;
    flex-direction: column;
    min-width: 0; /* Mencegah konten merusak layout jika ada tabel lebar */
}

/* Bagian Dalam Konten (Halaman yang di-include) */
.page-content {
    padding: 25px;
    flex: 1 0 auto; /* Memastikan konten mendorong footer ke bawah */
}

/* ---------------------------------------------------------
   [REVISI RESPONSIVE] 
   Memastikan Layout tetap aman di layar kecil
   --------------------------------------------------------- */
@media (max-width: 991px) {
    .main-wrapper {
        display: block; /* Pada mobile, flex diubah agar tidak bertumpuk samping */
    }

    .sidebar {
        position: fixed;
        left: -260px;
        height: 100vh !important; /* Di HP tetap setinggi layar (overlay) */
        width: 260px;
    }

    .sidebar.show {
        left: 0;
    }

    #content-area {
        width: 100%;
        margin-left: 0;
    }
}

/* =====================================================
   LOGIN PAGE
===================================================== */

.login-page {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* TOP MARQUEE */
.top-marquee {
    height: 40px;
    background: #ffcc00;
    color: #000;
    display: flex;
    align-items: center;
    font-weight: 700;
    font-size: 14px;
}

/* MAIN LOGIN LAYOUT */
.main-container {
    flex: 1;
    display: flex;
    overflow: hidden;
}

/* LEFT SIDE LOGIN INFO */
.info-side {
    flex: 1;
    background: linear-gradient(135deg, var(--secondary), #1e293b);
    color: #fff;
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* RIGHT SIDE LOGIN */
.login-side {
    flex: 1;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
}

/* LOGIN CARD */
.card-login {
    width: 100%;
    max-width: 380px;
    background: #fff;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
}

/* LOGIN ICON */
.login-icon {
    width: 55px;
    height: 55px;
    margin: 0 auto;
    background: rgba(37,99,235,0.1);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

/* FORM */
.form-control,
.form-select {
    border-radius: 8px !important;
    font-size: 14px;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.15rem rgba(37,99,235,0.2);
}

/* BUTTON */
.btn-primary {
    background: var(--primary);
    border: none;
    border-radius: 10px;
}

.btn-primary:hover {
    background: var(--primary-dark);
}

/* INFO BOX LOGIN */
.info-box {
    background: rgba(255,255,255,0.08);
    border-left: 4px solid var(--warning);
    padding: 15px;
    border-radius: 10px;
    font-size: 0.85rem;
}

/* CAROUSEL IMAGE */
.carousel-item img {
    max-height: 300px;
    object-fit: cover;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.25);
}

/* =====================================================
   APP LAYOUT (DASHBOARD)
===================================================== */

.main-wrapper {
    display: flex;
    min-height: 100vh;
}

/* CONTENT AREA */
#content-area {
    flex-grow: 1;
    padding: 20px;
    background: var(--light);
}




/* =====================================================
   HEADER / NAVBAR (TEXT COLOR FIX)
===================================================== */

.bg-bkk {
    background: linear-gradient(90deg, #0f172a 0%, #1e293b 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Judul Utama Instansi - Dibuat Putih Terang */
.brand-text span {
    color: #ffffff !important; /* Putih solid agar kontras */
    font-size: 14px;
    font-weight: 700;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5); /* Shadow halus agar makin tegas */
}

/* Sub Judul Unit Pengelolaan - Kuning Terang */
.brand-text small {
    color: #ffcc00 !important; /* Kuning BKK yang tajam */
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Info Username di Pojok Kanan */
.text-end .fw-bold {
    color: #ffffff !important;
}

/* =====================================================
   SIDEBAR CUSTOM DESIGN
===================================================== */

.sidebar {
    width: 260px;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--secondary);
    color: #ffffff;
    position: relative; 
    flex-shrink: 0;
}

/* 1. Beri ruang lebih pada Brand/Judul */
.sidebar-brand {
    padding: 40px 20px; /* Menambah ruang atas dan bawah judul */
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.05); /* Garis halus pembatas */
}

/* 2. Beri jarak kelompok menu dari judul */
.sidebar-menu-container {
    margin-top: 30px; /* Menurunkan posisi menu agar tidak nempel judul */
    flex-grow: 1;
}

/* 3. Gaya Label Kelompok Menu (Heading) */
.menu-header {
    padding: 10px 25px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255,255,255,0.4); /* Warna teks agak samar agar elegan */
    margin-top: 20px;
}

/* 4. Gaya Link Menu */
.sidebar .nav-link {
    color: rgba(255,255,255,0.8);
    padding: 12px 25px;
    display: flex;
    align-items: center;
    transition: all 0.3s;
    font-weight: 500;
}

.sidebar .nav-link i {
    width: 30px; /* Menjaga ikon sejajar vertikal */
}

.sidebar .nav-link:hover {
    background: rgba(255,255,255,0.05);
    color: #ffffff;
}


.sidebar-brand-wrapper {
    /* Menurunkan posisi judul agar tidak terlalu mepet header */
    padding-top: 60px !important; 
    padding-bottom: 40px !important;
    /* Memberikan efek gradasi gelap halus di bagian atas */
    background: linear-gradient(to bottom, rgba(0,0,0,0.15), transparent);
}

.sidebar-brand-wrapper h5 {
    color: #ffffff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.sidebar-header .sidebar-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    border-radius: 8px;
    margin: 0 15px; /* Memberikan ruang di sisi kiri kanan menu */
}




/* =====================================================
   FOOTER
===================================================== */

.app-footer {
    background: #fff;
    border-top: 1px solid #e5e7eb;
    font-size: 13px;
    color: var(--muted);
}

/* =====================================================
   RESPONSIVE
===================================================== */

@media (max-width: 991px) {

    .info-side {
        display: none;
    }

    .login-side {
        width: 100%;
        padding: 20px;
    }

    .sidebar {
        position: fixed;
        left: -260px;
        transition: 0.3s;
        z-index: 1000;
    }

    .sidebar.show {
        left: 0;
    }
}



/* =========================
   APP ALERT (MODUL NOT FOUND)
========================= */
.app-alert {
    border-radius: 10px;
    background: #ffffff;
    padding: 15px;
    font-size: 14px;
    color: #334155;
}

.app-alert i {
    font-size: 18px;
}

/* =====================================================
   SIDEBAR (FONT ADJUSTED - SLIGHTLY LARGER)
===================================================== */

.sidebar {
    width: 260px;
    min-height: 100vh;
    background: var(--secondary);
    color: #cbd5e1;
    position: sticky;
    top: 0;
}

/* DASHBOARD / LINK UTAMA */
.sidebar-link {
    display: flex;
    align-items: center;
    padding: 10px 15px; /* Padding dikembalikan sedikit agar lebih lega */
    color: #cbd5e1;
    text-decoration: none;
    border-radius: 8px;
    transition: 0.2s;
    font-weight: 500;
    font-size: 14.5px; /* Ukuran dinaikkan sedikit dari standar (sebelumnya 13.5px) */
}

/* GROUP MENU (JUDUL DROPDOWN) */
.sidebar-group-btn {
    width: 100%;
    background: transparent;
    border: none;
    color: #cbd5e1;
    padding: 12px 15px; 
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    text-align: left;
    font-size: 13px; /* Judul grup naik ke 13px */
    text-transform: uppercase;
    letter-spacing: 0.8px; /* Jarak antar huruf ditambah agar elegan */
}

/* SUB MENU (ITEM DI DALAM DROPDOWN) */
.sidebar-sublink {
    display: flex;
    align-items: center;
    padding: 8px 15px; 
    margin: 2px 0;
    color: #94a3b8;
    text-decoration: none;
    border-radius: 6px;
    font-size: 13.5px; /* Sub-menu naik ke 13.5px (sebelumnya 12.5px) */
    transition: 0.2s;
}

/* DOT ICON (Penyesuaian posisi) */
.dot {
    width: 6px;
    height: 6px;
    background: #64748b;
    border-radius: 50%;
    margin-right: 12px;
}

/* Perbaikan Ukuran Icon agar Seimbang */
.sidebar-link i, .sidebar-group-btn i {
    font-size: 16px; /* Icon sedikit lebih besar */
    width: 25px;
    text-align: center;
    margin-right: 10px;
}


/* ==========================================================================
   [MODUL: PENGELOLAAN PDF SURAT MASUK]
   Digunakan pada: surat_masuk_pdf.php & ajax_cek_surat_masuk.php
   ========================================================================== */

/* --- Container & Card --- */
.card-upload {
    border: none;
    border-radius: 15px;
    background: #ffffff;
    overflow: hidden;
}

.card-header-custom {
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 20px;
}

/* --- Form Pencarian (Halaman Utama) --- */
.search-wrapper {
    position: relative;
}

.search-wrapper i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
}

.search-control {
    padding-left: 40px !important;
    height: 45px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.search-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

/* --- Tabel Data (Umum & AJAX) --- */
.table-custom {
    font-size: 13.5px;
}

.table-custom thead th {
    background: var(--secondary);
    color: #ffffff;
    font-weight: 600;
    padding: 12px;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 1px;
    border: none;
}

.table-custom tbody td {
    vertical-align: middle !important;
    padding: 12px 10px;
}

/* --- Elemen Baris (AJAX) --- */
.nomor-naskah {
    display: block;
    font-weight: 700;
    color: var(--primary);
    font-size: 14px;
}

.badge-tgl {
    font-size: 11px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 6px;
    background: #f1f5f9;
    color: #475569;
}

.col-perihal {
    max-width: 280px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text);
}

/* --- Form Upload (AJAX) --- */
.form-upload-ajax {
    padding: 2px;
    max-width: 250px;
}

.form-upload-ajax .input-group {
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.text-limit-hint {
    font-size: 10px;
    color: var(--muted);
    margin-top: 4px;
    display: block;
    font-style: italic;
}

/* --- Pagination & Info --- */
.pagination-info {
    font-size: 12px;
    color: var(--muted);
    font-weight: 500;
}

.pagination .page-link {
    border-radius: 6px;
    margin: 0 2px;
    color: var(--text);
    border: 1px solid #e2e8f0;
}

.pagination .page-item.active .page-link {
    background-color: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* --- State: Kosong / Loading --- */
.empty-state {
    padding: 40px 0;
    text-align: center;
}

.empty-state i {
    opacity: 0.2;
    margin-bottom: 15px;
}