/* ==========================================================================
   1. VARIABEL WARNA & ATURAN UTAMA (PREMIUM LIGHT TEMA)
   ========================================================================== */
:root {
    --bg-main: #f8fafc;        /* Abu-abu ultra-soft untuk background */
    --bg-card: #ffffff;        /* Putih bersih untuk panel konten */
    --text-main: #8a0a0a;      /* Hitam arang elegan (Slate 800) */
    --text-muted: #64748b;     /* Abu-abu teks sekunder (Slate 500) */
    --primary: #f74f4f;        /* Hitam solid berkelas untuk aksen utama (Slate 900) */
    --primary-hover: #334155;
    --border-color: #e2e8f0;   /* Garis samar tipis (Slate 200) */
    --focus-color: #3b82f6;    /* Biru tipis untuk fokus input */
    --danger: #ef4444;         /* Merah modern */
}

* {
    box-sizing: border-box;    /* Mencegah input/tabel melebihi ukuran layar */
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg-main);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text-main);
    padding: 16px;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: var(--focus-color);
    transition: color 0.2s ease;
}

a:hover {
    color: var(--primary-hover);
    opacity: 0.8;
}

pre {
    white-space: pre-wrap;
    background: #f1f5f9;
    padding: 10px;
    border-radius: 4px;
    font-size: 12px;
}

/* ==========================================================================
   2. TOMBOL GLOBAL & UTENSIL
   ========================================================================== */
button {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    background: var(--primary);
    color: white;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

button:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.fas {
    width: 20px;
    text-align: center;
    font-size: 12px;
}

/* ==========================================================================
   3. STRUKTUR "C-PAGE" (PADAT & BERBARIS KECIL)
   ========================================================================== */
.c-data {
    background: var(--bg-card);
    padding: 8px 12px;          /* Padding kecil khas sistem lama agar hemat ruang */
    border-radius: 6px;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    margin-bottom: 10px;
    font-size: 13px;
}

h4 {
    font-size: 13px;            /* Ukuran judul diperkecil agar formal */
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--primary);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 6px;
    margin-bottom: 12px;
    text-transform: uppercase;
}

.info-record {
    width: 100%;
    font-size: 12px;
    color: var(--text-muted);
    padding: 6px 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: #ffffff;
    margin-bottom: 8px;
}

.search-bar {
    margin: 8px 0;
    text-align: left;
}

/* ==========================================================================
   4. FORM & FLOATING LABELS (VERSI COMPACT/RAPAT)
   ========================================================================== */
form {
    background: none;
}

label {
    display: block;
    height: auto;               /* Mengembalikan tinggi otomatis agar rapat */
    position: relative;
    width: 100%;
    padding: 0;
    margin: 4px 0;              /* Jarak antar baris dipersempit maksimal */
}

input, select, textarea {
    padding: 6px 10px;          /* Ukuran kotak input dibuat tipis dan rapat */
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    width: 100%;
    font-size: 13px;
    background: var(--bg-card);
    color: var(--text-main);
    margin-top: 1px;
    transition: all 0.2s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--focus-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

/* Animasi Floating Label Ukuran Mini */
input ~ span, select ~ span, textarea ~ span {
    position: absolute;
    padding: 0 4px;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 13px;
    pointer-events: none;
    transition: all 0.2s ease;
}

textarea ~ span {
    top: 14px;
    transform: none;
}

input:focus ~ span, input:valid ~ span,
select:focus ~ span, select:valid ~ span,
textarea:focus ~ span, textarea:valid ~ span,
.readonly span {
    top: 0;
    transform: translateY(-50%);
    background: var(--bg-card);
    color: var(--focus-color);
    font-size: 11px;
    font-weight: 600;
}

input[readonly] {
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    background: #f1f5f9;
}

input[type='checkbox'] {
    width: auto;
    margin-right: 6px;
    padding: 0;
}

input[type='search'] {
    width: 200px;
    padding: 5px 10px;
    font-size: 12px;
}

textarea {
    height: 100px;
    resize: vertical;
}

/* ==========================================================================
   5. TABEL DATA "TABLE-LIST" (SUPER PADAT & BERBARIS KECIL)
   ========================================================================== */
table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
}

.table-list {
    border: 1px solid var(--border-color);
    font-size: 12px;            /* Mengembalikan ukuran teks kecil bawaan sistem lama */
}

