/* =========================================
   1. VARIABLES & THEMES
   ========================================= */
:root {
    --emerald-primary: #10b981;
    --emerald-dark: #059669;
    --emerald-light: #d1fae5;
    --gold-accent: #fbbf24;
    --gold-dark: #f59e0b;
    --bg-color: #f4f6f8;
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --card-bg: #ffffff;
    --border-color: #e5e7eb;
    --header-gradient: linear-gradient(135deg, #059669 0%, #10b981 100%);
    --nav-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
    --card-shadow: 0 4px 15px rgba(0, 0, 0, 0.04);
}

body.dark-mode {
    --bg-color: #111827;
    --text-main: #f9fafb;
    --text-muted: #9ca3af;
    --card-bg: #1f2937;
    --border-color: #374151;
    --emerald-light: #064e3b;
    --header-gradient: linear-gradient(135deg, #064e3b 0%, #059669 100%);
    --nav-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5);
    --card-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* =========================================
   2. RESET & BASE LAYOUT
   ========================================= */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    max-width: 100vw;
    overflow-x: hidden; /* Mencegah horizontal scroll secara global */
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    /* Memberikan ruang agar konten tidak tertutup bottom tab (Safe Area) */
    padding-bottom: calc(80px + env(safe-area-inset-bottom)); 
    transition: background-color 0.3s, color 0.3s;
}

.container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1rem;
    box-sizing: border-box;
}

/* =========================================
   3. HEADER & BOTTOM NAV
   ========================================= */
.app-header {
    background: var(--header-gradient);
    color: white;
    padding: 1.25rem 0;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.header-bg-pattern {
    position: absolute;
    bottom: -15px; right: -15px;
    font-size: 6rem;
    color: rgba(255, 255, 255, 0.07);
    transform: rotate(-15deg);
}
.header-bg-pattern::before { content: "\f66f"; font-family: "Font Awesome 6 Free"; font-weight: 900; }

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 2;
}

