/* Global Styles Only (reset, layout utama, warna, font, dsb) */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    overflow: hidden;
    height: 100%;
    position: fixed;
    width: 100%;
    margin: 0;
    padding: 0;
}

/* Pastikan scroll container bisa scroll di mobile */
@media (max-width: 768px) {
    .prayer-scroll-container {
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
}

body {
    font-family: 'Amiri', serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: all 0.3s ease;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    padding-bottom: env(safe-area-inset-bottom);
    padding-top: env(safe-area-inset-top);
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    z-index: -1;
}

/* Custom scrollbar styling */
nav::-webkit-scrollbar,
.main-content::-webkit-scrollbar {
    width: 6px;
}

nav::-webkit-scrollbar-track,
.main-content::-webkit-scrollbar-track {
    background: var(--secondary-color);
    border-radius: 3px;
}

nav::-webkit-scrollbar-thumb,
.main-content::-webkit-scrollbar-thumb {
    background: var(--highlight-color);
    border-radius: 3px;
}

nav::-webkit-scrollbar-thumb:hover,
.main-content::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

@media (min-width: 769px) {
    body::before {
        background: var(--bg-color);
    }
}

.app-container {
    display: flex;
    flex: 1;
    max-width: 700px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
    width: 100%;
}

nav {
    background-color: var(--nav-bg);
    color: var(--text-color);
    width: var(--nav-width);
    padding: 20px;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
}

.main-content {
    flex: 1;
    padding: 20px;
    padding-top: 15px;
    transition: all 0.3s ease;
    overflow: hidden;
    height: 100vh;
    background: var(--bg-color);
    color: var(--text-color);
}

@media (max-width: 768px) {
    body::before {
        background: var(--bg-color);
    }
    
    .app-container {
        flex-direction: column;
        max-width: 100%;
        margin: 0;
        height: 100vh;
        display: flex;
        position: relative;
        width: 100%;
    }
    
    nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: auto;
        flex-direction: row;
        justify-content: space-around;
        padding: 10px 5px;
        padding-bottom: calc(10px + env(safe-area-inset-bottom));
        transform: none;
        z-index: 1000;
        overflow: hidden;
        background-color: var(--nav-bg);
        border-top: 2px solid var(--highlight-color);
        box-shadow: 0 -2px 10px var(--primary-color);
    }
    
    .nav-header {
        display: none;
    }
    
    .main-content {
        flex: 1;
        padding: 15px;
        padding-top: 10px;
        padding-bottom: 80px;
        overflow: hidden;
        height: 100vh;
        margin-bottom: 70px;
        background: var(--bg-color);
        color: var(--text-color);
        width: 100%;
    }
    
    /* Kurangi margin top untuk content section */
    .content-section {
        margin-top: 8px;
    }
    
    /* Pastikan content section bisa scroll di mobile */
    .content-section {
        height: 100%;
        overflow: hidden;
    }
    
    /* Khusus untuk prayer section di mobile */
    #prayer-section {
        height: 100vh;
        overflow: hidden;
    }
}

/* iPhone X and newer safe area support */
@supports (padding: max(0px)) {
    @media (max-width: 768px) {
        nav {
            padding-bottom: max(10px, env(safe-area-inset-bottom));
        }
    }
}

.header-container {
    margin: 2px auto 4px auto;
    padding: 0 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 700px;
    width: 100%;
    box-sizing: border-box;
    position: relative;
    z-index: 100;
    background: var(--bg-color);
    margin-bottom: 3px;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    flex-wrap: wrap;
    gap: 10px;
}

.header-top h2 {
    margin: 0;
    flex: 1;
    min-width: 200px;
}

.header-top .clock-container {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-shrink: 0;
}

.header-location {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--secondary-color);
    padding: 2px 5px;
    border-radius: 7px;
    border: 2px solid var(--highlight-color);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    min-height: 32px;
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
}

.header-location .location-info {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
}

.header-location .location-info i {
    color: var(--highlight-color);
    font-size: 0.95rem;
}

