:root {
    --primary-bg: #0f172a;
    --card-bg: rgba(255, 255, 255, 0.05);
    --card-border: rgba(255, 255, 255, 0.1);
    --accent-gold: #fbbf24;
    --accent-green: #0cd81d;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --header-bg: rgba(255, 255, 255, 0.05);
    /* Default Dark Header */
}

[data-theme="light"] {
    --primary-bg: #f8fafc;
    /* Slate 50 - Softer than pure white/gray */
    --card-bg: #ffffff;
    --card-border: #e2e8f0;
    --accent-gold: #b45309;
    /* Deep Amber for better readability */
    --accent-green: #059669;
    /* Emerald 600 */
    --text-main: #334155;
    /* Slate 700 - Softer than black */
    --text-muted: #64748b;
    /* Slate 500 */
    --header-bg: linear-gradient(135deg, #10b981, #047857);
    /* Gradient Header */
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--primary-bg);
    /* Islamic Geometric Pattern Overlay - Default (Dark) */
    background-image:
        radial-gradient(circle at 50% 0%, rgba(16, 185, 129, 0.15), transparent 60%),
        url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23fbbf24' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    color: var(--text-main);
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
    transition: background-color 0.3s, color 0.3s;
}

[data-theme="light"] body {
    /* Cleaner background for light mode */
    background-image: none;
}

.container {
    width: 90%;
    max-width: 800px;
    margin: 2rem auto;
    position: relative;
    z-index: 1;
}

/* Header & Nav */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--header-bg);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    border: 1px solid var(--card-border);
    transition: background-color 0.3s;
}

[data-theme="light"] .top-bar {
    box-shadow: 0 10px 15px -3px rgba(16, 185, 129, 0.2), 0 4px 6px -2px rgba(16, 185, 129, 0.1);
    border: none;
}

[data-theme="light"] .logo {
    /* For light mode with green header, keep white text or make it stand out */
    color: white;
    -webkit-text-fill-color: white;
    background: none;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(to right, #fff, var(--accent-gold));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.theme-toggle-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--card-border);
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 1rem;
}

[data-theme="light"] .theme-toggle-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.theme-toggle-btn:hover {
    background: var(--accent-gold);
    color: #000;
    transform: rotate(15deg);
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--card-border);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    color: #fff;
    outline: none;
    transition: all 0.3s;
}

[data-theme="light"] .search-input {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    color: var(--text-main);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.search-input:focus {
    width: 200px;
    border-color: var(--accent-green);
    background: rgba(0, 0, 0, 0.4);
}

/* Main Date Card */
.date-card {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 3rem 2rem;
    text-align: center;
    margin-bottom: 2rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    position: relative;
    overflow: hidden;
}

[data-theme="light"] .date-card {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    background: #ffffff;
    border-color: #f1f5f9;
}

.date-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent-green), var(--accent-gold));
}

.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

[data-theme="light"] .nav-btn {
    background: rgba(0, 0, 0, 0.05);
    color: var(--accent-green);
}

.nav-btn:hover {
    background: var(--accent-green);
    transform: translateY(-50%) scale(1.1);
}

.prev-btn {
    left: 20px;
}

.next-btn {
    right: 20px;
}

