/* ===== Reset & Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    background: #f5e6d3;
    color: #2c1810;
    padding: 15px;
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* ===== Header ===== */
header {
    background: linear-gradient(135deg, #8b6914, #c4a35a, #8b6914);
    color: #fff;
    padding: 25px 30px;
    border-radius: 15px;
    margin-bottom: 25px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(139, 105, 20, 0.4);
    position: relative;
    overflow: hidden;
}

header::before {
    content: "𓂀";
    position: absolute;
    font-size: 8em;
    opacity: 0.08;
    right: -20px;
    top: -30px;
}

header h1 {
    font-size: 2.8em;
    letter-spacing: 4px;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.4);
    position: relative;
    z-index: 1;
}

header p {
    font-size: 1.1em;
    opacity: 0.95;
    margin-top: 8px;
    position: relative;
    z-index: 1;
}

/* ===== Today Info ===== */
.today-info {
    background: linear-gradient(135deg, #fff, #fcf5ed);
    padding: 20px 30px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.08);
    border-left: 6px solid #c4a35a;
}

.today-info h2 {
    color: #8b6914;
    font-size: 1.4em;
    margin-bottom: 8px;
}

.today-info .date-detail {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px 20px;
}

.today-info .label {
    font-weight: 600;
    color: #6b4c2a;
}

.today-info .festival-highlight {
    color: #b22222;
    font-weight: 600;
}

.today-info .chrono-highlight {
    color: #6b4c2a;
    font-style: italic;
}

/* ===== Legend ===== */
.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
    margin: 15px 0;
    padding: 12px 20px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8em;
    color: #4a3520;
}

.legend-item .dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid #ccc;
    flex-shrink: 0;
}

.legend-item .dot.major {
    background: #b22222;
}
.legend-item .dot.festival {
    background: #8b6914;
}
.legend-item .dot.minor {
    background: #d4b896;
}
.legend-item .dot.today-dot {
    background: #f5ede0;
    border: 2px solid #c4a35a;
}