.logo {
    font-size: 1.4rem;
    font-weight: 700;
    color: white;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.logo i { color: var(--gold-accent); }

.btn-icon {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 40px; height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s;
}
.btn-icon:hover { background: rgba(255,255,255,0.3); }

.bottom-nav {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background-color: var(--card-bg);
    display: flex;
    justify-content: space-around;
    padding: 0.75rem 0.5rem calc(0.75rem + env(safe-area-inset-bottom));
    box-shadow: var(--nav-shadow);
    z-index: 1000;
    transition: background-color 0.3s;
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 500;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    transition: color 0.2s, transform 0.2s;
    flex: 1;
}

.nav-link i { font-size: 1.25rem; }
.nav-link.active { color: var(--emerald-primary); transform: translateY(-3px); }

/* =========================================
   4. CARDS & GENERAL UI ELEMENTS
   ========================================= */
.card {
    background-color: var(--card-bg);
    border-radius: 1rem;
    padding: 1.25rem;
    margin-top: 1.25rem;
    box-shadow: var(--card-shadow);
    transition: background-color 0.3s, border-color 0.3s;
    border: 1px solid var(--border-color);
    word-wrap: break-word;
}

h2 { color: var(--emerald-primary); margin-bottom: 0.5rem; font-size: 1.4rem; font-weight: 700; }
h3 { margin-bottom: 0.5rem; font-size: 1.1rem; color: var(--text-main); font-weight: 600; }

.btn {
    display: inline-flex; justify-content: center; align-items: center; gap: 0.5rem;
    background-color: var(--emerald-primary); color: white;
    padding: 0.75rem 1.25rem; border: none; border-radius: 0.75rem;
    cursor: pointer; font-weight: 600; text-decoration: none;
    transition: background-color 0.2s, transform 0.1s;
    font-family: inherit; font-size: 1rem;
}
.btn:hover { background-color: var(--emerald-dark); }
.btn:active { transform: scale(0.98); }

.btn-gold { background-color: var(--gold-accent); color: #1f2937; }
.btn-gold:hover { background-color: var(--gold-dark); }

.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: 1rem; }
.mb-1 { margin-bottom: 1rem; }
.w-100 { width: 100%; }

/* =========================================
   5. HOME PAGE UI
   ========================================= */
.hero-card {
    background: var(--header-gradient);
    color: white;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1rem;
}
.hero-card h2, .hero-card .text-muted { color: rgba(255,255,255,0.9); }
.clock-display { 
    font-size: 3.5rem; 
    font-weight: 700; 
    color: white; 
    margin: 1.5rem 0; 
    letter-spacing: 2px;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.date-container {
    background: rgba(255,255,255,0.15); 
    backdrop-filter: blur(10px);
    padding: 1rem 1.5rem; 
    border-radius: 1rem; 
    width: 100%;
    max-width: 350px;
    border: 1px solid rgba(255,255,255,0.2);
}

/* =========================================
   6. QURAN PAGE UI (Reading & Sticky Header)
   ========================================= */
.sticky-top-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background-color: var(--card-bg);
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 1rem 1rem 0 0;
}
.back-btn-absolute {
    position: absolute;
    left: 1rem;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}
.back-btn-absolute:hover {
    background: var(--bg-color);
}

.surah-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.surah-card {
    cursor: pointer; display: flex; justify-content: space-between; align-items: center;
    padding: 1rem; border-radius: 1rem; border: 1px solid var(--border-color);
}
.surah-card:hover { border-color: var(--emerald-primary); background-color: var(--emerald-light); }

.ayah-card { 
    width: 100%;
    box-sizing: border-box;
    overflow: hidden; 
    padding: 1.5rem 1rem; 
    border-bottom: 1px solid var(--border-color); 
    border-radius: 0; 
    margin-top:0; 
    box-shadow: none; 
}
.ayah-card:last-child { border-bottom: none; }
.ayah-card.highlight { background-color: var(--emerald-light); border-left: 4px solid var(--emerald-primary); }

.arabic-text { 
    font-family: 'Amiri', serif; 
    font-size: clamp(1.8rem, 6vw, 2.5rem); 
    text-align: right; 
    direction: rtl; 
    line-height: 2.2; 
    margin: 1.5rem 0; 
    color: var(--text-main); 
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: normal;
}
.latin-text { font-style: italic; color: var(--emerald-primary); margin-bottom: 0.5rem; font-size: 1rem;}
.arti-text { color: var(--text-muted); margin-bottom: 1rem; font-size: 0.95rem; }

.ayah-header { display: flex; justify-content: space-between; align-items: center; }
.ayah-number {
    background-color: var(--emerald-primary); color: white;
    width: 35px; height: 35px; display: flex; align-items: center; justify-content: center;
    border-radius: 50%; font-weight: bold; font-size: 0.9rem;
}

/* =========================================
   7. SHOLAT PAGE UI (Search & Countdown)
   ========================================= */
.search-bar-wrapper { display: flex; gap: 0.75rem; width: 100%; }
.search-input {
    flex: 1;
    min-width: 0;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color); 
    border-radius: 0.75rem;
    background: var(--bg-color); 
    color: var(--text-main); 
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.3s;
}
.search-input:focus { outline: none; border-color: var(--emerald-primary); }
.search-btn-fix { flex-shrink: 0; padding: 0.75rem 1.25rem; }

.countdown-box {
    background: var(--card-bg);
    padding: 2rem 1.5rem;
    border-radius: 1.25rem;
    text-align: center;
    margin: 1.5rem 0;
    border: 2px solid var(--emerald-primary);
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.countdown-box > div:first-child {
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--emerald-dark) !important;
    font-size: 0.85rem !important;
    font-weight: 700 !important;
    margin-bottom: 0.5rem;
}
.countdown-time {
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--text-main);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

.jadwal-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 0.75rem; margin-top: 1.5rem; }
.waktu-card {
    text-align: center; padding: 1rem 0.5rem;
    background-color: var(--bg-color); border-radius: 0.75rem;
    border: 1px solid var(--border-color); transition: all 0.3s;
}
.waktu-card.next-prayer {
    background: var(--header-gradient); color: white; border-color: transparent;
    transform: translateY(-5px); box-shadow: 0 10px 15px rgba(16, 185, 129, 0.3);
}
.waktu-card.next-prayer .waktu-name, .waktu-card.next-prayer .waktu-time { color: white; }
.waktu-name { font-weight: 600; color: var(--text-muted); font-size: 0.9rem; margin-bottom: 0.25rem;}
.waktu-time { font-size: 1.3rem; font-weight: 700; color: var(--text-main); }

/* =========================================
   8. MONTHLY CALENDAR UI (Replaced Ibadah)
   ========================================= */
/* ===============================
   KALENDER JAWA (UI FIXED)
   =============================== */

