/* ===============================================
   CALENDAR POPUP WIDGET
   =============================================== */

.calendar-popup {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 320px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(108, 23, 57, 0.2);
    z-index: 9999;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid rgba(108, 23, 57, 0.1);
}

.calendar-popup.collapsed .calendar-popup-content {
    max-height: 0;
    opacity: 0;
    padding: 0 20px;
}

.calendar-popup-header {
    background: linear-gradient(135deg, #6C1739, #8a1f4a);
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.calendar-popup-header:hover {
    background: linear-gradient(135deg, #5a1230, #751a3f);
}

.calendar-icon {
    font-size: 18px;
    opacity: 0.9;
}

.calendar-title {
    flex: 1;
}

.calendar-title h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
}

.calendar-subtitle {
    font-size: 11px;
    opacity: 0.8;
    line-height: 1;
}

.calendar-toggle {
    background: none;
    border: none;
    color: white;
    font-size: 14px;
    cursor: pointer;
    padding: 5px;
    transition: transform 0.3s ease;
}

.calendar-popup.collapsed .calendar-toggle {
    transform: rotate(180deg);
}

.calendar-popup-content {
    max-height: 600px;
    opacity: 1;
    padding: 20px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
}

.calendar-month {
    margin-bottom: 20px;
}

.calendar-month:last-of-type {
    margin-bottom: 0;
}

.month-header {
    margin-bottom: 12px;
    text-align: center;
}

.month-header h5 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #6C1739;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    font-size: 12px;
}

.calendar-day-header {
    text-align: center;
    font-weight: 600;
    color: #666;
    padding: 6px 0;
    font-size: 10px;
    text-transform: uppercase;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: default;
    transition: all 0.2s ease;
    border-radius: 6px;
    font-weight: 500;
    position: relative;
}

.calendar-day.empty {
    opacity: 0;
}

.calendar-day:not(.empty):not(.available):not(.sold-out) {
    color: #999;
    background: rgba(0, 0, 0, 0.02);
}

.calendar-day.available {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    cursor: pointer;
    font-weight: 600;
    position: relative;
    animation: pulse-available 3s ease-in-out infinite;
}

@keyframes pulse-available {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.4); }
    50% { transform: scale(1.05); box-shadow: 0 0 0 8px rgba(40, 167, 69, 0); }
}

.calendar-day.available:hover {
    background: linear-gradient(135deg, #218838, #1ea080);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

.calendar-day.sold-out {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
    position: relative;
    cursor: not-allowed;
}

.calendar-day.sold-out::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 10%;
    right: 10%;
    height: 1px;
    background: white;
    transform: translateY(-50%) rotate(-45deg);
}

.calendar-legend {
    display: flex;
    gap: 15px;
    margin: 15px 0;
    font-size: 11px;
}

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

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
}

.legend-color.available {
    background: linear-gradient(135deg, #28a745, #20c997);
}

.legend-color.sold-out {
    background: linear-gradient(135deg, #dc3545, #c82333);
}

.calendar-cta {
    margin-top: 15px;
}

.btn-calendar-reserve {
    width: 100%;
    background: linear-gradient(135deg, #6C1739, #8a1f4a);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-calendar-reserve:hover {
    background: linear-gradient(135deg, #5a1230, #751a3f);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(108, 23, 57, 0.3);
}

.calendar-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    z-index: 10000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    white-space: nowrap;
    max-width: 200px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.calendar-tooltip.show {
    opacity: 1;
}

/* Mejorar tooltip para móvil */
@media (max-width: 768px) {
    .calendar-tooltip {
        font-size: 10px;
        padding: 6px 10px;
        max-width: 180px;
        white-space: normal;
        text-align: center;
        border-radius: 8px;
        background: linear-gradient(135deg, rgba(108, 23, 57, 0.95), rgba(138, 31, 74, 0.95));
        backdrop-filter: blur(10px);
        border: 1px solid rgba(255, 255, 255, 0.2);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .calendar-popup {
        right: 10px;
        top: 10px;
        width: 224px; /* Reducido 30% de 320px */
        transform: scale(0.9);
        transform-origin: top right;
    }
    
    .calendar-popup-header {
        padding: 10px 12px;
    }
    
    .calendar-popup-content {
        padding: 12px;
    }
    
    .calendar-title h4 {
        font-size: 12px;
    }
    
    .calendar-subtitle {
        font-size: 9px;
    }
    
    .calendar-grid {
        gap: 1px;
        font-size: 11px;
    }
    
    .calendar-day {
        font-size: 10px;
    }
    
    .month-header h5 {
        font-size: 12px;
    }
    
    .btn-calendar-reserve {
        padding: 10px 16px;
        font-size: 11px;
    }
    
    .calendar-legend {
        font-size: 10px;
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .calendar-popup {
        width: 200px; /* Aún más compacto en pantallas muy pequeñas */
        right: 5px;
        top: 5px;
        transform: scale(0.85);
    }
    
    .calendar-popup-header {
        padding: 8px 10px;
    }
    
    .calendar-popup-content {
        padding: 10px;
    }
}

/* Animation de entrada */
@keyframes slideInFromRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.calendar-popup {
    animation: slideInFromRight 0.5s ease-out;
}

/* Efectos adicionales */
.calendar-popup::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #6C1739, #8a1f4a, #6C1739);
    border-radius: 18px;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.calendar-popup:hover::before {
    opacity: 0.1;
}
