/* HolidaySicknessCalendar Styles */

.hs-calendar-container {
    padding: 1.5rem;
    color: #372562;
}

/* Loading */
.hs-loading {
    text-align: center;
    padding: 3rem 1rem;
}

.hs-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #ec5f59;
    border-radius: 50%;
    animation: hs-spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

.hs-loading p {
    color: #372562;
    font-size: 0.95rem;
}

/* Error */
.hs-error {
    background: #fee2e2;
    color: #dc2626;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.hs-retry-btn {
    background: #dc2626;
    color: white;
    border: none;
    padding: 0.4rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    white-space: nowrap;
}

.hs-retry-btn:hover {
    background: #b91c1c;
}

/* Toolbar */
.hs-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.hs-year-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.hs-year-label {
    font-weight: 600;
    font-size: 0.9rem;
    color: #372562;
}

.hs-year-dropdown {
    padding: 0.45rem 0.75rem;
    border: 2px solid #97c1bc;
    border-radius: 6px;
    font-size: 0.9rem;
    color: #372562;
    background: white;
    cursor: pointer;
}

.hs-year-dropdown:focus {
    outline: none;
    border-color: #ec5f59;
}

.hs-readonly-badge {
    background: #f3f0ff;
    color: #7c3aed;
    padding: 0.4rem 0.85rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid #ddd6fe;
}

.hs-bulk-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #fffbeb;
    padding: 0.4rem 0.85rem;
    border-radius: 6px;
    border: 1px solid #fdc758;
    font-size: 0.85rem;
    color: #372562;
}

.hs-bulk-apply-btn {
    background: #ec5f59;
    color: white;
    border: none;
    padding: 0.3rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
}

.hs-bulk-apply-btn:hover:not(:disabled) {
    background: #D4605A;
}

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

.hs-bulk-cancel-btn {
    background: transparent;
    color: #666;
    border: 1px solid #ccc;
    padding: 0.3rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
}

.hs-bulk-cancel-btn:hover {
    background: #f5f5f5;
}