.table-list th {
    background: linear-gradient(to top, #e0e0e0, #f5e6e6);
    color: var(--text-main);
    padding: 6px 8px;           /* Ukuran kepala tabel yang tipis */
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    border-bottom: 2px solid var(--border-color);
    text-align: left;
}

.table-list td {
    padding: 5px 8px;           /* Jarak baris data dipadatkan rapat */
    border-bottom: 1px solid var(--border-color);
    color: #334155;
    vertical-align: middle;
    white-space: nowrap;        /* Mencegah teks baris patah ke bawah */
}

/* Efek Belang Baris Tipis */
.table-list tr:nth-child(even) { background-color: #f8fafc; }
.table-list tr:nth-child(odd) { background-color: #ffffff; }

.table-list tr:hover {
    background-color: #f1f5f9;  /* Highlight baris saat disentuh kursor */
}

/* Tombol Kecil Dalam Tabel */
.table-list button {
    padding: 2px 6px;
    font-size: 10px;
    border-radius: 3px;
}

.aksi {
    display: inline-flex;
    align-items: center;
    margin: 1px;
    padding: 3px 8px;
    border-radius: 4px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 500;
    transition: background 0.2s;
}

.aksi:hover {
    background: #dc2626;
}

/* ==========================================================================
   6. OPSI MENU DROPDOWN (TERSEMBUNYI, AKTIF SAAT HOVER)
   ========================================================================== */
.dropdown {
    position: relative;
    display: inline-block;
}

/* Wadah Opsi: TERSEMBUNYI TOTAL SECARA DEFAULT */
.dropdown-content {
    display: none;             
    position: absolute;
    right: 0;                   /* Meratakan menu ke kanan agar aman tidak terpotong layar */
    background-color: #ffffff;
    min-width: 130px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    z-index: 10;
    overflow: hidden;
    margin-top: 1px;
}

/* Isi Baris Opsi Pilihan */
.dropdown-content p {
    color: #334155;
    padding: 6px 10px;
    margin: 0;
    font-size: 12px;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
}

/* BARU AKAN MUNCUL KETIKA TOMBOL DI-HOVER (KURSOR DIATASNYA) */
.dropdown:hover .dropdown-content {
    display: block;            
}

.dropdown-content p:hover {
    background-color: #f1f5f9;
    color: var(--primary);
}

/* Penampilan Tombol Pemicu Opsi */
.dropbtn {
    background-color: var(--primary);
    color: white;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 500;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.dropdown:hover .dropbtn {
    background-color: var(--primary-hover);
}

/* ==========================================================================
   7. KOMPONEN ACCORDION & SNACKBAR TOAST
   ========================================================================== */
.accordion {
    background-color: #f1f5f9;
    color: var(--text-main);
    cursor: pointer;
    padding: 10px 14px;
    width: 100%;
    border: none;
    text-align: left;
    outline: none;
    font-size: 13px;
    font-weight: 500;
    transition: 0.3s;
    border-radius: 4px;
    margin-bottom: 2px;
}

.active, .accordion:hover {
    background-color: #e2e8f0;
}

.accordion:after {
    content: '\02C7';
    color: var(--text-muted);
    font-weight: bold;
    float: right;
    margin-left: 5px;
}

.active:after {
    content: "\02C6";
}

.panel {
    padding: 0 10px;
    background-color: #ffffff;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.2s ease-out;
}

#snackbar {
    visibility: hidden;
    min-width: 250px;
    margin-left: -125px;
    background-color: var(--primary);
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 12px 20px;
    position: fixed;
    z-index: 999;
    left: 50%;
    bottom: 30px;
    font-size: 14px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

#snackbar.show {
    visibility: visible;
    -webkit-animation: fadein 0.5s, fadeout 0.5s 2.5s;
    animation: fadein 0.5s, fadeout 0.5s 2.5s;
}

@-webkit-keyframes fadein { from { bottom: 0; opacity: 0; } to { bottom: 30px; opacity: 1; } }
@keyframes fadein { from { bottom: 0; opacity: 0; } to { bottom: 30px; opacity: 1; } }

/* ==========================================
   OPTIMASI RESPONSIVITAS MOBIL UNTUK ISI KONTEN (style.css)
   ========================================== */
@media screen and (max-width: 768px) {
    body {
        padding: 8px; /* Memperkecil jarak tepi halaman di HP */
    }

    .c-data {
        padding: 6px 10px; /* Panel dibuat lebih padat */
        margin-bottom: 8px;
    }

    /* Mengubah form yang tadinya berjejer menjadi vertikal ke bawah */
    form {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    label {
        margin: 2px 0;
    }

    input, select, textarea {
        padding: 8px 10px; /* Ukuran input disesuaikan agar pas dengan sentuhan jari HP */
        font-size: 13px;
        width: 100% !important; /* Memaksa input melebar penuh sesuai layar HP */
    }

    input[type='search'] {
        width: 100% !important; /* Kolom pencarian otomatis penuh di HP */
        margin-bottom: 8px;
    }

    /* Solusi agar tabel data tidak memotong layar HP */
    .table-list {
        display: block;
        width: 100%;
        overflow-x: auto; /* Otomatis memunculkan scroll geser kanan-kiri KHUSUS untuk tabel */
        -webkit-overflow-scrolling: touch;
        border: none;
    }

    .table-list th, 
    .table-list td {
        padding: 8px 10px; /* Padding baris sedikit diperbesar agar mudah ditekan jari */
        font-size: 12px;
    }
}
