:root {
    --font-primary: 'Inter', sans-serif;
    --color-text-primary: #ffffff;
    --color-text-secondary: rgba(255, 255, 255, 0.7);
    --color-bg-card: rgba(28, 28, 30, 0.6);
    /* Glassmorphism dark base */
    --color-bg-card-blur: 20px;
    --color-highlight: #E8DCCA;
    /* Sand/Beige color from screenshot */
    --color-highlight-bg: rgba(232, 220, 202, 0.2);
    --color-border: rgba(255, 255, 255, 0.1);
}

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

body {
    font-family: var(--font-primary);
    color: var(--color-text-primary);
    overflow: hidden;
    /* Prevent scrolling due to full screen bg */
    height: 100vh;
    width: 100vw;
    background-color: #000;
}

/* Ad Background */
.ad-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 1.5s ease-in-out;
}

.ad-background.loaded {
    opacity: 1;
}

#ad-link {
    display: block;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

/* Main Container */
.container {
    display: flex;
    align-items: center;
    /* Center vertically */
    justify-content: flex-start;
    /* Align left */
    height: 100%;
    padding: 0 5%;
    /* Left padding */
    pointer-events: none;
    /* Allow clicks to pass through to background */
}

/* Prayer Card */
.prayer-card {
    background: var(--color-bg-card);
    backdrop-filter: blur(var(--color-bg-card-blur));
    -webkit-backdrop-filter: blur(var(--color-bg-card-blur));
    border-radius: 16px;
    padding: 24px;
    width: 320px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    border: 1px solid var(--color-border);
    pointer-events: auto;
    /* Restore clicks for the card itself */
}

/* Card Header */
.card-header {
    margin-bottom: 24px;
}

.header-top-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 13px;
    /* Smaller font as requested */
    color: var(--color-text-secondary);
}

.location-container {
    font-weight: 500;
    cursor: pointer;
}

.separator {
    opacity: 0.5;
}

.date-container {
    cursor: pointer;
    transition: color 0.2s;
}

.date-container:hover {
    color: var(--color-text-primary);
}

.countdown-container {
    font-size: 18px;
    /* Larger for emphasis since it's now the main focus below */
    color: var(--color-text-primary);
}

.highlight-text {
    font-weight: 600;
}

/* Prayer List */
.prayer-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.prayer-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 15px;
    color: var(--color-text-secondary);
    transition: background-color 0.2s;
}

.prayer-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.prayer-item.active {
    background-color: var(--color-highlight-bg);
    color: var(--color-text-primary);
    /* Or keep secondary if design dictates, but usually active is brighter */
}

/* Sunrise specific styles - remove border and interactive states */
.prayer-item.sunrise-item {
    border: none;
}

.prayer-item.sunrise-item:hover {
    background-color: transparent;
}

.prayer-item.sunrise-item.active {
    background-color: transparent;
    color: var(--color-text-secondary);
}

/* Info Icon & Tooltip */
.info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    margin-left: 6px;
    color: var(--color-text-secondary);
    cursor: help;
    position: relative;
    vertical-align: middle;
}

.info-icon:hover {
    color: var(--color-text-primary);
}

.info-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.95);
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    width: 220px;
    text-align: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 100;
    margin-bottom: 8px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    line-height: 1.4;
    font-weight: 400;
}

.info-icon:hover .info-tooltip {
    opacity: 1;
}

/* Arrow for tooltip */
.info-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: rgba(0, 0, 0, 0.95) transparent transparent transparent;
}



/* Timetable Modal */
.timetable-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.timetable-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.timetable-modal {
    background: rgba(30, 30, 30, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transform: scale(1);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.timetable-overlay.hidden .timetable-modal {
    transform: scale(0.95);
}

.timetable-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.timetable-header h2 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--color-text-primary);
    min-width: 120px;
    /* Prevent jumping when text changes */
    text-align: center;
}

.month-nav-container {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    justify-content: center;
    margin-right: 40px;
    /* Balance the close button on the right to approximate center */
}

