/* --- RESET & DASAR --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, sans-serif;
    background-color: #f4f6f8;
    color: #333;
    line-height: 1.6;
}

/* Container Utama */
.container {
    padding: 1.5rem;
    max-width: 1000px;
    margin: auto;
    background: white;
    min-height: 80vh;
}

/* --- NAVBAR RESPONSIF --- */
.navbar {
    background: #0f5132;
    color: white;
    padding: 1rem 1.5rem;
    display: flex;
    flex-wrap: wrap; /* Agar elemen turun otomatis jika layar sempit */
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: white;
    font-size: 1.3rem;
    font-weight: bold;
}

.logo-img {
    height: 35px;
    width: auto;
}

.logo-dashboard {
    height: 8rem;
    width: auto;
    align-items: center;
}

.navbar ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.navbar a {
    color: white;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
}

/* --- BACAAN ARAB RESPONSIF --- */
.arabic {
    font-family: 'Amiri', serif;
    font-size: 1.8rem; /* Ukuran dinamis */
    direction: rtl;
    text-align: right;
    line-height: 2.2;
    color: #1b4332;
    word-break: break-word; /* Mencegah teks meluap di HP */
}

.footer {
    background: #0f5132;
    color: white;
    text-align: center;
    padding: 1rem 0;
    margin-top: 20px;
}

/* --- GRID SURAH (DAFTAR SURAH) --- */
.grid-surah {
    display: grid;
    /* Membuat kolom menyesuaikan otomatis berdasarkan lebar layar */
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); 
    gap: 15px;
}

/* --- MEDIA QUERIES (MEDIA SCREEN) --- */

/* Tampilan Tablet & Layar Sedang (<= 768px) */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column; /* Mengubah susunan logo & menu jadi atas-bawah */
        align-items: flex-start;
    }

    .navbar ul {
        width: 100%;
        justify-content: flex-start;
        overflow-x: auto; /* Memungkinkan scroll samping jika menu panjang */
        padding-bottom: 5px;
    }

    .container {
        padding: 1rem;
    }

    .arabic {
        font-size: 1.5rem; /* Memperkecil ukuran teks Arab di tablet */
    }
}

/* Tampilan Smartphone / HP (<= 480px) */
@media (max-width: 480px) {
    .brand-logo span {
        font-size: 1.1rem;
    }

    .navbar ul {
        gap: 10px;
    }

    .navbar a {
        font-size: 0.85rem;
    }

    .arabic {
        font-size: 1.3rem; /* Ukuran teks Arab pas di layar HP */
        line-height: 2;
    }

    .card {
        padding: 12px;
    }
}

/* --- QURAN LIST UI (MIRIP NU ONLINE) --- */
.quran-header {
    background: #0f5132;
    color: white;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.tab-container {
    display: flex;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 4px;
    margin: 15px 0 10px 0;
}

.tab-btn {
    flex: 1;
    padding: 8px;
    border: none;
    background: transparent;
    color: white;
    font-weight: bold;
    border-radius: 6px;
    cursor: pointer;
}

.tab-btn.active {
    background: white;
    color: #0f5132;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.search-box input {
    width: 100%;
    padding: 10px 15px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
}

/* List Surah Item */
.surah-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.surah-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid #eee;
    text-decoration: none;
    color: #333;
    transition: background 0.2s;
}

.surah-item:hover {
    background: #f8f9fa;
}

.surah-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.surah-number {
    width: 36px;
    height: 36px;
    border: 2px solid #0f5132;
    color: #0f5132;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
}

.surah-info h4 {
    margin: 0;
    font-size: 1.05rem;
    color: #1b4332;
}

.surah-info p {
    margin: 2px 0 0 0;
    font-size: 0.8rem;
    color: #666;
}

.arabic-title {
    font-family: 'Amiri', serif;
    font-size: 1.5rem;
    color: #0f5132;
}

/* Toggle Options */
.toggle-options {
    display: flex;
    gap: 15px;
    margin-top: 15px;
    background: #e9f5ed;
    padding: 10px 15px;
    border-radius: 8px;
}

.switch-label {
    font-size: 0.9rem;
    font-weight: bold;
    color: #0f5132;
    cursor: pointer;
}

.badge-ayat {
    background: #0f5132;
    color: white;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.85rem;
}

.ayat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

/* Container Teks Arab */
.arabic-row {
    margin-bottom: 12px;
}

