/* Reset dan Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: linear-gradient(135deg, #0c2461 0%, #1e3799 100%);
    color: #333;
    min-height: 100vh;
    padding: 20px;
}

.container {
    /* max-width: 1800px; */
    margin: 0 auto;
}

/* Controls */
.controls {
    background-color: white;
    border-radius: 15px;
    padding: 20px 30px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.header-section h1 {
    color: #0c2461;
    font-size: 2.2rem;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-section h2 {
    color: #495057;
    font-weight: normal;
    font-size: 1.2rem;
}

.controls-right {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: flex-end;
}

/* Layout Selector */
.layout-selector {
    display: flex;
    align-items: center;
    gap: 15px;
}

.layout-selector label {
    font-weight: bold;
    color: #0c2461;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.columns-select {
    padding: 10px 15px;
    font-size: 1.1rem;
    border: 2px solid #0c2461;
    border-radius: 8px;
    background-color: white;
    color: #0c2461;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
}

.columns-select:hover {
    border-color: #1e3799;
    background-color: #f8f9fa;
}

.year-selector {
    display: flex;
    align-items: center;
    gap: 15px;
}

.year-selector label {
    font-weight: bold;
    color: #0c2461;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.year-input-group {
    display: flex;
    align-items: center;
    gap: 5px;
}

#yearInput {
    padding: 10px 15px;
    font-size: 1.1rem;
    border: 2px solid #0c2461;
    border-radius: 8px;
    width: 120px;
    text-align: center;
    font-weight: bold;
}

.year-nav-btn {
    background-color: #0c2461;
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.3s;
}

.year-nav-btn:hover {
    background-color: #1e3799;
    transform: translateY(-2px);
}

.download-buttons {
    display: flex;
    gap: 10px;
}

.control-btn {
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    border: none;
}

.download-btn {
    background-color: #0c2461;
    color: white;
}

.download-btn:hover {
    background-color: #1e3799;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.refresh-btn {
    background-color: #27ae60;
    color: white;
}

.refresh-btn:hover {
    background-color: #2ecc71;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Calendar Fullscreen */
.calendar-fullscreen {
    background-color: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.25);
    min-height: calc(100vh - 220px);
    position: relative;
    overflow-x: auto; /* Allow horizontal scroll if needed */
}

/* Loading Indicator */
.loading {
    text-align: center;
    padding: 60px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #e0e0e0;
    border-top: 5px solid #0c2461;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading p {
    font-size: 1.2rem;
    color: #0c2461;
    font-weight: 500;
}

/* Months Container */
.months-container {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 25px;
}

/* Month Card */
.month {
    background-color: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s, box-shadow 0.3s;
    min-width: 250px; /* Prevent boxes from becoming too thin */
}

.month:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.month-name {
    text-align: center;
    margin-bottom: 15px;
    color: #0c2461;
    font-size: 1.4rem;
    padding-bottom: 10px;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
}

/* Calendar Grid */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    margin-bottom: 15px;
}

.day-header {
    text-align: center;
    font-weight: bold;
    color: #495057;
    padding: 8px 0;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.day {
    text-align: center;
    padding: 10px 0;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s;
    position: relative;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: default;
    border: 1px solid transparent;
}

.day:hover {
    background-color: #e9ecef;
    transform: scale(1.05);
}

.empty {
    visibility: hidden;
}

/* Day Colors */
.sunday {
    color: #e74c3c;
    background-color: #ffeaea;
}

.saturday {
    color: #1a5276;
    background-color: #e8f4fc;
}

.holiday {
    color: #e74c3c;
    background-color: #ffeaea;
    font-weight: bold;
    border-color: #e74c3c;
}

.holiday::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 6px;
    background-color: #e74c3c;
    border-radius: 50%;
}

.cuti-bersama {
    border: 2px dashed #3498db;
    background-color: #e8f4fc;
}

.sunday.holiday::after {
    background-color: #ffffff;
}

/* Holiday Notes */
.holiday-notes {
    margin-top: auto;
    padding-top: 15px;
    border-top: 1px dashed #adb5bd;
    font-size: 0.8rem;
    /* Hapus max-height dan overflow-y */
    max-height: none !important;
    overflow-y: visible !important;
    /* Tambahkan auto height */
    height: auto;
}

.holiday-note-category {
    font-weight: bold;
    margin-bottom: 5px;
    color: #e74c3c;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.holiday-note-category.cuti-category {
    color: #3498db;
}

.holiday-note {
    padding: 4px 0;
    color: #495057;
    display: flex;
    align-items: flex-start;
}

.holiday-note-date {
    font-weight: bold;
    min-width: 35px;
    color: #e74c3c;
}

.holiday-note.cuti-note .holiday-note-date {
    color: #3498db;
}

.holiday-note-name {
    flex: 1;
    margin-left: 8px;
    line-height: 1.4;
}

/* Legend */
.legend {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 25px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #dee2e6;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
}

.legend-color {
    width: 18px;
    height: 18px;
    border-radius: 4px;
}

.legend-sunday {
    background-color: #ffeaea;
    border: 2px solid #e74c3c;
}

.legend-saturday {
    background-color: #e8f4fc;
    border: 2px solid #1a5276;
}

.legend-holiday {
    background-color: #ffcccc;
    border: 2px solid #e74c3c;
}

.legend-cuti-bersama {
    background-color: #e8f4fc;
    border: 2px dashed #3498db;
}

/* Status Bar */
.status-bar {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #0c2461;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    z-index: 100;
    display: none;
    max-width: 400px;
    animation: slideInUp 0.3s ease;
}

@keyframes slideInUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 1600px) {
    /* Allow user's column choice */
}

@media (max-width: 1200px) {
    /* Allow user's column choice, just adjust controls */
    
    .controls {
        flex-direction: column;
        text-align: center;
        gap: 25px;
    }
    
    .controls-right {
        align-items: center;
        width: 100%;
    }
    
    .year-selector {
        justify-content: center;
    }
    
    .controls-right {
        flex-direction: row;
        justify-content: center;
        gap: 20px;
        flex-wrap: wrap;
    }
    
    .year-selector,
    .layout-selector {
        flex: 1;
        min-width: 200px;
    }
}

@media (max-width: 768px) {
    /* For mobile, suggest max 2 columns but don't force it */
    .months-container {
        gap: 15px;
    }
    
    .month {
        min-width: 200px; /* Smaller min-width for mobile */
    }
    
    .calendar-fullscreen {
        padding: 15px;
    }
    
    .controls {
        padding: 15px;
    }
    
    .header-section h1 {
        font-size: 1.8rem;
    }
    
    .download-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .control-btn {
        width: 100%;
        justify-content: center;
    }
    
    .legend {
        gap: 15px;
    }
    
    .legend-item {
        font-size: 0.8rem;
    }
    
    .year-selector,
    .layout-selector {
        min-width: 100%;
    }
}

@media (max-width: 480px) {
    /* For very small mobile, force 1 column only */
    .months-container {
        grid-template-columns: 1fr !important;
    }
    
    .month {
        min-width: auto; /* Allow full width on very small screens */
    }
    
    body {
        padding: 10px;
    }
    
    .header-section h1 {
        font-size: 1.5rem;
    }
    
    .month-name {
        font-size: 1.2rem;
    }
    
    .day {
        padding: 8px 0;
        font-size: 0.8rem;
        min-height: 35px;
    }
    
    .legend {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
}

/* Scrollbar Styling */
.holiday-notes::-webkit-scrollbar {
    width: 6px;
}

.holiday-notes::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.holiday-notes::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.holiday-notes::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}