:root {
    --primary-color: #ffffff;
    --accent-color: #ffd700;
    /* Gold - High Contrast */
    --accent-secondary: #00e5ff;
    /* Vibrant Cyan */
    --glass-bg: rgba(0, 0, 0, 0.2);
    /* Darker for better white text contrast */
    --glass-border: rgba(255, 255, 255, 0.3);
    --text-color: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.85);
    /* Increased for readability */
    --shadow-heavy: 0 4px 12px rgba(0, 0, 0, 0.5);
    --font-main: 'Outfit', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    color: var(--text-color);
    background: #0f2027;
    /* Fallback */
    background: linear-gradient(135deg, #0f2027, #203a43, #2c5364);
    /* Deep space/ocean gradient */
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
}

/* Dynamic Background container */
.background-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
    background-size: 400% 400%;
    animation: gradientBG 15s ease infinite;
    opacity: 0.6;
}

@keyframes gradientBG {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* Power Save Mode Global Override */
body.power-save,
body.power-save .background-gradient {
    animation: none !important;
    background: #000000 !important;
    /* True black for OLED power saving */
}

body.power-save *,
body.power-save *::before,
body.power-save *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
}

body.power-save .glass-container {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    /* background: rgba(0, 0, 0, 0.8) !important; */
    /* border: 1px solid rgba(255, 255, 255, 0.1) !important; */
}

/* Glass Container */
.glass-container {
    padding: 2rem;
    width: 95%;
    max-width: 450px;
    text-align: center;
    transition: all 0.3s ease;
    animation: fadeIn 0.8s ease-out;
}

/* App Layout */
.app-layout {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (min-width: 601px) {
    .glass-container {
        max-width: 1200px;
        width: 95%;
        text-align: left;
        padding: 4rem;
        /* Default for tablet/web card view */
        min-height: 80vh;
    }

    /* Web (Desktop) specific override to 100vh */
    @media (min-width: 1025px) {
        .glass-container {
            min-height: 100vh;
            margin: 2rem 0;
        }
    }

    .app-layout {
        display: grid;
        grid-template-columns: 1.1fr 0.9fr;
        /* gap: 5rem; */
        align-items: center;
    }

    .info-section {
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .date-display h1 {
        font-size: 6rem;
        font-weight: 800;
        /* Maximize legibility */
        text-shadow: 0 0 40px rgba(255, 255, 255, 0.4), 0 4px 10px rgba(0, 0, 0, 0.5);
    }

    .date-display #current-date {
        font-size: 1.5rem;
        font-weight: 600;
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    }

    .countdown-card {
        padding: 2.5rem;
        margin-top: 2.5rem;
        border-radius: 24px;
    }

    .countdown-card #next-prayer-name {
        font-size: 2.5rem;
    }

    .countdown-card #countdown-timer {
        font-size: 4.5rem;
    }

    .prayer-grid {
        grid-template-columns: 1fr;
        gap: 1.2rem;
    }

    .prayer-item {
        padding: 1.5rem 2rem;
        border-radius: 16px;
    }

    .prayer-item .name {
        font-size: 1.3rem;
    }

    .prayer-item .time {
        font-size: 1.8rem;
    }

    .location-badge {
        font-size: 1.1rem;
        padding: 0.8rem 1.5rem;
    }

    .date-display .hijri {
        font-size: 1.3rem;
        margin-top: 1rem;
    }

    .date-display .qibla-container {
        font-size: 1.1rem;
        padding: 0.5rem 1rem;
    }

    footer {
        font-size: 1rem;
        margin-top: 2rem;
    }

    .date-display {
        align-items: flex-start;
    }

    .date-row {
        justify-content: flex-start;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header */
/* Header Controls & Layout */
.info-section header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

@media (min-width: 601px) {
    .info-section header {
        align-items: flex-start;
        gap: 1.5rem;
    }
}

.header-controls {
    display: flex;
    gap: 0.8rem;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

@media (min-width: 601px) {
    .header-controls {
        justify-content: flex-start;
    }
}

.location-badge,
.athan-btn,
.power-btn,
.brightness-btn {
    display: inline-flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    color: white;
    font-family: inherit;
}

.location-badge:hover,
.athan-btn:hover,
.power-btn:hover,
.brightness-btn:hover {
    background: rgba(0, 0, 0, 0.4);
    transform: translateY(-2px);
}

.athan-btn.enabled,
.power-btn.active,
.brightness-btn.active {
    background: rgba(255, 215, 0, 0.2);
    border: 1px solid var(--accent-color);
}

/* Brightness Overlay */
#brightness-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    pointer-events: none;
    z-index: 9998;
    transition: background-color 0.3s ease;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 1.5rem;
    width: 90%;
    max-width: 350px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header h3 {
    font-size: 1.2rem;
    color: var(--accent-color);
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.6;
}

.close-btn:hover {
    opacity: 1;
}

.intensity-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

#intensity-value {
    color: var(--accent-color);
    font-weight: 700;
}

.premium-slider {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    margin: 1rem 0;
}

.premium-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--accent-color);
    border-radius: 50%;
    border: 3px solid #000;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.4);
}