.arabic {
    font-family: 'Amiri', serif;
    font-size: 1.9rem;
    direction: rtl;
    text-align: right;
    line-height: 2.3;
    color: #1b4332;
    word-break: break-word;
}

/* Nomor Ayat Berdampingan di Teks Arab */
.ayat-number-inline {
    display: inline-block;
    font-family: 'Amiri', serif;
    font-size: 1.6rem;
    color: #0f5132;
    margin-right: 8px;
    vertical-align: middle;
}

/* Tombol Kembali & Header */
.back-btn {
    display: inline-block;
    color: #0f5132;
    text-decoration: none;
    font-weight: bold;
    margin-bottom: 10px;
}

.latin-text {
    color: #555;
    margin-bottom: 6px;
}

.terjemahan-text {
    color: #333;
    font-size: 0.95rem;
}

/* --- MODE STANDAR (KOTAK PER-AYAT) --- */
.ayat-list-mode .ayat-card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    display: block;
}

.ayat-list-mode .arabic-wrapper {
    text-align: right;
    direction: rtl;
    margin-bottom: 10px;
}

.ayat-list-mode .arabic-text {
    font-family: 'Amiri', serif;
    font-size: 1.9rem;
    line-height: 2.3;
    color: #1b4332;
}

.ayat-list-mode .ayat-number-inline {
    font-family: 'Amiri', serif;
    font-size: 1.6rem;
    color: #0f5132;
    margin-right: 5px;
}

.latin-text {
    color: #555;
    margin-bottom: 6px;
    font-size: 0.95rem;
}

.terjemahan-text {
    color: #333;
    font-size: 0.95rem;
}


/* --- MODE MUSHAF (NGAJI BERSAMBUNG KETIKA UNCHECK SEMUA) --- */
.mushaf-mode {
    background: white;
    padding: 25px;
    border-radius: 10px;
    border: 1px solid #ddd;
    direction: rtl;
    text-align: justify;
    line-height: 2.8;
}

/* Mengubah card menjadi inline agar teks Arab menyambung ke samping */
.mushaf-mode .ayat-card {
    display: inline !important;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.mushaf-mode .arabic-wrapper {
    display: inline !important;
}

.mushaf-mode .arabic-text {
    font-family: 'Amiri', serif;
    font-size: 2.1rem;
    color: #1b4332;
}

.mushaf-mode .ayat-number-inline {
    font-family: 'Amiri', serif;
    font-size: 1.8rem;
    color: #0f5132;
    margin: 0 6px;
}

/* Pengaturan Kontrol Ukuran Font */
.font-size-controls {
    display: flex;
    gap: 5px;
    margin-left: auto; /* Memposisikan tombol ke sebelah kanan */
}

.btn-font {
    background: #0f5132;
    color: white;
    border: none;
    padding: 4px 12px;
    font-weight: bold;
    font-size: 0.85rem;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-font:hover {
    background: #198754;
}

.btn-font:active {
    transform: scale(0.95);
}

/* Penyesuaian Responsif Kontrol di Layar HP */
@media (max-width: 600px) {
    .toggle-options {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .font-size-controls {
        margin-left: 0;
        width: 100%;
        justify-content: flex-end;
    }
}

/* Styling Kartu Juz */
.juz-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.juz-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.2s;
}

.juz-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.juz-header {
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    background: #fafafa;
}

.juz-header:hover {
    background: #f0f7f2;
}

.juz-toggle-icon {
    color: #0f5132;
    font-size: 0.8rem;
}

.juz-surah-container {
    border-top: 1px solid #eee;
    background: #fff;
}

.sub-surah-item {
    padding: 10px 20px !important;
    border-bottom: 1px dashed #eee !important;
}

.sub-surah-item:last-child {
    border-bottom: none !important;
}

.sub-number {
    width: 30px !important;
    height: 30px !important;
    font-size: 0.8rem !important;
}

/* Style Item Daftar Juz */
.juz-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.juz-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    text-decoration: none;
    color: #333;
    transition: all 0.2s ease;
}

.juz-item:hover {
    background: #f0f7f2;
    border-color: #0f5132;
}

.juz-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.juz-number {
    width: 38px;
    height: 38px;
    background: #0f5132;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.95rem;
}

.juz-info h4 {
    margin: 0;
    font-size: 1.05rem;
    color: #0f5132;
}

.juz-info p {
    margin: 3px 0 0 0;
    font-size: 0.85rem;
    color: #666;
}

.juz-right {
    font-size: 1.2rem;
    color: #0f5132;
    font-weight: bold;
}

.juz-surah-separator {
    background: #e8f5e9;
    border-left: 5px solid #0f5132;
    padding: 10px 15px;
    margin: 25px 0 15px 0;
    border-radius: 4px;
}

.juz-surah-separator h3 {
    margin: 0;
    color: #0f5132;
    font-size: 1.2rem;
}

/* Card Utama Jadwal Sholat */
.sholat-widget-card {
    background: linear-gradient(135deg, #0f5132 0%, #198754 100%);
    color: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    box-shadow: 0 4px 15px rgba(15, 81, 50, 0.2);
}

.sholat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 15px;
    margin-bottom: 15px;
}

.sholat-header h3 {
    margin: 0;
    font-size: 1.3rem;
}

.sholat-location {
    margin: 4px 0 0 0;
    font-size: 0.85rem;
    opacity: 0.9;
}

/* Hitung Mundur (Countdown Box) */
.next-sholat-box {
    text-align: right;
    background: rgba(255, 255, 255, 0.15);
    padding: 8px 14px;
    border-radius: 8px;
    backdrop-filter: blur(4px);
}

.next-title {
    display: block;
    font-size: 0.75rem;
    opacity: 0.85;
    text-transform: uppercase;
}

.next-name {
    font-size: 1.1rem;
    font-weight: bold;
    color: #ffda6a;
    margin-right: 5px;
}

.next-countdown {
    font-family: monospace;
    font-size: 1.05rem;
    font-weight: bold;
}

/* Grid Waktu Sholat */
.sholat-times-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
}

