/* style.css - Marathi Calendar (Vertical Layout with Red Sunday Header) */

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

body { 
    font-family: 'Noto Sans Devanagari', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    background: #f0f2f5; 
    padding: 20px; 
    color: #333;
}

.calendar-container { 
    max-width: 1100px; 
    margin: 0 auto; 
    background: #ffffff; 
    border-radius: 12px; 
    overflow: hidden; 
    box-shadow: 0 4px 20px rgba(0,0,0,0.08); 
}

/* --- Header Styles --- */
.header { 
    background: white; 
    padding: 20px; 
    text-align: center; 
    border-bottom: 1px solid #e0e0e0;
}

.nav-arrows { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 10px;
}

.nav-arrows h1 {
    font-size: 28px;
    color: #333;
    margin: 0;
    font-weight: 700;
}

.nav-arrows a { 
    text-decoration: none; 
    color: #555; 
    font-weight: 600; 
    font-size: 16px; 
    padding: 8px 16px; 
    background: #f8f9fa; 
    border-radius: 8px; 
    border: 1px solid #e0e0e0;
    transition: all 0.2s ease;
}

.nav-arrows a:hover { 
    background: #e3e6e8; 
    color: #000;
}

.header-info p { margin: 5px 0 0 0; font-size: 14px; }
.header-info a { text-decoration: none; font-weight: bold; color: #f44336; }

/* --- Calendar Structure (Vertical Layout) --- */
.calendar-wrapper { 
    display: flex; 
    flex-direction: row; 
    width: 100%;
}

/* Weekdays Column (Left Side) */
.weekdays { 
    display: grid;
    /* 7 Rows corresponding to Mon-Sun */
    grid-template-rows: repeat(7, 1fr); 
    background: linear-gradient(180deg, #1976d2, #1565c0);
    color: white;
    width: 120px; /* Fixed width for weekdays */
    flex-shrink: 0;
}

.weekday {
    padding: 10px;
    text-align: center;
    font-weight: 700;
    font-size: 18px;
    border-bottom: 1px solid rgba(255,255,255,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    
    /* Equal Height for Rows */
    min-height: 160px; 
    height: 100%;
}

/* --- NEW: Highlight Sunday Header (First Item) --- */
.weekdays .weekday:first-child {
    background-color: #d32f2f; /* Red Background */
    color: #ffffff; /* White Text */
    /* Optional: Remove gradient just for this cell to keep it solid red */
    background-image: none; 
}

.weekday:last-child { 
    border-bottom: none; 
}

/* Days Grid (Right Side) */
.days-grid { 
    flex-grow: 1; 
    display: grid;
    /* 7 Rows to align with weekdays */
    grid-template-rows: repeat(7, 1fr); 
    /* Columns are handled by PHP inline style, default is 5 */
    grid-template-columns: repeat(5, 1fr); 
    grid-auto-flow: column; /* Fill vertical first */
    gap: 8px;
    padding: 8px;
    background: #e0e0e0;
}

/* --- Day Cell Styles --- */
.day-cell { 
    background: white; 
    border-radius: 8px; 
    padding: 10px; 
    
    /* Equal Height for Rows */
    min-height: 160px; 
    height: 100%;
    
    box-shadow: 0 2px 4px rgba(0,0,0,0.1); 
    position: relative; 
    transition: transform 0.2s, box-shadow 0.2s; 
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.day-cell:hover { 
    transform: translateY(-3px); 
    box-shadow: 0 8px 16px rgba(0,0,0,0.15); 
    z-index: 5;
}

/* Empty Cell (Transparent) */
.day-cell.empty-cell {
    background: transparent;
    border: none;
    box-shadow: none;
    pointer-events: none;
}

/* --- Content Styling --- */
.date-header { 
    display: flex; 
    justify-content: space-between; 
    font-size: 11px;
    color: #777;
    margin-bottom: 5px;
}

.tithi-info { display: flex; gap: 5px; }
.sun-icon { color: #ff9800; }
.moon-icon { color: #2196f3; }

.date-number { 
    font-size: 42px; 
    font-weight: 700; 
    color: #1976d2; 
    text-align: center; 
    margin: 5px 0; 
}

.date-info { 
    font-size: 11px; 
    color: #666; 
    line-height: 1.3;
    text-align: center;
}

.paksha { margin-bottom: 2px; }

.festival { 
    background: #fff3e0; 
    color: #e65100; 
    padding: 2px 5px; 
    border-radius: 4px; 
    margin-top: 4px;
    font-weight: 600;
    display: inline-block;
    border: 1px solid #ffe0b2;
}

/* --- Color States --- */

/* Holiday & Sunday (Red) */
.day-cell.holiday, .day-cell.sunday {
    background: #fff5f5;
    border: 2px solid #ef5350;
}
.day-cell.holiday .date-number, .day-cell.sunday .date-number {
    color: #d32f2f !important;
}
.day-cell.holiday .date-info, .day-cell.sunday .date-info {
    color: #c62828;
}

/* Today (Green Highlight) */
.day-cell.today {
    background: #e8f5e9;
    border: 3px solid #4caf50;
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.4);
    transform: scale(1.02);
    z-index: 10;
}
.day-cell.today .date-number {
    color: #2e7d32 !important;
}

/* Faint / Next Month Dates */
.day-cell.faint {
    background-color: #f9f9f9;
    border: 1px dashed #e0e0e0;
    opacity: 0.7;
}
.day-cell.faint .date-number {
    color: #bdbdbd !important;
}
.day-cell.faint .date-info, .day-cell.faint .paksha {
    color: #bdbdbd !important;
}

/* --- Mobile Responsiveness --- */
@media (max-width: 768px) {
    .calendar-container { border-radius: 0; }
    .calendar-wrapper { 
        flex-direction: column; 
        padding: 5px;
    }
    
    .weekdays { 
        width: 100%; 
        grid-template-rows: none; 
        grid-template-columns: repeat(7, 1fr); 
        margin-bottom: 5px;
    }
    
    .weekday { 
        min-height: auto; 
        padding: 10px 2px; 
        font-size: 12px;
        border-bottom: none;
        border-right: 1px solid rgba(255,255,255,0.3);
    }
    
    /* On Mobile, ensure Sunday (First Child) background is handled correctly for horizontal layout */
    .weekdays .weekday:first-child {
        border-radius: 4px 0 0 4px;
    }
    
    .days-grid { 
        grid-template-rows: auto;
        grid-template-columns: repeat(7, 1fr) !important; /* Force 7 cols on mobile */
        grid-auto-flow: row; /* Standard flow */
        gap: 4px; 
        padding: 4px; 
    }
    
    .day-cell { 
        min-height: 80px; /* Smaller height for mobile */
        padding: 5px; 
    }
    
    .date-number { font-size: 20px; margin: 2px 0; }
    .date-header, .date-info { font-size: 9px; }
    .tithi-info span { display: none; } /* Simplify header */
    .festival { font-size: 8px; padding: 1px 3px; }
    
    .nav-arrows h1 { font-size: 20px; }
    .nav-arrows a { font-size: 12px; padding: 5px 10px; }
}


/* चतुर्थी (Orange) */
.day-cell.chaturthi {
    background-color: #fff3e0;
    border: 2px solid #ff9800;
}
.day-cell.chaturthi .date-number { color: #e65100 !important; }
.day-cell.chaturthi::after {
    content: '★ चतुर्थी';
    position: absolute; top: 5px; right: 5px; font-size: 9px; 
    color: #e65100; font-weight: bold;
}

/* एकादशी (Purple) */
.day-cell.ekadashi {
    background-color: #f3e5f5;
    border: 2px solid #9c27b0;
}
.day-cell.ekadashi .date-number { color: #4a148c !important; }
.day-cell.ekadashi::after {
    content: '★ एकादशी';
    position: absolute; top: 5px; right: 5px; font-size: 9px; 
    color: #4a148c; font-weight: bold;
}

/* पौर्णिमा (Yellow/Gold) */
.day-cell.pournima {
    background-color: #fffde7;
    border: 2px solid #fbc02d;
    box-shadow: 0 0 10px rgba(251, 192, 45, 0.3);
}
.day-cell.pournima .date-number { color: #f57f17 !important; }
.day-cell.pournima::after {
    content: '🌕 पौर्णिमा';
    position: absolute; top: 5px; right: 5px; font-size: 9px; 
    color: #f57f17; font-weight: bold;
}

/* अमावस्या (Dark Grey/Black) */
.day-cell.amavasya {
    background-color: #eceff1;
    border: 2px solid #455a64;
}
.day-cell.amavasya .date-number { color: #263238 !important; }
.day-cell.amavasya::after {
    content: '🌑 अमावस्या';
    position: absolute; top: 5px; right: 5px; font-size: 9px; 
    color: #263238; font-weight: bold;
}

/* Holiday & Sunday (Red - Keep existing) */
.day-cell.holiday, .day-cell.sunday {
    border-color: #ef5350; /* Border priority handled by specificity or order */
}