/* --- Base Styles & Dark Mode --- */
:root {
    --bg-primary: #121212; /* Hampir hitam, tapi ada sedikit nuansa */
    --text-primary: #E0E0E0; /* Abu-abu muda untuk teks utama */
    --text-secondary: #B0B0B0; /* Abu-abu sedikit lebih gelap */
    --accent-color: #87CEEB; /* Biru langit untuk highlight/aksi */
    --card-bg: #1E1E1E; /* Latar belakang item/kartu */
    --border-color: #333333; /* Warna border halus */
    --error-color: #FF6B6B; /* Merah untuk pesan error */
    --info-color: #4CAF50; /* Hijau untuk pesan info */
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* Align ke atas agar konten tidak terlalu tengah saat pendek */
    min-height: 100vh;
    box-sizing: border-box; /* Include padding in element's total width and height */
}

.container {
    background-color: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
    padding: 30px;
    width: 100%;
    max-width: 420px; /* Batasi lebar container untuk tampilan mobile dan desktop */
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 25px; /* Spasi antar bagian utama */
}

/* --- Header & Zone Selector --- */
.app-header {
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
    margin-bottom: 5px;
}

.date-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.day-name {
    font-size: 1.6em;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

.hijri-date {
    font-size: 1.1em;
    color: var(--text-secondary);
    line-height: 1.2;
}

.zone-selector {
    text-align: center;
}

.zone-selector label {
    display: none; /* Sembunyikan label "Pilih Zon" karena sudah ada di select */
}

.zone-selector select {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 15px;
    font-size: 1em;
    cursor: pointer;
    width: 80%; /* Perkecil ukuran combobox */
    max-width: 250px; /* Batasi lebar maksimal */
    -webkit-appearance: none; /* Hapus default styling browser */
    -moz-appearance: none;
    appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg fill="%23E0E0E0" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/><path d="M0 0h24v24H0z" fill="none"/></svg>'); /* Ikon dropdown kustom */
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 20px;
    transition: border-color 0.3s ease;
}

.zone-selector select:focus {
    outline: none;
    border-color: var(--accent-color);
}

/* --- Prayer Schedule List --- */
.prayer-schedule {
    flex-grow: 1; /* Agar mengambil sisa ruang */
}

.prayer-list {
    display: flex;
    flex-direction: column;
    gap: 15px; /* Spasi antar item sholat */
}

.prayer-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: var(--card-bg); /* Latar belakang item tetap gelap */
    border-radius: 10px;
    border: 1px solid var(--border-color); /* Border halus */
    transition: all 0.3s ease;
}

.prayer-item.active {
    background: linear-gradient(90deg, var(--accent-color) 0%, rgba(135, 206, 235, 0.2) 100%);
    color: #000; /* Teks jadi hitam di latar aksen */
    border-color: var(--accent-color);
    transform: translateY(-3px);
    box-shadow: 0 4px 10px rgba(135, 206, 235, 0.3);
}

.prayer-item.active .prayer-name,
.prayer-item.active .prayer-time,
.prayer-item.active .prayer-icon {
    color: #000; /* Pastikan teks dan ikon tetap hitam */
}


.prayer-name {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.3em;
    font-weight: 500;
    color: var(--text-primary);
}

.prayer-time {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--text-primary);
}

.prayer-icon {
    font-size: 1.4em;
    color: var(--accent-color); /* Warna ikon default */
    min-width: 28px; /* Pastikan ikon memiliki lebar minimum */
    text-align: center;
}

/* --- Messages --- */
.error-message,
.info-message {
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
    margin-top: 20px;
}

.error-message {
    background-color: rgba(255, 107, 107, 0.2);
    color: var(--error-color);
    border: 1px solid var(--error-color);
}

.info-message {
    background-color: rgba(76, 175, 80, 0.2);
    color: var(--info-color);
    border: 1px solid var(--info-color);
}

/* --- Responsiveness (Media Queries) --- */
@media (max-width: 600px) {
    body {
        padding: 15px;
        align-items: flex-start; /* Untuk mobile, mulai dari atas */
    }

    .container {
        padding: 20px;
        gap: 20px;
    }

    .day-name {
        font-size: 1.4em;
    }

    .hijri-date {
        font-size: 1em;
    }

    .zone-selector select {
        width: 90%; /* Sedikit lebih lebar di mobile */
        font-size: 0.95em;
    }

    .prayer-item {
        padding: 12px 18px;
        flex-direction: row; /* Tetap satu baris di mobile */
    }

    .prayer-name {
        font-size: 1.2em;
        gap: 10px;
    }

    .prayer-time {
        font-size: 1.4em;
    }

    .prayer-icon {
        font-size: 1.3em;
    }
}

