:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #f59e0b;
    --danger: #ef4444;
    --success: #10b981;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
}

html { font-family: 'Hind Siliguri', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
body { text-rendering: optimizeLegibility; }

.weekday {
    text-align: center;
    font-weight: 700;
    padding: .625rem .25rem;
    font-size: .875rem;
    color: var(--primary);
}
.dark .weekday { color: #93c5fd; }

#calendarGrid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: .5rem;
}

.calendar-day {
    position: relative;
    aspect-ratio: 1 / 1;
    min-height: 54px;
    padding: .35rem;
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: var(--card-bg);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease, background-color .18s ease;
    cursor: pointer;
    overflow: hidden;
}

.calendar-day:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(37, 99, 235, .12);
    border-color: #93c5fd;
}

.dark .calendar-day {
    --card-bg: #0f172a;
    --border-color: #1e293b;
}

.calendar-day.empty {
    cursor: default;
    background: transparent;
    border-color: transparent;
    box-shadow: none;
}
.calendar-day.empty:hover { transform: none; }

.day-number {
    font-weight: 800;
    color: #1e40af;
    line-height: 1;
    font-size: 1.05rem;
}
.dark .day-number { color: #bfdbfe; }

.bengali-date {
    position: absolute;
    bottom: .35rem;
    left: .4rem;
    font-size: .62rem;
    color: #b45309;
    line-height: 1;
    max-width: 70%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.arabic-date {
    position: absolute;
    top: .35rem;
    right: .4rem;
    font-size: .62rem;
    color: #047857;
    line-height: 1;
}
.dark .bengali-date { color: #fbbf24; }
.dark .arabic-date { color: #34d399; }

.today {
    border: 2px solid var(--primary) !important;
    background: #eff6ff;
}
.dark .today { background: #172554; }

.selected {
    outline: 3px solid rgba(37, 99, 235, .16);
    border-color: var(--primary) !important;
}

.holiday {
    background: #fff1f2;
    border-color: #fda4af;
}
.dark .holiday {
    background: #3f1114;
    border-color: #7f1d1d;
}
.holiday .day-number { color: #be123c; }
.dark .holiday .day-number { color: #fecdd3; }

.weekend { background: #f0f9ff; }
.dark .weekend { background: #082f49; }

.holiday-indicator,
.today-indicator,
.event-indicator {
    position: absolute;
    width: .45rem;
    height: .45rem;
    border-radius: 999px;
}
.holiday-indicator { top: .35rem; left: .4rem; background: #ef4444; }
.today-indicator { top: .35rem; left: 1rem; background: #2563eb; }
.event-indicator { bottom: .35rem; right: .4rem; background: #7c3aed; }

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #0ea5e9);
    color: #fff;
    font-weight: 700;
    transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 24px rgba(37, 99, 235, .22);
}
.btn-primary:active { transform: translateY(0); }

.tab-btn {
    padding: .75rem 1rem;
    border: 0;
    background: transparent;
    cursor: pointer;
    position: relative;
    color: #64748b;
    font-weight: 700;
    white-space: nowrap;
}
.dark .tab-btn { color: #94a3b8; }
.tab-btn.active { color: var(--primary); }
.dark .tab-btn.active { color: #93c5fd; }
.tab-btn.active::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), #0ea5e9);
    border-radius: 999px;
}

.item-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 1rem;
    padding: .75rem;
}
.dark .item-card {
    background: #0f172a;
    border-color: #1e293b;
}

.holiday-item {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .75rem;
    border-radius: 1rem;
    margin-bottom: .25rem;
}
.national-holiday {
    background: #ffe4e6;
    color: #9f1239;
    border-left: 4px solid #ef4444;
}
.dark .national-holiday {
    background: #4c0519;
    color: #fecdd3;
}

.prayer-box {
    text-align: center;
    padding: .75rem;
    background: #eff6ff;
    border-radius: 1rem;
    border: 1px solid #dbeafe;
}
.dark .prayer-box {
    background: #0f172a;
    border-color: #1e293b;
}

.form-label {
    display: block;
    margin-bottom: .4rem;
    color: #334155;
    font-weight: 700;
}
.dark .form-label { color: #cbd5e1; }

.form-control {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: .875rem;
    padding: .75rem .9rem;
    background: #fff;
    color: #0f172a;
    outline: none;
    transition: border-color .18s ease, box-shadow .18s ease;
}
.form-control:focus {
    border-color: #60a5fa;
    box-shadow: 0 0 0 4px rgba(96, 165, 250, .18);
}
.dark .form-control {
    background: #0f172a;
    border-color: #334155;
    color: #f8fafc;
}

.modal.flex { display: flex !important; }

.weather-card {
    background-size: cover;
    background-position: center;
    background-color: #1e40af;
}
.weather-sunny { background-image: url('../images/weather/sunny.jpg'); }
.weather-rainy { background-image: url('../images/weather/rainy.jpg'); }
.weather-cloudy { background-image: url('../images/weather/cloudy.jpg'); }
.weather-default { background-image: url('../images/weather/default.jpg'); }

#loadingOverlay { transition: opacity .3s ease; }
#errorContainer { transition: all .3s ease; }

@media (max-width: 640px) {
    #calendarGrid { gap: .25rem; }
    .calendar-day {
        min-height: 42px;
        border-radius: .75rem;
        padding: .25rem;
    }
    .day-number { font-size: .9rem; }
    .bengali-date, .arabic-date { font-size: .48rem; }
    .weekday { font-size: .78rem; padding-inline: 0; }
    .holiday-indicator, .today-indicator, .event-indicator { width: .32rem; height: .32rem; }
}

@media print {
    #themeToggle, #greeting, #refreshWeatherBtn, .tab-btn, footer { display: none !important; }
    body { background: #fff !important; color: #000 !important; }
    .calendar-day, .item-card { page-break-inside: avoid; break-inside: avoid; }
}
