@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&display=swap');

:root {
    --bg-color: #f4fafe;
    --surface-color: #ffffff;
    --text-primary: #1e3a5f;
    --text-secondary: #5e81ac;
    --accent-color: #00b4d8;
    --glow-color: #00d2ff;
    --sunset-glow: #fb8500;
    --border-color: #baddf9;
    --danger-color: #e63946;
    color-scheme: light; 
}

[data-theme="dark"] {
    --bg-color: #0d1b2a;
    --surface-color: #1b263b;
    --text-primary: #ffffff; 
    --text-secondary: #a0b8d6; 
    --accent-color: #60a5fa;
    --glow-color: #00e5ff; 
    --sunset-glow: #ffb703;
    --border-color: #2c3e50;
    color-scheme: dark; 
}

* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
    font-family: 'Nunito', sans-serif; 
    transition: background-color 0.3s, color 0.3s, border-color 0.3s, box-shadow 0.3s; 
}

body {
    background-color: var(--bg-color); 
    color: var(--text-primary);
    display: flex; 
    flex-direction: column; 
    align-items: center;
    min-height: 100vh; 
    padding-bottom: 50px; 
    font-size: 11px; 
}

/* Header presisi (Tinggi Dikurangi) */
.top-bar {
    width: 100vw; 
    max-width: 700px;
    display: flex; 
    flex-direction: column;
    margin: 5px 0; 
    padding: 6px 15px;
    border-bottom: 2px solid var(--glow-color); 
    box-shadow: 0 4px 10px -4px rgba(0, 210, 255, 0.5); 
}

.header-top, .header-bottom { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    width: 100%;
}
.header-bottom { margin-top: 5px; }

h1 { 
    font-size: 1.15rem; 
    font-weight: 700; 
    color: var(--accent-color); 
    text-shadow: 0 0 8px rgba(0, 180, 216, 0.6); 
    letter-spacing: 1px; 
}

.icon-btn, .clean-input { 
    background: transparent; 
    border: none; 
    color: var(--text-primary); 
    outline: none; 
    cursor: pointer; 
    font-weight: 800;
}
.icon-btn { font-size: 1.1rem; }
.clean-input { font-size: 13px; color: var(--accent-color); }
.clean-input option { background-color: var(--surface-color); color: var(--text-primary); }

.profile-section { 
    display: flex; 
    align-items: center; 
    gap: 5px; 
    font-weight: 700; 
    color: var(--text-secondary); 
    font-size: 13px;
}

/* Tombol Tambah 5 Baris */
.btn-add { 
    background: var(--sunset-glow); 
    color: #fff; 
    border: none; 
    padding: 5px 12px; 
    border-radius: 15px; 
    font-weight: 700; 
    font-size: 0.7rem; 
    cursor: pointer; 
    box-shadow: 0 2px 5px rgba(251, 133, 0, 0.3); 
}

/* Container Aplikasi & Tabel */
.table-container { 
    width: 100vw; 
    max-width: 700px; 
    padding: 0 5px; 
    overflow-x: hidden; 
    margin-bottom: 15px; 
}

/* Tabel Presisi dengan Sudut Melengkung */
table { 
    width: 100%; 
    border-collapse: separate; 
    border-spacing: 0;
    background: var(--surface-color); 
    table-layout: fixed; 
    border: 2px solid var(--glow-color); 
    border-radius: 10px; /* Sudut tabel melengkung */
    box-shadow: 0 0 25px rgba(0, 210, 255, 0.4); 
    overflow: hidden;
}

th, td {
    border-bottom: 2px solid var(--glow-color); 
    border-right: 2px solid var(--glow-color); 
    box-shadow: inset 0 0 10px rgba(0, 210, 255, 0.1); 
    padding: 6px 2px; 
    text-align: center; 
    vertical-align: middle;
    font-size: 11px; 
}

/* Hilangkan border kanan ujung & bawah ujung agar radius terlihat sempurna */
th:last-child, td:last-child { border-right: none; }
tbody tr:last-child td { border-bottom: none; }