.header-location .location-details {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.header-location .location-details span:first-child {
    font-weight: 500;
    font-size: 0.82rem;
    color: var(--text-color);
}

.header-location .location-details-text {
    font-size: 0.7rem;
    color: var(--text-color);
    opacity: 0.8;
}

.header-location-btn {
    background: var(--highlight-color);
    color: var(--primary-color);
    border: none;
    border-radius: 7px;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.85rem;
}

.header-location-btn:hover {
    background: var(--primary-color);
    color: var(--highlight-color);
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.header-location-btn:active {
    transform: scale(0.95);
}

/* Mobile responsive untuk header location */
@media (max-width: 768px) {
    .header-container {
        padding: 0 7px;
        gap: 2px;
        width: 100%;
        max-width: 100%;
        margin-bottom: 3px;
    }
    .header-top {
        flex-direction: row;
        gap: 8px;
        align-items: center;
        justify-content: space-between;
        width: 100%;
    }
    
    .header-top h2 {
        font-size: 1.2rem;
        min-width: auto;
        flex: 1;
    }
    
    .header-top .clock-container {
        gap: 8px;
        flex-shrink: 0;
    }
    
    .header-location {
        padding: 3px 7px;
        border-radius: 6px;
        min-height: 28px;
        width: 100%;
        max-width: 100vw;
        box-sizing: border-box;
    }
    
    .header-location .location-info {
        gap: 4px;
    }
    
    .header-location .location-details span:first-child {
        font-size: 0.75rem;
    }
    
    .header-location .location-details-text {
        font-size: 0.62rem;
    }
    
    .header-location-btn {
        width: 22px;
        height: 22px;
        font-size: 0.75rem;
        border-radius: 6px;
    }
}

.digital-clock {
    position: relative;
    z-index: 101;
    cursor: pointer;
}
.digital-clock:hover {
    /* Hover effect dihapus karena tidak ada background dan border */
}

@media (min-width: 1024px) {
    .header-container {
        margin: 5px auto 2px auto;
        padding: 0 18px;
        max-width: 700px;
        gap: 6px;
        width: 100%;
    }
    
    .header-top {
        flex-direction: row;
        align-items: center;
        gap: 15px;
    }
    
    .header-top h2 {
        font-size: 1.5rem;
        min-width: 250px;
    }
    
    .header-top .clock-container {
        gap: 15px;
    }
    
    .header-location {
        padding: 6px 14px;
        border-radius: 8px;
        min-height: 34px;
        width: 100%;
        max-width: 100vw;
        box-sizing: border-box;
    }
    
    .header-location .location-details span:first-child {
        font-size: 0.9rem;
    }
    
    .header-location .location-details-text {
        font-size: 0.75rem;
    }
    
    .header-location-btn {
        width: 28px;
        height: 28px;
        font-size: 0.9rem;
        border-radius: 8px;
    }
}

.clock-toggle-btn {
    background: var(--secondary-color);
    color: var(--text-color);
    border: 1.5px solid var(--highlight-color);
    border-radius: 6px;
    padding: 4px 12px;
    font-size: 0.95rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
    outline: none;
}
.clock-toggle-btn.active {
    background: var(--highlight-color);
    color: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.10);
}
.clock-toggle-btn:not(.active):hover {
    background: var(--highlight-color);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.clock-toggle-switch {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    height: 32px;
}
.toggle-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-color);
    opacity: 0.7;
    user-select: none;
    transition: color 0.2s, opacity 0.2s;
}
.toggle-label-left {
    margin-right: 4px;
}
.toggle-label-right {
    margin-left: 4px;
}
.toggle-slider {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
    background: var(--secondary-color);
    border-radius: 16px;
    cursor: pointer;
    transition: background 0.3s;
    border: 2px solid var(--highlight-color);
}
.toggle-slider::before {
    content: '';
    position: absolute;
    left: 3px;
    top: 3px;
    width: 16px;
    height: 16px;
    background: var(--highlight-color);
    border-radius: 50%;
    transition: transform 0.3s cubic-bezier(.4,2,.6,1), background 0.3s;
}
#toggleClockInput:checked + .toggle-slider::before {
    transform: translateX(24px);
    background: var(--primary-color);
}
#toggleClockInput:checked + .toggle-slider {
    background: var(--highlight-color);
}
#toggleClockInput:checked ~ .toggle-label-left {
    opacity: 0.5;
}
#toggleClockInput:not(:checked) ~ .toggle-label-right {
    opacity: 0.5;
}
.clock-fade {
    opacity: 1;
    transition: opacity 0.35s cubic-bezier(.4,2,.6,1);
}
.clock-fade.hide {
    opacity: 0;
    pointer-events: none;
}

.clock-toggle-switch-inside {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    margin: 6px 0 0 0;
    position: relative;
    height: 18px;
}
.toggle-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-color);
    opacity: 0.7;
    user-select: none;
    transition: color 0.2s, opacity 0.2s;
    min-width: 28px;
    text-align: center;
}
.toggle-slider-inside {
    position: relative;
    display: inline-block;
    width: 54px;
    height: 8px;
    background: var(--highlight-color);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.3s;
    border: none;
    margin: 0 4px;
}
.toggle-slider-inside::before {
    content: '';
    position: absolute;
    left: 1px;
    top: -3px;
    width: 14px;
    height: 14px;
    background: var(--primary-color);
    border-radius: 50%;
    transition: transform 0.3s cubic-bezier(.4,2,.6,1), background 0.3s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.10);
}
#toggleClockInput:checked + .toggle-slider-inside::before {
    transform: translateX(36px);
    background: var(--secondary-color);
}
#toggleClockInput:checked + .toggle-slider-inside {
    background: var(--highlight-color);
}
#toggleClockInput:checked ~ .toggle-label-left {
    opacity: 0.5;
}
#toggleClockInput:not(:checked) ~ .toggle-label-right {
    opacity: 0.5;
}