.modal-hints {
    margin-top: 1.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
    text-align: center;
}

.location-badge .icon,
.power-btn .icon span:first-child {
    margin-right: 0.5rem;
}

.date-display h1 {
    /* font-size: 3.5rem; */
    font-weight: 700;
    letter-spacing: -2px;
    margin-bottom: 0.2rem;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
}

.date-display #current-date {
    font-size: 1.1rem;
    font-weight: 300;
    color: var(--text-muted);
}

.date-display .hijri {
    font-size: 0.9rem;
    font-style: italic;
    color: var(--accent-color);
    margin-top: 0.2rem;
}

.date-display .qibla-container {
    font-size: 0.9rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    margin-top: 0.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.date-display .qibla-container::before {
    content: '🧭';
    /* Compass emoji as icon */
    font-size: 0.8rem;
}

/* Countdown Card */
.countdown-card {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.countdown-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.5s;
    pointer-events: none;
}

.countdown-card:hover::before {
    opacity: 1;
}

.countdown-card .label {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.countdown-card #next-prayer-name {
    font-size: 2rem;
    font-weight: 800;
    color: var(--accent-color);
    margin-bottom: 0.2rem;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.countdown-card #next-prayer-time {
    font-size: 1.3rem;
    color: var(--text-color);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.countdown-card #countdown-timer {
    font-size: 3rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 4px 15px rgba(0, 0, 0, 0.6);
}

/* Prayer Grid */
.prayer-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    /* 2 columns for better balance */
    gap: 1rem;
    margin-bottom: 2rem;
}

.prayer-item {
    /* background: rgba(0, 0, 0, 0.25); */
    padding: 1.2rem;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

.prayer-item.active {
    background: rgba(0, 0, 0, 0.25);

    border: 3px solid var(--accent-color);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
    transform: scale(1.05);
}

.prayer-item.upcoming {
    background: rgba(0, 229, 255, 0.1);
    border: 2px solid var(--accent-secondary);
}

/* For Color Blindness: Text indicator instead of just color */
.prayer-item.active::after {
    content: 'CURRENT';
    position: absolute;
    right: 1rem;
    top: -0.7rem;
    background: var(--accent-color);
    color: #000;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 0.1rem 0.5rem;
    border-radius: 4px;
    letter-spacing: 1px;
}

.prayer-item.upcoming::after {
    content: 'NEXT';
    position: absolute;
    right: 1rem;
    top: -0.7rem;
    background: var(--accent-secondary);
    color: #000;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 0.1rem 0.6rem;
    border-radius: 4px;
    letter-spacing: 1px;
}

.prayer-item:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
}

.prayer-item .name {
    font-weight: 700;
    /* Bolder for visibility */
    font-size: 1.1rem;
    text-shadow: var(--shadow-heavy);
}

.prayer-item .time {
    font-weight: 800;
    /* Maximum bold */
    font-size: 1.2rem;
    color: var(--accent-secondary);
    text-shadow: var(--shadow-heavy);
}

.prayer-item.active .time {
    color: var(--accent-color);
}

/* Skeleton Loading */
.skeleton {
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        opacity: 0.6;
    }

    50% {
        opacity: 0.3;
    }

    100% {
        opacity: 0.6;
    }
}

