/**
 * Calendar Widget Styles - Casa Alta Tenerife
 * Widget visual de disponibilidad de apartamentos
 */

/* === CALENDAR WIDGET CONTAINER === */
.calendar-widget {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 24px;
    margin: 24px 0;
    max-width: 800px;
    font-family: 'Inter', system-ui, sans-serif;
}

/* === CALENDAR HEADER === */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 16px;
}

.calendar-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
}

/* === APARTMENT SELECTOR === */
.apartment-selector {
    display: flex;
    gap: 8px;
    background: #f3f4f6;
    border-radius: 12px;
    padding: 4px;
}

.apt-btn {
    background: transparent;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    color: #6b7280;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.apt-btn:hover {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.apt-btn.active {
    background: #3b82f6;
    color: white;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

/* === CALENDAR NAVIGATION === */
.calendar-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 0 8px;
}

.nav-btn {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: #64748b;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.3s ease;
}

.nav-btn:hover {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.current-period {
    font-weight: 700;
    font-size: 1.1rem;
    color: #1f2937;
    text-transform: capitalize;
}

/* === LOADING STATE === */
.calendar-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px;
    color: #6b7280;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e5e7eb;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

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

/* === CALENDAR GRID === */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    background: #f1f5f9;
    border-radius: 12px;
    padding: 8px;
    margin-bottom: 20px;
}

/* === DAY HEADERS === */
.day-header {
    background: #64748b;
    color: white;
    padding: 12px 8px;
    text-align: center;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 6px;
}

/* === CALENDAR DAYS === */
.calendar-day {
    background: white;
    border-radius: 6px;
    padding: 8px 4px;
    min-height: 48px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.calendar-day:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.day-number {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 2px;
}

.day-indicator {
    font-size: 8px;
    position: absolute;
    bottom: 4px;
    right: 6px;
}

/* Day States */
.calendar-day.other-month {
    opacity: 0.3;
}

.calendar-day.available {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #065f46;
    border-color: #10b981;
}

.calendar-day.available:hover {
    background: linear-gradient(135deg, #a7f3d0 0%, #6ee7b7 100%);
}

.calendar-day.occupied {
    background: linear-gradient(135deg, #fecaca 0%, #f87171 100%);
    color: #7f1d1d;
    border-color: #ef4444;
}

.calendar-day.occupied:hover {
    background: linear-gradient(135deg, #f87171 0%, #dc2626 100%);
}

.calendar-day.partial {
    background: linear-gradient(135deg, #fed7aa 0%, #fdba74 100%);
    color: #7c2d12;
    border-color: #f59e0b;
}

.calendar-day.partial:hover {
    background: linear-gradient(135deg, #fdba74 0%, #fb923c 100%);
}

.calendar-day.on-demand {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    color: #78350f;
    border-color: #f59e0b;
}

.calendar-day.on-demand:hover {
    background: linear-gradient(135deg, #fde68a 0%, #fbbf24 100%);
}

.calendar-day.selected {
    background: linear-gradient(135deg, #dbeafe 0%, #93c5fd 100%);
    color: #1e3a8a;
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* === CALENDAR LEGEND === */
.calendar-legend {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 20px;
    padding: 16px;
    background: #f8fafc;
    border-radius: 12px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #374151;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.legend-dot.available { background: #10b981; }
.legend-dot.occupied { background: #ef4444; }
.legend-dot.selected { background: #3b82f6; }
.legend-dot.partial { background: #f59e0b; }

/* === QUICK INFO === */
.quick-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 16px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 12px;
    margin-bottom: 16px;
}

.info-item {
    font-size: 14px;
    color: #374151;
}

.info-item strong {
    display: block;
    color: #1f2937;
    margin-bottom: 4px;
}

/* === DAY MODAL === */
.day-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.modal-content {
    background: white;
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

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

.modal-header h4 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: #1f2937;
    text-transform: capitalize;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #9ca3af;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.modal-close:hover {
    background: #f3f4f6;
    color: #374151;
}

.modal-body {
    padding: 24px;
}

/* === MODAL CONTENT STYLES === */
.apt-day-info {
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f3f4f6;
}

.apt-day-info:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.apt-day-info h5 {
    margin: 0 0 8px 0;
    font-size: 1rem;
    font-weight: 600;
    color: #374151;
}

.status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status.available {
    background: #d1fae5;
    color: #065f46;
}

.status.occupied {
    background: #fecaca;
    color: #7f1d1d;
}

.event-info {
    margin: 8px 0 0 0;
    font-size: 13px;
    color: #6b7280;
    font-style: italic;
}

.single-apt-info .status {
    font-size: 16px;
    padding: 8px 16px;
    margin-bottom: 16px;
}

.event-details {
    background: #f8fafc;
    padding: 12px;
    border-radius: 8px;
    font-size: 14px;
    color: #374151;
    line-height: 1.5;
}

/* === ERROR STATES === */
.error-message {
    color: #dc2626;
    text-align: center;
    padding: 20px;
    font-weight: 500;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .calendar-widget {
        padding: 16px;
        margin: 16px;
    }
    
    .calendar-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .apartment-selector {
        justify-content: center;
    }
    
    .calendar-grid {
        gap: 1px;
        padding: 4px;
    }
    
    .calendar-day {
        min-height: 40px;
        padding: 6px 2px;
    }
    
    .day-number {
        font-size: 12px;
    }
    
    .calendar-legend {
        gap: 12px;
    }
    
    .legend-item {
        font-size: 13px;
    }
    
    .quick-info {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .modal-content {
        width: 95%;
        margin: 20px;
    }
    
    .modal-header,
    .modal-body {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .calendar-title {
        font-size: 1.2rem;
    }
    
    .apt-btn {
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .calendar-day {
        min-height: 36px;
        padding: 4px 2px;
    }
    
    .day-header {
        padding: 8px 4px;
        font-size: 11px;
    }
    
    .nav-btn {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    .current-period {
        font-size: 1rem;
    }
}

/* === PERFORMANCE OPTIMIZATIONS === */
.calendar-day {
    will-change: transform;
}

/* === ACCESSIBILITY === */
.calendar-day:focus {
    outline: 3px solid rgba(59, 130, 246, 0.5);
    outline-offset: 2px;
}

.apt-btn:focus,
.nav-btn:focus {
    outline: 2px solid rgba(59, 130, 246, 0.5);
    outline-offset: 2px;
}

/* === ANIMATIONS === */
@media (prefers-reduced-motion: reduce) {
    .calendar-day,
    .apt-btn,
    .nav-btn,
    .loading-spinner {
        transition: none;
        animation: none;
    }
    
    .calendar-day:hover {
        transform: none;
    }
}