/* Summary Panel */
.hs-summary-panel {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.hs-summary-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    border-radius: 8px;
    background: white;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.hs-summary-holiday {
    border-left: 4px solid #22c55e;
}

.hs-summary-nwd {
    border-left: 4px solid #3b82f6;
}

.hs-summary-sickness {
    border-left: 4px solid #f97316;
}

.hs-summary-term {
    border-left: 4px solid #fdc758;
}

.hs-summary-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.hs-summary-details {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.hs-summary-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.hs-summary-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #372562;
}

.hs-summary-remaining {
    font-size: 0.8rem;
    color: #22c55e;
    font-weight: 500;
}

.hs-summary-remaining.hs-warning {
    color: #dc2626;
    font-weight: 700;
}

.hs-warning {
    color: #dc2626 !important;
}

.hs-warning-text {
    font-size: 0.75rem;
    color: #dc2626;
    font-weight: 600;
}

/* Calendar Months Grid */
.hs-months-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.hs-month-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.hs-month-header {
    background: linear-gradient(135deg, #372562 0%, #3d3470 100%);
    color: white;
    padding: 0.6rem 0.75rem;
    font-weight: 600;
    font-size: 0.85rem;
    text-align: center;
}

.hs-month-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.hs-month-table thead th {
    background: #F0F7F5;
    color: #372562;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.35rem 0;
    text-align: center;
    border-bottom: 1px solid #e5e7eb;
}

.hs-month-table tbody td {
    text-align: center;
    vertical-align: middle;
    height: 36px;
    font-size: 0.75rem;
    border: 1px solid #f0f0f0;
    position: relative;
    padding: 0;
}

/* Day Cell States */
.hs-day-cell {
    transition: background 0.15s;
}

.hs-day-empty {
    background: #fafafa;
}

.hs-day-clickable {
    cursor: pointer;
}

.hs-day-clickable:hover {
    background: #f0f7f5 !important;
    outline: 2px solid #97c1bc;
    outline-offset: -2px;
}

/* Colour-coded day types */
.hs-day-holiday {
    background: #dcfce7 !important;
}

.hs-day-nwd {
    background: #dbeafe !important;
}

.hs-day-sickness {
    background: #ffedd5 !important;
}

.hs-day-bank-holiday {
    background: #e8daef !important;
}

/* School holiday (outside term dates) */
.hs-day-school-holiday {
    background: #f3e8ff !important;
}

.hs-day-school-holiday .hs-day-number {
    color: #7c3aed;
}

.hs-day-sh-code {
    color: #7c3aed !important;
}

/* Half-day visual distinction */
.hs-day-half {
    background-image: linear-gradient(135deg, transparent 50%, rgba(255, 255, 255, 0.6) 50%) !important;
}

.hs-day-half.hs-day-holiday {
    background-color: #dcfce7 !important;
    background-image: linear-gradient(135deg, #dcfce7 50%, #bbf7d0 50%) !important;
}

.hs-day-half.hs-day-nwd {
    background-color: #dbeafe !important;
    background-image: linear-gradient(135deg, #dbeafe 50%, #bfdbfe 50%) !important;
}

.hs-day-half.hs-day-sickness {
    background-color: #ffedd5 !important;
    background-image: linear-gradient(135deg, #ffedd5 50%, #fed7aa 50%) !important;
}

/* Selected (bulk) */
.hs-day-selected {
    outline: 2px solid #fdc758 !important;
    outline-offset: -2px;
    background: #fffbeb !important;
}

/* Day number and code */
.hs-day-number {
    display: block;
    font-size: 0.7rem;
    color: #372562;
    line-height: 1;
}

.hs-day-code {
    display: block;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1;
    margin-top: 1px;
}

.hs-day-holiday .hs-day-code {
    color: #16a34a;
}

.hs-day-nwd .hs-day-code {
    color: #2563eb;
}

.hs-day-sickness .hs-day-code {
    color: #ea580c;
}

/* Legend */
.hs-legend {
    display: flex;
    gap: 1.25rem;
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
    background: #F0F7F5;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.hs-legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: #372562;
}

.hs-legend-swatch {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 3px;
    border: 1px solid #ccc;
}

.hs-swatch-holiday {
    background: #dcfce7;
}

.hs-swatch-nwd {
    background: #dbeafe;
}

.hs-swatch-sickness {
    background: #ffedd5;
}

.hs-swatch-school-holiday {
    background: #f3e8ff;
}

.hs-swatch-half {
    background: linear-gradient(135deg, #dcfce7 50%, #bbf7d0 50%);
}

.hs-swatch-selected {
    background: #fffbeb;
    outline: 2px solid #fdc758;
    outline-offset: -2px;
}

/* ---- Entry Modal ---- */
.hs-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.hs-modal {
    background: white;
    border-radius: 12px;
    width: 480px;
    max-width: 95vw;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.hs-modal-header {
    background: linear-gradient(135deg, #ec5f59 0%, #D4605A 100%);
    color: white;
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 12px 12px 0 0;
}

.hs-modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
}

.hs-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.hs-modal-close:hover {
    background: rgba(255, 255, 255, 0.35);
}

.hs-modal-body {
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
}

.hs-modal-date {
    margin-bottom: 1rem;
    color: #372562;
    font-size: 0.95rem;
}

.hs-modal-date strong {
    color: #372562;
}

.hs-modal-date-list {
    font-size: 0.8rem;
    color: #666;
    margin-top: 0.25rem;
}

.hs-modal-field {
    margin-bottom: 1rem;
}

.hs-modal-field > label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    color: #372562;
    margin-bottom: 0.5rem;
}

/* Day type buttons */
.hs-type-buttons {
    display: flex;
    gap: 0.5rem;
}

.hs-type-btn {
    flex: 1;
    padding: 0.65rem 0.5rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    background: white;
    color: #372562;
    transition: all 0.2s;
    text-align: center;
}

.hs-type-btn:hover {
    border-color: #97c1bc;
}

.hs-type-btn.active.hs-type-holiday {
    background: #dcfce7;
    border-color: #22c55e;
    color: #16a34a;
    font-weight: 700;
}

.hs-type-btn.active.hs-type-nwd {
    background: #dbeafe;
    border-color: #3b82f6;
    color: #2563eb;
    font-weight: 700;
}

.hs-type-btn.active.hs-type-sickness {
    background: #ffedd5;
    border-color: #f97316;
    color: #ea580c;
    font-weight: 700;
}

/* Half-day toggle */
.hs-half-day-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: #372562;
    font-weight: 500 !important;
}

.hs-half-day-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #372562;
}

/* Modal warnings and errors */
.hs-modal-warning {
    background: #fffbeb;
    color: #92400e;
    padding: 0.65rem 0.85rem;
    border-radius: 6px;
    border: 1px solid #fdc758;
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.hs-modal-error {
    background: #fee2e2;
    color: #dc2626;
    padding: 0.65rem 0.85rem;
    border-radius: 6px;
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

/* Modal footer */
.hs-modal-footer {
    padding: 0.85rem 1.25rem;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fafafa;
    border-radius: 0 0 12px 12px;
}

.hs-modal-footer-right {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
}

.hs-btn-save {
    background: linear-gradient(135deg, #ec5f59 0%, #D4605A 100%);
    color: white;
    border: none;
    padding: 0.55rem 1.25rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: opacity 0.2s;
}

.hs-btn-save:hover:not(:disabled) {
    opacity: 0.9;
}

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

.hs-btn-cancel {
    background: white;
    color: #372562;
    border: 1px solid #ccc;
    padding: 0.55rem 1.25rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
}

.hs-btn-cancel:hover {
    background: #f5f5f5;
}

.hs-btn-delete {
    background: white;
    color: #dc2626;
    border: 1px solid #dc2626;
    padding: 0.55rem 1.25rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
}

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

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

/* Responsive */
@media (max-width: 1024px) {
    .hs-months-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .hs-summary-panel {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .hs-calendar-container {
        padding: 1rem;
    }

    .hs-months-grid {
        grid-template-columns: 1fr;
    }

    .hs-summary-panel {
        grid-template-columns: 1fr;
    }

    .hs-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .hs-type-buttons {
        flex-direction: column;
    }

    .hs-legend {
        flex-direction: column;
        gap: 0.5rem;
    }
}