/* Footer & Controls */
footer {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Modal Body Extras */
.modal-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    line-height: 1.4;
}

.modal-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1.5rem 0;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.modal-divider::before,
.modal-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-divider span {
    margin: 0 1rem;
}

/* Select Styling */
.select-wrapper {
    position: relative;
    width: 100%;
}

#state-select {
    width: 100%;
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: white;
    font-family: var(--font-main);
    font-size: 1rem;
    outline: none;
    cursor: pointer;
    transition: all 0.2s;
    appearance: none;
    -webkit-appearance: none;
}

#state-select:focus {
    border-color: var(--accent-color);
    background: rgba(255, 255, 255, 0.1);
}

.select-wrapper::after {
    content: '▼';
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    font-size: 0.8rem;
    color: var(--accent-color);
}

/* Footer Adjustments */
footer {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2rem;
    padding-bottom: 2rem;
}

/* Retry Button in Modal */
.retry-btn {
    width: 100%;
    background: transparent;
    border: 1px solid var(--accent-secondary);
    color: var(--accent-secondary);
    padding: 0.8rem;
    border-radius: 12px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.retry-btn:hover {
    background: rgba(0, 229, 255, 0.1);
    transform: translateY(-2px);
}

/* Hidden Utility */
.hidden {
    display: none !important;
}

/* Custom Scrollbar for Selector */
#state-select option {
    color: #333;
}

/* Brightness Overlay */
#brightness-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    /* Dimming level */
    pointer-events: none;
    /* Allows interacting with elements below */
    z-index: 9999;
}

/* Responsive */
@media (max-width: 600px) {
    .glass-container {
        width: 100%;
        min-height: 100vh;
        /* Full viewport height for Mobile */
        max-width: 100%;
        border-radius: 0;
        border: none;
        border-left: none;
        border-right: none;
        padding: 1.5rem;
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        /* Start from top */
        overflow-y: auto;
        /* Allow scrolling */
        padding-top: 3rem;
        /* Extra space for top status bar area */
    }

    body {
        align-items: flex-start;
        /* Align top on mobile */
    }

    .date-display h1 {
        font-size: 2.8rem;
    }

    .prayer-grid {
        grid-template-columns: 1fr;
    }

    /* Stack on very small screens */
}

/* Date Navigation */
/* Date Navigation */
.date-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    width: 100%;
}

.date-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    width: 100%;
    margin-top: 0.5rem;
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

.nav-btn:hover {
    color: var(--accent-color);
    background: rgba(255, 255, 255, 0.05);
    transform: scale(1.1);
}

.nav-btn:active {
    transform: scale(0.95);
}

.text-btn {
    background: none;
    border: none;
    color: var(--accent-secondary);
    font-size: 0.8rem;
    margin-top: 0.5rem;
    cursor: pointer;
    text-decoration: underline;
    font-family: var(--font-main);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    transition: all 0.2s;
}

.text-btn:hover {
    color: var(--accent-color);
    background: rgba(255, 255, 255, 0.05);
}

/* Adjustments for container responsiveness */
@media (max-width: 400px) {
    .time-row {
        gap: 0.5rem;
    }

    .date-display h1 {
        font-size: 2.5rem;
    }
}

/* Animations */
@keyframes slideOutLeft {
    to {
        transform: translateX(-20px);
        opacity: 0;
    }
}

@keyframes slideOutRight {
    to {
        transform: translateX(20px);
        opacity: 0;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(20px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-20px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.slide-out-left {
    animation: slideOutLeft 0.2s forwards;
}

.slide-out-right {
    animation: slideOutRight 0.2s forwards;
}

.slide-in-right {
    animation: slideInRight 0.2s forwards;
}

.slide-in-left {
    animation: slideInLeft 0.2s forwards;
}

/* Interactive Swipe container transition */
.glass-container {
    transition: transform 0.1s linear;
    /* Fast response for drag, overridden by script during drag */
}

.glass-container.swiping {
    transition: none;
    /* No lag during drag */
}

.glass-container.reset-swipe {
    transition: transform 0.3s ease-out;
    /* Smooth snap back */
}