/* ==================== BASE STYLES ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1800px;
    margin: 0 auto;
    padding: 20px;
}

/* ==================== HEADER ==================== */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

header h1 i {
    margin-right: 10px;
}

.header-left, .header-center, .header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.year-display {
    font-size: 1.8rem;
    font-weight: 700;
    min-width: 100px;
    text-align: center;
}

/* ==================== BUTTONS ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-nav {
    background: rgba(255,255,255,0.2);
    color: white;
    padding: 10px 15px;
}

.btn-nav:hover {
    background: rgba(255,255,255,0.3);
}

.btn-settings {
    background: rgba(255,255,255,0.2);
    color: white;
}

.btn-settings:hover {
    background: rgba(255,255,255,0.3);
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a6fd6;
}

.btn-secondary {
    background: #e2e3e5;
    color: #333;
}

.btn-secondary:hover {
    background: #d6d8db;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-sm {
    padding: 6px 10px;
    font-size: 12px;
}

.btn-edit {
    background: #17a2b8;
    color: white;
}

.btn-edit:hover {
    background: #138496;
}

.btn-delete {
    background: #dc3545;
    color: white;
}

.btn-delete:hover:not(:disabled) {
    background: #c82333;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==================== CALENDAR TABLE ==================== */
.calendar-wrapper {
    overflow-x: auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    margin-bottom: 20px;
}

.calendar-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1200px;
}

.calendar-table th,
.calendar-table td {
    border: 1px solid #e8eaed;
    text-align: center;
    vertical-align: middle;
}

.calendar-table th {
    background: #f8f9fa;
    padding: 12px 5px;
    font-weight: 600;
    color: #495057;
    position: sticky;
    top: 0;
    z-index: 10;
}

.month-header {
    width: 100px;
    min-width: 100px;
}

.day-header {
    width: 35px;
    min-width: 35px;
}

.month-name {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
    padding: 8px 10px;
    text-align: left;
    position: sticky;
    left: 0;
    z-index: 5;
}

.day-cell {
    height: 45px;
    min-height: 45px;
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
    padding: 3px;
}

.day-cell:hover:not(.disabled) {
    background-color: #e8f4fd;
}

.day-cell.disabled {
    background-color: #f0f0f0;
    cursor: not-allowed;
}

.day-cell.today {
    border: 2px solid #667eea;
    background-color: #f0f4ff;
}

.day-cell.weekend:not(.disabled) {
    background-color: #fafafa;
}

.day-cell.weekend:hover:not(.disabled) {
    background-color: #e8f4fd;
}

/* ==================== EVENTS IN CELLS ==================== */
.events-container {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    justify-content: center;
    align-items: center;
    height: 100%;
}

.event-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.15s ease;
    border: 1px solid rgba(0,0,0,0.1);
}

.event-dot:hover {
    transform: scale(1.3);
}

/* ==================== LEGEND ==================== */
.legend {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.legend h3 {
    margin-bottom: 15px;
    color: #495057;
    font-size: 1rem;
}

.legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-color {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: 1px solid rgba(0,0,0,0.1);
}

.legend-label {
    font-size: 14px;
    color: #666;
}

/* ==================== MODAL ==================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    overflow-y: auto;
    padding: 20px;
}

.modal.show {
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    margin: 50px auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    animation: modalSlide 0.3s ease;
}

.modal-sm {
    max-width: 400px;
}

.modal-xs {
    max-width: 350px;
}

@keyframes modalSlide {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e8eaed;
}

.modal-header h2 {
    font-size: 1.25rem;
    color: #333;
}

.close {
    font-size: 28px;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 0 5px;
}

.close:hover {
    color: #333;
}

.modal-content form,
.modal-content > p,
.modal-content > .events-list,
.modal-content > .form-actions {
    padding: 20px;
}

.modal-content form {
    padding-top: 10px;
}

/* ==================== FORMS ==================== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #495057;
    font-size: 14px;
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
    border-top: 1px solid #e8eaed;
}

.form-actions-right {
    display: flex;
    gap: 10px;
}

.color-preview {
    width: 100%;
    height: 30px;
    border-radius: 4px;
    margin-top: 8px;
    border: 1px solid #ddd;
}

.color-input-group {
    display: flex;
    gap: 10px;
}

.color-input-group input[type="color"] {
    width: 50px;
    height: 38px;
    padding: 2px;
    cursor: pointer;
}

.color-input-group input[type="text"] {
    flex: 1;
    text-transform: uppercase;
}

.color-preview-large {
    height: 40px;
    border-radius: 6px;
    margin-top: 10px;
    border: 1px solid #ddd;
}

/* ==================== EVENTS LIST (in modal) ==================== */
.events-list {
    max-height: 300px;
    overflow-y: auto;
}

.events-list .event-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid transparent;
}

.events-list .event-item:hover {
    border-color: #667eea;
}

.events-list .event-item:last-child {
    margin-bottom: 0;
}

.events-list .event-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 1px solid rgba(0,0,0,0.1);
}

.events-list .event-info {
    flex: 1;
    min-width: 0;
}

.events-list .event-title {
    font-weight: 500;
    color: #333;
    margin-bottom: 2px;
}

.events-list .event-dates {
    font-size: 12px;
    color: #666;
}

.events-list .event-type-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
    background: #f0f0f0;
    color: #666;
}

/* ==================== SETTINGS PAGE ==================== */
.settings-content {
    max-width: 800px;
    margin: 0 auto;
}

.section {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    margin-bottom: 20px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e8eaed;
}

.section-header h2 {
    font-size: 1.25rem;
    color: #333;
}

.section-header h2 i {
    margin-right: 10px;
    color: #667eea;
}

.settings-table {
    width: 100%;
    border-collapse: collapse;
}

.settings-table th,
.settings-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e8eaed;
}

.settings-table th {
    font-weight: 600;
    color: #495057;
    background: #f8f9fa;
}

.settings-table tr:last-child td {
    border-bottom: none;
}

.settings-table tr:hover td {
    background: #fafafa;
}

.color-swatch {
    width: 40px;
    height: 28px;
    border-radius: 4px;
    border: 1px solid rgba(0,0,0,0.1);
}

.actions {
    display: flex;
    gap: 8px;
}

.no-data {
    text-align: center;
    color: #666;
    padding: 30px;
}

/* Color suggestions */
.color-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.color-chip {
    padding: 8px 15px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.color-chip:hover {
    border-color: #667eea;
    transform: translateY(-2px);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .header-left, .header-center, .header-right {
        width: 100%;
        justify-content: center;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .calendar-table th,
    .calendar-table td {
        font-size: 12px;
    }

    .day-cell {
        height: 35px;
    }

    .legend-items {
        gap: 10px;
    }
}

/* ==================== UTILITY ==================== */
.text-center {
    text-align: center;
}

.text-muted {
    color: #6c757d;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}