.monthly-calendar-wrapper{
    margin-top: 10px;
}

/* GRID UTAMA */
.monthly-calendar-grid{
    display:grid;
    grid-template-columns:repeat(7,1fr);
    gap:10px;
    width:100%;
    margin-top:10px;
}

/* HEADER HARI */
.month-day-header{
    text-align:center;
    font-weight:700;
    font-size:0.75rem;
    color:var(--text-muted);
    padding:6px 0;
    letter-spacing:0.5px;
}

/* KOTAK TANGGAL */
.month-date-cell{
    background:var(--card-bg);
    border-radius:14px;
    border:1px solid var(--border-color);
    padding:8px 4px;
    min-height:72px;
    display:flex;
    flex-direction:column;
    justify-content:center;
    align-items:center;
    cursor:pointer;
    transition:all .18s ease;
    box-shadow:0 3px 8px rgba(0,0,0,0.06);
}

/* HOVER */
.month-date-cell:hover{
    transform:translateY(-3px);
    border-color:var(--emerald-primary);
}

/* HARI INI */
.month-date-cell.today{
    background:linear-gradient(135deg,#059669,#10b981);
    border:none;
    box-shadow:0 8px 18px rgba(16,185,129,.35);
}

.month-date-cell.today .cell-date{
    color:white;
}

.month-date-cell.today .cell-weton{
    color:#ecfdf5;
}

/* SAAT DIKLIK */
.month-date-cell.selected{
    outline:3px solid var(--gold-accent);
    transform:scale(1.04);
}

/* ANGKA TANGGAL */
.cell-date{
    font-size:1.25rem;
    font-weight:800;
    color:var(--text-main);
    line-height:1;
}

/* WETON */
.cell-weton{
    margin-top:5px;
    font-size:0.65rem;
    font-weight:700;
    letter-spacing:0.7px;
    color:var(--gold-dark);
}

/* INFO TANGGAL DIATAS */
.selected-date-info{
    background:linear-gradient(135deg,#ecfdf5,#d1fae5);
    border:1px solid #6ee7b7;
    border-radius:14px;
    padding:14px;
    margin:14px 0 10px;
    text-align:center;
    animation:fadeIn .25s ease;
}

@keyframes fadeIn{
    from{opacity:0; transform:translateY(-6px);}
    to{opacity:1; transform:translateY(0);}
}

/* MOBILE FIX */
@media(max-width:480px){

    .monthly-calendar-grid{
        gap:6px;
    }

    .month-date-cell{
        min-height:62px;
        padding:6px 2px;
    }

    .cell-date{
        font-size:1.1rem;
    }

    .cell-weton{
        font-size:0.6rem;
    }
}



/* ================= AUDIO AYAT FIX ================= */

/* HAPUS STYLE DEFAULT ANDROID BUTTON */
.play-ayah{
    -webkit-appearance:none;
    appearance:none;
    border:none !important;
    outline:none !important;
}

/* BENTUK TOMBOL */
.play-ayah{
    width:44px;
    height:44px;
    min-width:44px;
    min-height:44px;

    border-radius:50% !important;
    background:linear-gradient(135deg,#10b981,#059669) !important;
    color:#fff !important;

    display:flex !important;
    align-items:center;
    justify-content:center;

    font-size:16px;
    cursor:pointer;

    box-shadow:0 6px 14px rgba(16,185,129,.35);
    transition:all .18s ease;
}

/* ICON DI DALAMNYA */
.play-ayah i{
    pointer-events:none;
}

/* HOVER / TAP */
.play-ayah:active{
    transform:scale(.9);
    box-shadow:0 3px 8px rgba(0,0,0,.25);
}

/* HILANGKAN BORDER ANEH HP */
button:focus{
    outline:none;
}


/* =====================================================
   ABOUT PAGE PROFESSIONAL UI
   ===================================================== */

/* Wrapper */
.about-wrapper{
    padding:1rem;
}

/* ===== HERO ===== */
.about-hero{
    text-align:center;
    padding:28px 16px 26px;
    border-radius:18px;
    background:linear-gradient(135deg,#059669,#10b981);
    color:white;
    margin-bottom:20px;
    position:relative;
    overflow:hidden;
}

/* ornamen islami halus */
.about-hero::after{
    content:"";
    position:absolute;
    width:180px;
    height:180px;
    background:rgba(255,255,255,.08);
    border-radius:50%;
    right:-60px;
    top:-60px;
}

/* logo */
.about-logo{
    width:72px;
    height:72px;
    border-radius:50%;
    background:white;
    color:#059669;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:30px;
    margin:0 auto 12px;
    box-shadow:0 10px 20px rgba(0,0,0,.2);
}

.about-title{
    margin:0;
    font-size:1.7rem;
    font-weight:700;
    color:white;
}

.about-tagline{
    margin-top:6px;
    font-size:.95rem;
    opacity:.95;
}

.about-meaning{
    margin-top:14px;
    font-size:.92rem;
    line-height:1.5;
    background:rgba(255,255,255,.16);
    padding:12px 14px;
    border-radius:12px;
}

/* ===== SECTION ===== */
.about-section{
    margin-top:20px;
}

.about-section h3{
    margin-bottom:8px;
    color:var(--emerald-primary);
    font-size:1.2rem;
}

.about-section p{
    font-size:.95rem;
    color:var(--text-main);
    line-height:1.6;
}

/* ===== FEATURES ===== */
.feature-list{
    display:flex;
    flex-direction:column;
    gap:12px;
    margin-top:12px;
}

.feature-item{
    display:flex;
    gap:14px;
    align-items:flex-start;
    background:var(--card-bg);
    border:1px solid var(--border-color);
    padding:14px;
    border-radius:14px;
    transition:.2s;
}

.feature-item:hover{
    border-color:var(--emerald-primary);
    transform:translateY(-2px);
}

.feature-item i{
    font-size:20px;
    color:var(--emerald-primary);
    min-width:22px;
    margin-top:2px;
}

.feature-item b{
    display:block;
    font-size:1rem;
}

.feature-item small{
    color:var(--text-muted);
    font-size:.85rem;
}

/* ===== DEVELOPER CARD ===== */
.developer-card{
    display:flex;
    gap:14px;
    align-items:flex-start;
    padding:15px;
    border-radius:14px;
    border:1px solid var(--border-color);
    background:var(--card-bg);
}

.dev-avatar{
    width:56px;
    height:56px;
    border-radius:50%;
    background:linear-gradient(135deg,#10b981,#059669);
    color:white;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:22px;
    flex-shrink:0;
}

.dev-name{
    font-weight:700;
    font-size:1.05rem;
}

.dev-role{
    font-size:.85rem;
    color:var(--emerald-primary);
    margin-bottom:4px;
}

.dev-desc{
    font-size:.88rem;
    color:var(--text-muted);
    line-height:1.5;
}

/* ===== SOCIAL BUTTON ===== */
.social-grid{
    display:grid;
    grid-template-columns:1fr;
    gap:12px;
    margin-top:10px;
}

.social{
    display:flex;
    align-items:center;
    justify-content:center;
    gap:10px;
    padding:13px;
    border-radius:14px;
    text-decoration:none;
    color:white;
    font-weight:600;
    font-size:.95rem;
    transition:.18s;
}

.social i{
    font-size:18px;
}

/* warna */
.instagram{ background:#E1306C; }
.github{ background:#24292e; }
.whatsapp{ background:#25D366; }

.social:active{
    transform:scale(.96);
}

/* ===== FOOTER ===== */
.about-footer{
    text-align:center;
    margin-top:26px;
    color:var(--text-muted);
    font-size:.85rem;
}

.about-footer p{
    margin-bottom:3px;
    font-weight:600;
}

/* ===============================
   FIX SEARCH QURAN LEBAR PENUH
   =============================== */

.quran-search-box{
    width:100%;
    position:relative;
    padding:0 4px;
}

/* paksa input memenuhi parent */
.quran-search-box input{
    width:100% !important;
    display:block;
    box-sizing:border-box;

    height:48px;
    padding-left:44px;
    padding-right:14px;

    border-radius:22px;
    border:1.5px solid var(--border-color);
    background:var(--card-bg);

    font-size:.95rem;
}

/* icon posisi stabil */
.quran-search-box i{
    position:absolute;
    left:18px;
    top:50%;
    transform:translateY(-50%);
    pointer-events:none;
}

/* saat difokus */
.quran-search-box input:focus{
    border-color:var(--emerald-primary);
    box-shadow:0 0 0 3px rgba(16,185,129,.18);
}

/* jarak dari judul */
#quran-list-container > .quran-search-box{
    margin:14px 2px 20px 2px;
}