th { 
    background: rgba(0, 180, 216, 0.15); 
    color: var(--text-secondary); 
    font-size: 0.7rem; 
    font-weight: 800; 
    white-space: nowrap;
}

/* Lebar Proporsional 100vw HP */
th:nth-child(1), td:nth-child(1) { width: 28%; } /* Tgl Pemberian */
th:nth-child(2), td:nth-child(2) { width: 28%; } /* Tgl Berikutnya */

/* Khusus Kolom Catatan (Text Wrapping) */
th:nth-child(3), td:nth-child(3) { 
    width: 34%; 
    white-space: normal; 
    word-break: break-word; 
    vertical-align: middle;
} /* Catatan */

th:nth-child(4), td:nth-child(4) { width: 10%; } /* Aksi */

/* Input & Textarea di dalam Data */
table input, table textarea {
    width: 100%; 
    border: none; 
    background: transparent; 
    color: var(--text-primary);
    text-align: center; 
    font-size: 11px; 
    font-family: inherit; 
    outline: none;
    border-radius: 5px; /* Melengkung kecil pada input */
    padding: 4px 2px;
}

/* Khusus Textarea Catatan */
table textarea {
    resize: none; /* Cegah user tarik ukuran manual */
    overflow: hidden; /* Sembunyikan scrollbar */
    min-height: 24px;
    line-height: 1.3;
}

table input:focus, table textarea:focus { 
    background: rgba(0, 180, 216, 0.15); 
}

/* Perbaikan icon kalender di mode gelap */
input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}
input[type="date"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}
[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
}

/* Tombol Aksi (Hapus) */
.btn-delete { 
    background: transparent; 
    border: none; 
    font-size: 0.9rem; 
    cursor: pointer; 
    color: var(--danger-color); 
}

/* Footer dengan Glow Tebal */
footer { 
    position: fixed; 
    bottom: 0; 
    left: 0; 
    width: 100%; 
    background: var(--surface-color); 
    border-top: 2px solid var(--glow-color); 
    padding: 8px; 
    text-align: center; 
    box-shadow: 0 -5px 20px rgba(0, 210, 255, 0.25); 
    z-index: 100;
}
footer p {
    font-size: 0.65rem; 
    color: var(--text-secondary);
    font-weight: 600;
    margin: 0;
}

/* Custom Popup Tema Pantai (Ditebalkan juga nyalanya) */
.modal-overlay { 
    position: fixed; 
    top: 0; left: 0; 
    width: 100vw; height: 100vh; 
    background: rgba(13, 27, 42, 0.7); 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    z-index: 9999; 
    backdrop-filter: blur(3px); 
}

.modal-box { 
    background: var(--surface-color); 
    padding: 20px; 
    border-radius: 12px; 
    width: 85%; 
    max-width: 350px; 
    text-align: center; 
    border: 2px solid var(--glow-color); 
    box-shadow: 0 10px 30px rgba(0,210,255,0.4); 
    animation: popIn 0.3s ease-out;
}

@keyframes popIn { 
    from { transform: scale(0.8); opacity: 0; } 
    to { transform: scale(1); opacity: 1; } 
}

.modal-box p { 
    font-size: 0.85rem; 
    margin-bottom: 20px; 
    font-weight: 600; 
    color: var(--text-primary); 
}

.modal-actions { 
    display: flex; 
    justify-content: center; 
    gap: 10px; 
}

.modal-actions button { 
    padding: 8px 20px; 
    border: none; 
    border-radius: 8px; 
    font-weight: 700; 
    cursor: pointer; 
    font-size: 0.8rem; 
}

#btnConfirm { 
    background: var(--accent-color); 
    color: #fff; 
}

#btnCancel { 
    background: transparent; 
    border: 1px solid var(--text-secondary) !important; 
    color: var(--text-secondary); 
}

.hidden { 
    display: none !important; 
}