@import url('https://fonts.googleapis.com/css2?family=Lexend:wght@100..900&display=swap');

:root {
    --tg-theme-primary: #582900;
}

.calendar {
    background: white;
    border-radius: 10px;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
    width: 800px;
    padding: 20px;
    font-family: "Lexend", sans-serif;
    font-optical-sizing: auto;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 2px solid #f3f4f6;
    flex-wrap: wrap; /* Allow wrapping for smaller screens */
    gap: 10px; /* Space between items when wrapping */
}

.month-selector {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap; /* Allow wrapping for select and button */
    margin-left: auto; /* Push to the right */
}

.month-year {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    flex-grow: 1; /* Allows month-year to take available space */
}

.gregorian-month {
    font-size: 1em;
    color: #6B7280;
    font-style: italic;
}

.traditional-month {
    font-size: 1.5em;
    font-weight: bold;
    color: #374151;
}

.nav-button {
    background: none;
    border: none;
    font-size: 1.2em;
    cursor: pointer;
    color: #6b7280;
    padding: 5px 10px;
    transition: color 0.3s;
}

.nav-button:hover {
    color: #374151;
}

.weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr); /* Default 7 columns */
    text-align: center;
    font-weight: bold;
    color: #6b7280;
    margin: 10px 0;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 5px;
}

.weekdays.eight-day-grid { /* New class for 8-day grid */
    grid-template-columns: repeat(8, 1fr);
}

.weekdays .symbol {
    color: #9CA3AF;
    font-size: 0.8em;
}

.days {
    display: grid;
    grid-template-columns: repeat(7, 1fr); /* Default 7 columns */
    gap: 5px;
}

.days.eight-day-grid { /* New class for 8-day grid */
    grid-template-columns: repeat(8, 1fr);
}

.day {
    min-height: 80px;
    padding: 5px;
    border: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    gap: 5px;
    transition: all 0.3s ease;
}

.day .date {
    font-weight: bold;
    color: #374151;
}

.day .weekday {
    font-size: 0.9em;
    color: #9CA3AF;
    font-weight: bold;
}

.day .event {
    font-size: 0.8em;
    color: #6B7280;
    background: #F3F4F6;
    padding: 2px 4px;
    border-radius: 4px;
    margin-top: auto;
}

.today {
    background: #EFF6FF;
    border: 2px solid var(--tg-theme-primary);
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.3);
    transform: scale(1.03);
    position: relative;
    animation: todayPulse 2s infinite;
}

@keyframes todayPulse {
    0% {
        box-shadow: 0 0 12px rgba(59, 130, 246, 0.3);
    }
    50% {
        box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
    }
    100% {
        box-shadow: 0 0 12px rgba(59, 130, 246, 0.3);
    }
}

.today::after {
    content: "Aujourd'hui";
    position: absolute;
    top: -10px;
    right: -10px;
    background: var(--tg-theme-primary);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7em;
    font-weight: bold;
}

.other-month {
    background: #F9FAFB;
    color: #D1D5DB;
}

/* Ensure colored days in other-month still look good */
.other-month.colored-Nam,
.other-month.colored-Cang,
.other-month.colored-Maah,
.other-month.colored-Taah,
.other-month.colored-Mun,
.other-month.colored-Laah,
.other-month.colored-Faah,
.other-month.colored-Ngap {
    opacity: 0.6; /* Slightly fade out colored other-month days */
    border-color: transparent; /* Remove border for aesthetic */
}

select {
    padding: 5px;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
}

.search-button {
    background: var(--tg-theme-primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
}

.search-button:hover {
    background: var(--tg-theme-primary);
}

.event {
    background: #EEF2FF !important;
    border-left: 3px solid var(--tg-theme-primary);
    padding: 4px 8px !important;
    margin: 2px 0;
    border-radius: 0 4px 4px 0;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.event a {
    color: #3B82F6;
    text-decoration: none;
    transition: color 0.3s;
}

.event a:hover {
    color: #2563EB;
    text-decoration: underline;
}

/* Add new styles for colored days */
.day.colored-Nam { background-color: #FF4444; color: white; }
.day.colored-Cang { background-color: #FF8C00; color: white; }
.day.colored-Maah { background-color: #FFD700; }
.day.colored-Taah { background-color: #4CAF50; color: white; }
.day.colored-Mun { background-color: #2196F3; color: white; }
.day.colored-Laah { background-color: #4B0082; color: white; }
.day.colored-Faah { background-color: #9C27B0; color: white; }
.day.colored-Ngap { background-color: #333333; color: white; }

.day.colored-Nam .weekday,
.day.colored-Cang .weekday,
.day.colored-Maah .weekday,
.day.colored-Taah .weekday,
.day.colored-Mun .weekday,
.day.colored-Laah .weekday,
.day.colored-Faah .weekday,
.day.colored-Ngap .weekday,
.day.colored-Nam .date,
.day.colored-Cang .date,
.day.colored-Maah .date,
.day.colored-Taah .date,
.day.colored-Mun .date,
.day.colored-Laah .date,
.day.colored-Faah .date,
.day.colored-Ngap .date {
    color: inherit;
}