@media (max-width: 400px) {
    .container {
        padding: 15px;
        border-radius: 8px;
    }
    .day-name {
        font-size: 1.2em;
    }
    .hijri-date {
        font-size: 0.9em;
    }
    .prayer-name {
        font-size: 1.1em;
    }
    .prayer-time {
        font-size: 1.3em;
    }
}

/* Screen reader only class */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}


/* --- Footer Links --- */
.footer-links {
    text-align: center;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.button-link {
    display: inline-block;
    background-color: var(--accent-color);
    color: #000; /* Teks hitam agar kontras dengan accent color */
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.button-link:hover {
    background-color: #6EBFE8; /* Warna aksen sedikit lebih terang saat hover */
    transform: translateY(-2px);
}



/* --- Table Styles (for weekly_monthly.php) --- */
.prayer-schedule-table {
    overflow-x: auto; /* Agar tabel bisa discroll horizontally di mobile */
    width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background-color: var(--card-bg);
    border-radius: 10px;
    overflow: hidden; /* Penting untuk border-radius di tabel */
}

table thead {
    background-color: var(--accent-color);
    color: #000; /* Teks hitam di header tabel */
}

table th,
table td {
    padding: 12px 10px;
    text-align: center;
    border: 1px solid var(--border-subtle); /* <-- Gunakan variabel baru */
    white-space: nowrap;
    font-size: 0.9em;
}

table th {
    font-weight: 600;
}

table tbody tr:nth-child(even) {
    background-color: rgba(0, 0, 0, 0.1); /* Sedikit gelap untuk baris genap */
}

table tbody tr.active-row {
    background-color: rgba(135, 206, 235, 0.3); /* Latar belakang highlight untuk baris hari ini */
    font-weight: bold;
    color: var(--text-primary);
}

/* Mengubah warna teks untuk baris aktif agar tetap terlihat di latar terang */
table tbody tr.active-row td {
    color: var(--text-primary);
}


/* Responsive table adjustments */
@media (max-width: 600px) {
    table {
        display: block;
        width: 100%;
    }

    table thead, table tbody, table th, table td, table tr {
        display: block;
    }

    table thead tr {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }

    table tr {
        border: 1px solid #282828; /* <-- UBAH INI */
        margin-bottom: 10px;
        border-radius: 8px;
        overflow: hidden;
    }

    table td {
        border: none;
        position: relative;
        padding-left: 50%;
        text-align: right;
        font-size: 1em;
    }

    table td:before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        width: 45%;
        padding-left: 10px;
        font-weight: bold;
        text-align: left;
        color: var(--text-secondary);
    }
    
    /* Mengatasi header yang hilang di mode mobile, menambahkan label di td */
    table td:nth-of-type(1):before { content: "Tarikh Masehi"; }
    table td:nth-of-type(2):before { content: "Tarikh Hijri"; }
    table td:nth-of-type(3):before { content: "Imsak"; }
    table td:nth-of-type(4):before { content: "Subuh"; }
    table td:nth-of-type(5):before { content: "Syuruk"; }
    table td:nth-of-type(6):before { content: "Zuhur"; }
    table td:nth-of-type(7):before { content: "Asar"; }
    table td:nth-of-type(8):before { content: "Maghrib"; }
    table td:nth-of-type(9):before { content: "Isyak"; }

    table tbody tr.active-row td {
        background-color: rgba(135, 206, 235, 0.3); /* Latar belakang highlight untuk baris hari ini */
    }
}

/* Page title for consistency */
.page-title {
    font-size: 2em;
    margin-bottom: 15px;
    color: var(--text-primary);
    text-align: center;
}

/* Styles for the new form options in weekly_monthly.php */
.form-options {
    display: flex;
    flex-wrap: wrap; /* Izinkan wrap di layar kecil */
    justify-content: center;
    gap: 15px;
    margin-bottom: 20px;
}

.form-options select {
    width: 45%; /* Dua dropdown dalam satu baris */
    max-width: 200px; /* Batasi lebar */
    min-width: 120px; /* Minimal lebar */
}

@media (max-width: 480px) {
    .form-options select {
        width: 80%; /* Satu dropdown per baris di layar sangat kecil */
        max-width: 250px;
    }
}

.date-range-info {
    text-align: center;
    font-size: 1.1em;
    font-weight: 500;
    color: var(--accent-color);
    margin-top: 10px;
}

.range-display {
    padding: 8px 15px;
    background-color: rgba(135, 206, 235, 0.1);
    border-radius: 8px;
}