.hijri-date {
    font-family: 'Amiri', serif;
    font-size: 3.5rem;
    margin: 0.5rem 0;
    background: linear-gradient(180deg, #fff, #e2e8f0);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

[data-theme="light"] .hijri-date {
    background: linear-gradient(180deg, var(--accent-green), var(--accent-gold));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: none;
}

.gregorian-date {
    font-size: 1.1rem;
    color: var(--accent-gold);
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.clock {
    font-size: 1rem;
    color: var(--text-muted);
    margin-top: 1rem;
    font-family: monospace;
    background: rgba(0, 0, 0, 0.3);
    display: inline-block;
    padding: 0.2rem 0.8rem;
    border-radius: 8px;
}

/* Countdown Section */
.countdown-section {
    background: linear-gradient(to right, rgba(16, 185, 129, 0.1), rgba(16, 185, 129, 0.05));
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1rem;
}

.countdown-info h3 {
    margin: 0;
    color: var(--accent-green);
    font-size: 1.5rem;
}

.countdown-info p {
    margin: 0.5rem 0 0;
    color: var(--text-muted);
    font-size: 1rem;
}

.countdown-timer {
    display: flex;
    gap: 1.5rem;
    margin-top: 1rem;
}

.timer-block {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.timer-value {
    font-size: 2.5rem;
    font-weight: 800;
    color: #fff;
    line-height: 1;
}

[data-theme="light"] .timer-value {
    color: var(--accent-green);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.timer-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 0.5rem;
}

/* Events Section */
.events-grid {
    display: grid;
    gap: 1.5rem;
}

.event-item {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.01) 100%);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.event-item:hover {
    transform: translateY(-5px);
    border-color: var(--accent-gold);
    box-shadow: 0 10px 30px -10px rgba(251, 191, 36, 0.1);
}

.event-item::after {
    content: '\f621';
    /* Mosque icon */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: -20px;
    bottom: -20px;
    font-size: 8rem;
    opacity: 0.03;
    transform: rotate(-15deg);
}

.event-content {
    font-size: 1.2rem;
    line-height: 1.6;
    position: relative;
    z-index: 2;
}

.action-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.share-btn {
    margin-top: 0;
    background: transparent;
    border: 1px solid var(--card-border);
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.share-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* Search Results Modal (Removed) */
#searchResults {
    display: none !important;
}

.view-all-btn {
    display: block;
    width: 100%;
    text-align: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    text-decoration: none;
    border-radius: 12px;
    margin-top: 2rem;
    border: 1px solid var(--card-border);
    transition: all 0.3s;
}

.view-all-btn:hover {
    background: var(--accent-green);
    border-color: var(--accent-green);
}

.today-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent-gold);
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.3s;
    font-size: 0.9rem;
}

.today-btn:hover {
    background: var(--accent-gold);
    color: #000;
}

@media (min-width: 768px) {
    .events-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .hijri-date {
        font-size: 2.5rem;
    }

    .top-bar {
        flex-direction: column;
        gap: 1rem;
    }

    .search-input {
        width: 100%;
    }

    .search-input:focus {
        width: 100%;
    }

    .countdown-section {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .month-title {
        font-size: 2rem;
    }

    .back-btn {
        position: static;
        display: block;
        margin-bottom: 1rem;
        text-align: left;
    }
}

/* Month Events Specific Styles */
.header {
    text-align: center;
    margin-bottom: 3rem;
    position: relative;
}

.back-btn {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 1.2rem;
    transition: color 0.3s;
}

.back-btn:hover {
    color: var(--accent-gold);
}

.month-title {
    font-family: 'Amiri', serif;
    font-size: 3rem;
    color: var(--accent-gold);
    margin: 0;
    text-shadow: 0 0 20px rgba(251, 191, 36, 0.3);
}

.timeline {
    position: relative;
    padding-left: 30px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, var(--accent-green), transparent);
}

.timeline-item {
    margin-bottom: 2rem;
    position: relative;
    opacity: 0;
    animation: slideIn 0.5s forwards;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.timeline-dot {
    position: absolute;
    left: -34px;
    top: 10px;
    width: 10px;
    height: 10px;
    background: var(--accent-gold);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--accent-gold);
}

.event-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.5rem;
    backdrop-filter: blur(10px);
    transition: transform 0.3s;
}

.event-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-green);
}

.event-day {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent-green);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.event-day span {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 400;
}

.event-detail {
    font-size: 1.1rem;
    line-height: 1.6;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.event-detail:last-child {
    border-bottom: none;
}

/* Calendar Modal Styles */
.calendar-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    backdrop-filter: blur(5px);
}

.calendar-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.calendar-modal {
    background: var(--primary-bg);
    padding: 2rem;
    border-radius: 20px;
    width: 90%;
    max-width: 400px;
    border: 1px solid var(--card-border);
    transform: translateY(20px);
    transition: all 0.3s;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.calendar-modal-overlay.active .calendar-modal {
    transform: translateY(0);
}

.calendar-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.calendar-modal-header h3 {
    margin: 0;
    color: var(--accent-gold);
}

.close-modal-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.close-modal-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

[data-theme="light"] .close-modal-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #000;
}

.calendar-options {
    display: grid;
    gap: 1rem;
}

.calendar-option {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
    padding: 1rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    color: var(--text-main);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.calendar-option:hover {
    border-color: var(--accent-green);
    transform: translateX(5px);
    background: rgba(16, 185, 129, 0.1);
}

.calendar-option i {
    width: 24px;
    text-align: center;
    font-size: 1.2rem;
}

.calendar-option .fa-google {
    color: #DB4437;
}

.calendar-option .fa-microsoft {
    color: #0078D4;
}

.calendar-option .fa-yahoo {
    color: #410093;
}

.calendar-option .fa-file-download {
    color: var(--accent-gold);
}

[data-theme="light"] .calendar-modal {
    background: #fff;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .calendar-option {
    background: #f8fafc;
    border-color: #e2e8f0;
}

[data-theme="light"] .calendar-option:hover {
    background: #f0fdf4;
}