/* Base Styles */
:root {
    --primary: #3b82f6;
    --primary-light: #93c5fd;
    --secondary: #f59e0b;
    --danger: #ef4444;
    --success: #10b981;
    --bg-color: #ffffff;
    --text-color: #1a202c;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
}

/* Dark Mode */
.dark {
    --bg-color: #1a202c;
    --text-color: #e2e8f0;
    --card-bg: #2d3748;
    --border-color: #4a5568;
}

body.dark {
    background-color: var(--bg-color);
    color: var(--text-color);
}

/* Calendar Grid */
#calendarGrid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.25rem;
    will-change: transform;
}

/* Calendar Day Cell - Responsive */
.calendar-day {
    position: relative;
    aspect-ratio: 1;
    min-height: 40px;
    padding: 4px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: var(--card-bg);
    transition: all 0.2s ease;
    cursor: pointer;
    font-size: 0.8rem;
    backface-visibility: hidden;
}

@media (min-width: 768px) {
    .calendar-day {
        min-height: 60px;
        padding: 8px;
        font-size: 1rem;
    }
}

/* Date Number Styling */
.day-number {
    font-weight: 700;
    color: #1e40af;
    line-height: 1;
    text-align: center;
}

.dark .day-number {
    color: #93c5fd;
}

/* Bengali and Arabic Dates */
.bengali-date {
    position: absolute;
    bottom: 2px;
    left: 2px;
    font-size: 0.6rem;
    color: #b45309;
    line-height: 1;
}

.arabic-date {
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 0.6rem;
    color: #065f46;
    line-height: 1;
}

.dark .bengali-date {
    color: #fcd34d;
}

.dark .arabic-date {
    color: #6ee7b7;
}

/* Special Day Styles */
.today {
    border: 2px solid var(--primary) !important;
    background-color: #eff6ff;
}

.dark .today {
    background-color: #1e3a8a;
}

.holiday {
    background-color: #fee2e2;
    border: 1px solid #fca5a5;
}

.dark .holiday {
    background-color: #7f1d1d;
    border-color: #b91c1c;
}

.holiday .day-number {
    color: #b91c1c;
    font-weight: bold;
}

.dark .holiday .day-number {
    color: #fecaca;
}

/* Indicators */
.holiday-indicator {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 6px;
    height: 6px;
    background-color: #ef4444;
    border-radius: 50%;
}

.today-indicator {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 6px;
    height: 6px;
    background-color: #3b82f6;
    border-radius: 50%;
}

.event-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 6px;
    height: 6px;
    background-color: var(--primary);
    border-radius: 50%;
}

.weekend {
    background-color: #f0f9ff;
}

.dark .weekend {
    background-color: #1e3a8a;
}

/* Holiday List Styles */
.holiday-month {
    font-weight: 600;
    color: var(--primary);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    margin-bottom: 0.5rem;
}

.holiday-item {
    display: flex;
    align-items: center;
    padding: 0.5rem;
    border-radius: 0.5rem;
    margin-bottom: 0.25rem;
    background-color: var(--card-bg);
}

.national-holiday {
    background-color: #fee2e2;
    color: #991b1b;
    border-left: 3px solid #ef4444;
}

.dark .national-holiday {
    background-color: #7f1d1d;
    color: #fecaca;
    border-left-color: #ef4444;
}

.optional-holiday {
    background-color: #f3e8ff;
    color: #6b21a8;
}

.dark .optional-holiday {
    background-color: #4c1d95;
    color: #ddd6fe;
}

/* Weather Card */
.weather-card {
    background-size: cover;
    background-position: center;
    border: 1px solid rgba(59, 130, 246, 0.2);
    transform: translateZ(0);
    will-change: transform, opacity;
}

.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');
}

/* Button Styles */
.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #2563eb 100%);
    color: white;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Tab System */
.tab-btn {
    padding: 8px 16px;
    border: none;
    background: none;
    cursor: pointer;
    position: relative;
    color: var(--text-color);
}

.tab-btn.active {
    color: var(--primary);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary);
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
}

.dark .modal-content {
    background-color: #2d3748;
    color: var(--text-color);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { transform: translateX(20px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.animate-fadeIn {
    animation: fadeIn 0.3s ease-out;
    backface-visibility: hidden;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Loading overlay */
#loadingOverlay {
    transition: opacity 0.3s ease;
    z-index: 9999;
}

/* Error container */
#errorContainer {
    transition: all 0.3s ease;
    z-index: 9998;
}

/* Responsive Adjustments */
@media (max-width: 640px) {
    .calendar-day {
        min-height: 35px;
        padding: 2px;
    }
    
    .day-number {
        font-size: 0.8rem;
    }
    
    .bengali-date,
    .arabic-date {
        font-size: 0.5rem;
    }
    
    .holiday-indicator,
    .today-indicator,
    .event-indicator {
        width: 4px;
        height: 4px;
    }
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .calendar-day {
        page-break-inside: avoid;
        break-inside: avoid;
    }
    
    .weather-card {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}