.timetable-content {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.timetable-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.timetable-table th {
    background: rgba(255, 255, 255, 0.05);
    color: var(--color-text-primary);
    font-weight: 600;
    padding: 12px 8px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    z-index: 1;
}

.timetable-table td {
    padding: 10px 8px;
    color: var(--color-text-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.timetable-table tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.timetable-table tr.today {
    background: var(--color-highlight-bg);
}

.timetable-table tr.today td {
    color: var(--color-text-primary);
    font-weight: 500;
}

.timetable-table th:first-child,
.timetable-table td:first-child {
    padding-left: 16px;
    font-weight: 500;
}

.timetable-table th:last-child,
.timetable-table td:last-child {
    padding-right: 16px;
}

/* Mobile Responsiveness for Timetable */
@media (max-width: 768px) {
    .timetable-overlay {
        padding: 0;
    }

    .timetable-modal {
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
        height: 100%;
    }

    .timetable-content {
        padding: 16px;
    }

    .timetable-table {
        font-size: 12px;
    }

    .timetable-table th,
    .timetable-table td {
        padding: 8px 4px;
    }

    .timetable-table th:first-child,
    .timetable-table td:first-child {
        padding-left: 8px;
    }

    .timetable-table th:last-child,
    .timetable-table td:last-child {
        padding-right: 8px;
    }
}


/* Responsive */
@media (max-width: 768px) {
    .container {
        justify-content: center;
        /* Center on mobile */
        padding: 0;
    }

    .prayer-card {
        width: 90%;
        max-width: 360px;
    }
}

/* Settings Styles */
.icon-btn {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: color 0.2s, background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    color: var(--color-text-primary);
    background-color: rgba(255, 255, 255, 0.1);
}

.header-top-row {
    justify-content: space-between;
    /* Push settings icon to right */
}

.location-date-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Settings Side Panel */
.settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    justify-content: flex-end;
    /* Align to right */
    align-items: stretch;
    /* Full height */
    opacity: 1;
    transition: opacity 0.3s ease;
    padding: 0;
    /* No padding */
}

.settings-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.settings-panel {
    width: 400px;
    height: 100%;
    /* Full height */
    max-height: none;
    background: rgba(30, 30, 30, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0;
    /* Square corners */
    display: flex;
    flex-direction: column;
    transform: translateX(0);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: -5px 0 50px rgba(0, 0, 0, 0.5);
    margin-right: 0;
}

.settings-overlay.hidden .settings-panel {
    transform: translateX(100%);
    /* Slide out completely */
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .settings-overlay {
        padding: 0;
        /* No padding on mobile */
        align-items: flex-end;
        /* Or stretch */
    }

    .settings-panel {
        width: 100%;
        height: 100%;
        max-height: none;
        border-radius: 0;
        border: none;
        margin-right: 0;
        border-left: none;
    }
}

.settings-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.settings-header h2 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 5px;
    transition: color 0.2s;
}

.close-btn:hover {
    color: white;
}

.settings-content {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.setting-group {
    margin-bottom: 25px;
}

.setting-group label {
    display: block;
    margin-bottom: 10px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    font-weight: 500;
}

/* Radio Group */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 10px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.9);
}

.radio-label input[type="radio"] {
    accent-color: var(--highlight-color);
    cursor: pointer;
}

.settings-select {
    width: 100%;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
}

.settings-select:focus {
    border-color: var(--highlight-color);
}

.settings-select option {
    background: #222;
    color: white;
}

.settings-select.hidden {
    display: none;
}

/* Location Input */
.location-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.location-input-group input {
    flex: 1;
    padding: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    outline: none;
}

.location-input-group input:focus {
    border-color: var(--highlight-color);
}

.location-input-group button {
    padding: 0 15px;
    background: var(--color-highlight);
    border: none;
    border-radius: 8px;
    color: #1a1a1a;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.location-input-group button:hover {
    opacity: 0.9;
}

/* Saved Locations List */
.saved-locations-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.saved-location-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.saved-location-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.saved-location-item.active {
    background: rgba(212, 175, 55, 0.2);
    border: 1px solid var(--color-highlight);
}

.remove-loc-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 5px;
}

.remove-loc-btn:hover {
    color: #ff4444;
}

/* Photo Credit */
.photo-credit {
    position: fixed;
    bottom: 20px;
    right: 20px;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.7);
    z-index: 10;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    font-family: 'Inter', sans-serif;
    pointer-events: auto;
}

.photo-credit a {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
    transition: color 0.2s, border-color 0.2s;
}

.photo-credit a:hover {
    color: #fff;
    border-color: #fff;
}

/* Top Right Controls */
.top-right-controls {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
    display: flex;
    gap: 12px;
}

.icon-btn-fixed {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.icon-btn-fixed:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
    color: #fff;
}

#settings-btn:hover {
    transform: rotate(30deg);
}

.icon-btn-fixed svg {
    width: 20px;
    height: 20px;
}

/* Adjust header row since icon is gone */
.header-top-row {
    justify-content: center;
    /* Center the location/date now */
}

/* Mobile adjustment for top controls */
@media (max-width: 768px) {
    .top-right-controls {
        top: 15px;
        right: 15px;
    }

    .icon-btn-fixed {
        width: 36px;
        height: 36px;
    }
}

/* Date Navigation */
.date-nav {
    display: flex;
    gap: 4px;
    margin-left: auto;
    /* Push to right */
}

.nav-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: var(--color-text-primary);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.nav-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
}

.nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    background: transparent;
    border-color: transparent;
}

/* Update header layout to accommodate nav */
.header-top-row {
    justify-content: space-between;
    /* Spread items */
    width: 100%;
}

/* Jamat Time Styles */
.prayer-times-group {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    line-height: 1.2;
}

.jamat-time {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--color-text-primary);
}

.begins-time {
    font-size: 0.7rem;
    color: var(--color-text-secondary);
    font-weight: 400;
}

/* Adjust prayer item layout for dual times */
.prayer-item {
    padding: 12px 16px;
    /* Slightly more padding */
}

/* Main Wrapper */
.main-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

@media (max-width: 768px) {
    .main-wrapper {
        width: 100%;
        align-items: center;
    }
}

/* Time Zone Display */
.timezone-display {
    text-align: center;
    font-size: 12px;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: color 0.2s;
    padding: 4px;
    border-radius: 4px;
    /* Background to ensure readability if outside card */
    background: rgba(0, 0, 0, 0.01);
    backdrop-filter: blur(4px);
    width: fit-content;
    align-self: center;
    /* Center it relative to the card */

    pointer-events: auto;
    /* Required because parent .container has pointer-events: none */
}

.timezone-display:hover {
    color: var(--color-text-primary);
    background: rgba(0, 0, 0, 0.5);
}