.sholat-item {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 12px 8px;
    text-align: center;
    transition: all 0.3s ease;
}

.sholat-item.active-sholat {
    background: #ffffff;
    color: #0f5132;
    transform: translateY(-3px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.time-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 4px;
}

.sholat-item.active-sholat .time-label {
    color: #198754;
}

.time-value {
    font-size: 1.1rem;
    font-weight: bold;
}

/* Penyesuaian Layar Smartphone */
@media (max-width: 650px) {
    .sholat-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .next-sholat-box {
        text-align: left;
        width: 100%;
    }

    .sholat-times-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Styling Dropdown Lokasi */
.location-picker {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}

.location-picker label {
    font-size: 0.9rem;
    opacity: 0.9;
}

.location-picker select {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
}

.location-picker select option {
    background: #0f5132;
    color: white;
}

/* Grid Menu 8 Ikon */
.menu-grid {
    background: white;
    border-radius: 16px;
    padding: 18px 10px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px 8px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.05);
    margin-bottom: 16px;
}

.menu-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #444;
    font-size: 0.78rem;
    font-weight: 500;
    text-align: center;
}

.menu-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: #e0f2f1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    margin-bottom: 6px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.04);
}

/* Card Banner */
.ansor-banner {
    background: #e8f5e9;
    border: 1px solid #c8e6c9;
    border-radius: 12px;
    padding: 14px 18px;
    color: #0f5132;
}

.banner-content h4 {
    margin: 0;
    font-size: 0.98rem;
}

.banner-content p {
    margin: 4px 0 0 0;
    font-size: 0.82rem;
    opacity: 0.8;
}

/* Card Utama Kalender */
.calendar-card {
    background: white;
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    margin: 13px auto;
    max-width: 100%;
}

/* Navigasi Bulan */
.calendar-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.month-label {
    font-size: 1.1rem;
    font-weight: bold;
    color: #0f5132;
}

.btn-cal-nav {
    background: #e8f5e9;
    color: #0f5132;
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
}

.btn-cal-nav:hover {
    background: #c8e6c9;
}

/* Header Hari */
.calendar-days-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-weight: bold;
    color: #666;
    margin-bottom: 10px;
    font-size: 0.85rem;
}

/* Grid Tanggal */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
}

.cal-day {
    background: #f9f9f9;
    border-radius: 8px;
    min-height: 52px;
    padding: 6px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
    border: 1px solid #eee;
}

.cal-day.empty {
    background: transparent;
    border: none;
}

.cal-day.today {
    background: #e8f5e9;
    border-color: #0f5132;
}

.cal-day.today .masehi-num {
    color: #0f5132;
    font-weight: bold;
}

.cal-day.sunday .masehi-num {
    color: #d32f2f;
}

.masehi-num {
    font-size: 1.75rem;
    font-weight: 600;
    color: #333;
}

.hijri-num {
    font-size: 0.7rem;
    color: #00796b;
    align-self: flex-end;
}