/* ===== Controls ===== */
.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    align-items: center;
    justify-content: center;
    background: #fff;
    padding: 12px 20px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.controls button {
    background: #8b6914;
    color: #fff;
    border: none;
    padding: 10px 22px;
    border-radius: 8px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

.controls button:hover {
    background: #6b4f0f;
    transform: scale(1.03);
}

.controls button.secondary {
    background: #6b4c2a;
}

.controls button.secondary:hover {
    background: #4a3520;
}

.controls .month-year {
    font-size: 1.3em;
    font-weight: 700;
    color: #2c1810;
    min-width: 200px;
    text-align: center;
}

.controls .season-indicator {
    font-size: 0.85em;
    padding: 4px 12px;
    border-radius: 20px;
    background: #f0e6d0;
    color: #6b4c2a;
}

/* ===== Calendar Grid ===== */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    background: #dccfc4;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.calendar-grid .day-header {
    background: #8b6914;
    color: #fff;
    padding: 12px 6px;
    text-align: center;
    font-weight: 600;
    font-size: 0.8em;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.calendar-grid .day-cell {
    background: #fff;
    padding: 6px 4px;
    min-height: 95px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    border: 1px solid #f0e8e0;
}

.calendar-grid .day-cell:hover {
    background: #faf3ec;
    transform: scale(1.03);
    z-index: 2;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    border-radius: 4px;
}

.calendar-grid .day-cell .day-number {
    font-size: 1.1em;
    font-weight: 700;
    color: #2c1810;
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
}

.calendar-grid .day-cell .day-number.other-month {
    color: #b0a090;
}

.calendar-grid .day-cell .festival-name {
    font-size: 0.55em;
    color: #8b6914;
    margin-top: 2px;
    line-height: 1.2;
    max-height: 28px;
    overflow: hidden;
    font-weight: 500;
}

.calendar-grid .day-cell .festival-name.holiday {
    color: #b22222;
    font-weight: 700;
}

.calendar-grid .day-cell .festival-name.major {
    color: #8b0000;
    font-weight: 700;
    font-size: 0.6em;
}

.calendar-grid .day-cell .chronokrat {
    font-size: 0.5em;
    color: #6b4c2a;
    margin-top: 2px;
    font-style: italic;
    line-height: 1.1;
    max-height: 20px;
    overflow: hidden;
    opacity: 0.8;
}

.calendar-grid .day-cell .month-marker {
    font-size: 0.5em;
    color: #8b6914;
    font-weight: 600;
    margin-top: 1px;
    background: #f5ede4;
    display: inline-block;
    padding: 0 5px;
    border-radius: 3px;
}

.calendar-grid .day-cell .season-badge {
    font-size: 0.45em;
    color: #fff;
    background: #8b6914;
    padding: 0 4px;
    border-radius: 3px;
    display: inline-block;
}

.calendar-grid .day-cell .season-badge.akhet {
    background: #2a6b8b;
}
.calendar-grid .day-cell .season-badge.peret {
    background: #4a8b2a;
}
.calendar-grid .day-cell .season-badge.shomu {
    background: #c46a2a;
}
.calendar-grid .day-cell .season-badge.epag {
    background: #6b4c8b;
}

.calendar-grid .day-cell.today {
    background: #f5ede0;
    border: 2px solid #c4a35a;
    border-radius: 4px;
    box-shadow: 0 0 15px rgba(196, 163, 90, 0.3);
}

.calendar-grid .day-cell.today .day-number {
    color: #8b6914;
    background: #c4a35a33;
    border-radius: 4px;
}

.calendar-grid .day-cell .festival-dot {
    display: inline-block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #8b6914;
    margin: 1px 1px 0 0;
}

.calendar-grid .day-cell .festival-dot.major {
    background: #b22222;
    width: 7px;
    height: 7px;
}

.calendar-grid .day-cell .festival-dot.minor {
    background: #8b6914;
    width: 4px;
    height: 4px;
}

.calendar-grid .day-cell .netjeru-tag {
    font-size: 0.45em;
    color: #5a3a1a;
    background: #f5ede4;
    padding: 0 4px;
    border-radius: 3px;
    display: inline-block;
    margin-top: 1px;
}

.calendar-grid .day-cell .festival-count {
    font-size: 0.5em;
    color: #8b6914;
    font-weight: 600;
    position: absolute;
    bottom: 2px;
    right: 4px;
}

/* ===== Modal ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #fff;
    padding: 35px;
    border-radius: 20px;
    max-width: 650px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.modal-content .close {
    position: sticky;
    top: 0;
    float: right;
    font-size: 2em;
    cursor: pointer;
    color: #999;
    transition: color 0.3s;
    background: #fff;
    padding: 0 10px;
    z-index: 10;
}

.modal-content .close:hover {
    color: #333;
}

.modal-content h3 {
    color: #8b6914;
    margin-bottom: 15px;
    font-size: 1.6em;
    border-bottom: 2px solid #f0e8e0;
    padding-bottom: 10px;
}

.modal-content .detail-item {
    margin: 8px 0;
    padding: 6px 0;
    border-bottom: 1px solid #f5ede4;
}

.modal-content .detail-item strong {
    color: #6b4c2a;
    display: inline-block;
    min-width: 120px;
}

.modal-content .festival-list {
    margin-top: 10px;
}

.modal-content .festival-list li {
    list-style: none;
    padding: 6px 0 6px 20px;
    font-size: 0.95em;
    border-bottom: 1px solid #f5ede4;
    position: relative;
}

.modal-content .festival-list li::before {
    content: "✦ ";
    color: #c4a35a;
    position: absolute;
    left: 0;
}

.modal-content .festival-list li.major::before {
    content: "⭐ ";
    color: #b22222;
}

.modal-content .festival-list li .fest-desc {
    font-size: 0.85em;
    color: #6b4c2a;
    display: block;
    margin-top: 2px;
    padding-left: 5px;
    border-left: 2px solid #c4a35a33;
}

.modal-content .chrono-detail {
    background: #faf3ec;
    padding: 12px 15px;
    border-radius: 8px;
    margin: 8px 0;
    border-left: 3px solid #c4a35a;
}

.modal-content .netjeru-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin: 8px 0;
}

.modal-content .netjeru-list .netjeru-tag {
    background: #f0e6d0;
    color: #6b4c2a;
    padding: 3px 12px;
    border-radius: 15px;
    font-size: 0.85em;
    font-weight: 500;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.8em;
    }
    .calendar-grid .day-cell {
        min-height: 65px;
        padding: 4px 3px;
    }
    .calendar-grid .day-cell .day-number {
        font-size: 0.85em;
    }
    .calendar-grid .day-cell .festival-name {
        font-size: 0.45em;
        max-height: 20px;
    }
    .calendar-grid .day-cell .chronokrat {
        font-size: 0.4em;
        display: none;
    }
    .calendar-grid .day-header {
        font-size: 0.65em;
        padding: 8px 3px;
    }
    .today-info {
        padding: 15px;
    }
    .today-info .date-detail {
        grid-template-columns: 1fr 1fr;
    }
    .today-info h2 {
        font-size: 1.1em;
    }
    .modal-content {
        padding: 20px;
        max-width: 100%;
    }
    .modal-content h3 {
        font-size: 1.2em;
    }
    .modal-content .detail-item strong {
        min-width: 80px;
    }
    .controls .month-year {
        font-size: 1em;
        min-width: 120px;
    }
    .controls button {
        padding: 6px 14px;
        font-size: 0.85em;
    }
}

@media (max-width: 480px) {
    .calendar-grid {
        gap: 1px;
    }
    .calendar-grid .day-cell {
        min-height: 50px;
        padding: 2px;
    }
    .calendar-grid .day-cell .day-number {
        font-size: 0.7em;
    }
    .calendar-grid .day-cell .festival-name {
        font-size: 0.4em;
        max-height: 16px;
    }
    .calendar-grid .day-cell .month-marker {
        font-size: 0.4em;
    }
    .calendar-grid .day-cell .season-badge {
        font-size: 0.35em;
    }
    .calendar-grid .day-cell .festival-dot {
        width: 3px;
        height: 3px;
    }
    .calendar-grid .day-cell .festival-dot.major {
        width: 5px;
        height: 5px;
    }
    .today-info .date-detail {
        grid-template-columns: 1fr;
    }
    .legend {
        gap: 6px 12px;
        padding: 8px 12px;
    }
    .legend-item {
        font-size: 0.65em;
    }
    .controls .month-year {
        font-size: 0.85em;
        min-width: 80px;
    }
    .controls button {
        padding: 4px 10px;
        font-size: 0.75em;
    }
    header h1 {
        font-size: 1.4em;
    }
    header p {
        font-size: 0.8em;
    }
}
