/* ==========================================
   CALENDARIO DE DISPONIBILIDAD - RESPONSIVE
   ========================================== */

.reservas-calendario-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    overflow-x: hidden; /* CRÍTICO para móvil */
}

/* ==========================================
   HEADER DEL CALENDARIO
   ========================================== */

.calendario-header {
    text-align: center;
    margin-bottom: 30px;
    padding: 30px 20px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: 20px;
    color: white;
}

.calendario-header h2 {
    margin: 0 0 10px 0;
    font-size: 2rem;
    font-weight: 800;
}

.calendario-header p {
    margin: 0;
    opacity: 0.9;
    font-size: 1.1rem;
}

/* ==========================================
   CONTROLES DE NAVEGACIÓN
   ========================================== */

.calendario-controles {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    gap: 10px;
}

.calendario-controles h3 {
    margin: 0;
    font-size: 1.5rem;
    color: #1e293b;
    font-weight: 700;
    flex: 1;
    text-align: center;
}

.btn-calendario {
    padding: 12px 20px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 700;
    font-size: 1rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-calendario:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(99, 102, 241, 0.3);
}

.btn-calendario .arrow {
    font-size: 1.2rem;
}

/* ==========================================
   GRID DEL CALENDARIO
   ========================================== */

.calendario-grid {
    background: white;
    border-radius: 16px;
    padding: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow-x: auto; /* Scroll horizontal si es necesario */
}

/* Encabezado de días de la semana */
.calendario-dias-semana {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-bottom: 10px;
}

.dia-semana {
    text-align: center;
    font-weight: 700;
    color: #64748b;
    padding: 10px 5px;
    font-size: 0.85rem;
    text-transform: uppercase;
}

/* Grid de días del mes */
.calendario-dias {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

.dia-celda {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 4px;
    border-radius: 12px;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    min-height: 70px;
}

.dia-celda:not(.vacio):not(.pasado):hover {
    transform: scale(1.05);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    z-index: 10;
    border-color: #6366f1;
}

.dia-celda.vacio {
    background: transparent;
    border: none;
    cursor: default;
}

.dia-celda.pasado {
    background: #f1f5f9;
    color: #94a3b8;
    cursor: not-allowed;
    opacity: 0.5;
}

.dia-celda.hoy {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    border-color: #1e40af;
    font-weight: 800;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.dia-celda.hoy .dia-numero {
    color: white;
}

/* Estados de disponibilidad */
.dia-celda.totalmente-disponible {
    background: linear-gradient(135deg, #d1fae5, #f0fdf4);
    border: 2px solid #10b981;
}

.dia-celda.totalmente-disponible:hover {
    background: linear-gradient(135deg, #a7f3d0, #d1fae5);
    border-color: #059669;
}

.dia-celda.tiene-reservas.disponible {
    background: #f0fdf4;
    border-color: #86efac;
}

.dia-celda.tiene-reservas.parcial {
    background: linear-gradient(135deg, #fef3c7, #fffbeb);
    border: 2px solid #fbbf24;
}

.dia-celda.tiene-reservas.ocupado {
    background: linear-gradient(135deg, #fee2e2, #fef2f2);
    border: 2px solid #ef4444;
}

/* Número del día */
.dia-numero {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 4px;
}

/* ==========================================
   ICONOS DE ESPACIOS EN LAS CELDAS
   ========================================== */

.iconos-espacios {
    display: flex;
    gap: 2px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 4px;
}

.icono-mini {
    font-size: 0.9rem;
    display: inline-block;
    width: 22px;
    height: 22px;
    line-height: 22px;
    text-align: center;
    border-radius: 6px;
    cursor: help;
}

.icono-mini.escuela {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
}

.icono-mini.coworking {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
}

.icono-mini.coworking.completo {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    border: 2px solid #ef4444;
}

.icono-mini.coworking.parcial {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    border: 2px solid #3b82f6;
}

.icono-mini.nave {
    background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
}

.icono-disponible {
    font-size: 1.3rem;
    font-weight: 900;
    color: #10b981;
    display: inline-block;
    width: 26px;
    height: 26px;
    line-height: 26px;
    text-align: center;
    background: white;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

/* ==========================================
   LEYENDA DEL CALENDARIO
   ========================================== */

.calendario-leyenda {
    background: white;
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-top: 30px;
}

.calendario-leyenda h4 {
    margin: 0 0 15px 0;
    color: #1e293b;
    font-size: 1.1rem;
    font-weight: 700;
}

.leyenda-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.leyenda-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #f8fafc;
    border-radius: 8px;
    font-size: 0.9rem;
}

.icono-espacio {
    font-size: 1.3rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    flex-shrink: 0;
}

.icono-espacio.escuela {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
}

.icono-espacio.coworking {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
}

.icono-espacio.nave {
    background: linear-gradient(135deg, #e0e7ff, #c7d2fe);
}

/* ==========================================
   MODAL DE DISPONIBILIDAD
   ========================================== */

.modal-calendario {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    animation: fadeIn 0.3s ease;
    overflow-y: auto;
}

.modal-content-calendario {
    background: white;
    margin: 5% auto;
    border-radius: 20px;
    width: 90%;
    max-width: 700px;
    position: relative;
    animation: slideInUp 0.4s ease;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

.modal-header-custom {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    padding: 25px 30px;
    color: white;
}

.modal-header-custom h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
}

.modal-body-custom {
    padding: 25px;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer-custom {
    padding: 20px 30px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    text-align: center;
}

.btn-reservar-modal {
    display: inline-block;
    padding: 14px 32px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-reservar-modal:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4);
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 25px;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    color: white;
    transition: all 0.3s;
    z-index: 1;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* ==========================================
   CONTENIDO DEL MODAL
   ========================================== */

.disponibilidad-detalles {
    margin-bottom: 20px;
}

.disponibilidad-detalles h4 {
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #e2e8f0;
    color: #1e293b;
    font-size: 1.2rem;
}

.turno-info {
    padding: 12px 15px;
    margin: 10px 0;
    border-radius: 10px;
    background: #f8fafc;
}

.turno-info.disponible {
    background: linear-gradient(135deg, #d1fae5, #f0fdf4);
    border-left: 4px solid #10b981;
}

.turno-info.ocupado {
    background: linear-gradient(135deg, #fee2e2, #fef2f2);
    border-left: 4px solid #ef4444;
}

.reserva-mini {
    display: inline-block;
    padding: 4px 12px;
    margin: 5px 5px 5px 0;
    background: white;
    border-radius: 6px;
    font-size: 0.9rem;
    border: 1px solid #e2e8f0;
}

.reserva-mini.coworking {
    background: #dbeafe;
    border-color: #3b82f6;
    color: #1e40af;
}

.plazas-info {
    background: linear-gradient(135deg, #dbeafe, #f0f9ff);
    padding: 20px;
    border-radius: 12px;
    border: 2px solid #3b82f6;
}

.plazas-disponibles {
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.numero-plazas {
    font-size: 1.3rem;
    font-weight: 800;
    padding: 4px 12px;
    border-radius: 8px;
    display: inline-block;
}

.numero-plazas.disponible {
    background: #d1fae5;
    color: #065f46;
}

.numero-plazas.completo {
    background: #fee2e2;
    color: #991b1b;
}

.reservas-activas {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #bfdbfe;
}

.disponible-full, .ocupado-full {
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    font-size: 1.1rem;
}

.disponible-full {
    background: linear-gradient(135deg, #d1fae5, #f0fdf4);
    color: #065f46;
}

.ocupado-full {
    background: linear-gradient(135deg, #fee2e2, #fef2f2);
    color: #991b1b;
    margin-bottom: 15px;
}

.reserva-info-nave {
    background: white;
    padding: 15px;
    border-radius: 10px;
    margin-top: 10px;
    border: 1px solid #e2e8f0;
}

/* ==========================================
   ANIMACIONES
   ========================================== */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes pulseGreen {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ==========================================
   RESPONSIVE - MÓVIL
   ========================================== */

@media (max-width: 768px) {
    .reservas-calendario-wrapper {
        padding: 10px;
    }

    .calendario-header {
        padding: 20px 15px;
        margin-bottom: 20px;
    }

    .calendario-header h2 {
        font-size: 1.5rem;
    }

    .calendario-header p {
        font-size: 0.9rem;
    }

    .calendario-controles {
        padding: 12px;
        gap: 8px;
    }

    .calendario-controles h3 {
        font-size: 1.1rem;
    }

    .btn-calendario {
        padding: 10px 12px;
        font-size: 0.85rem;
        gap: 4px;
    }

    .btn-calendario span:not(.arrow) {
        display: none; /* Ocultar texto, solo flecha */
    }

    .calendario-grid {
        padding: 10px;
    }

    .calendario-dias-semana {
        gap: 4px;
    }

    .dia-semana {
        padding: 6px 2px;
        font-size: 0.7rem;
    }

    .calendario-dias {
        gap: 4px;
    }

    .dia-celda {
        min-height: 55px;
        padding: 4px 2px;
        border-width: 1px;
    }

    .dia-numero {
        font-size: 0.95rem;
        margin-bottom: 2px;
    }

    .icono-mini {
        width: 18px;
        height: 18px;
        font-size: 0.75rem;
        line-height: 18px;
    }

    .icono-disponible {
        font-size: 1.1rem;
        width: 22px;
        height: 22px;
        line-height: 22px;
    }

    .calendario-leyenda {
        padding: 15px;
        margin-top: 20px;
    }

    .calendario-leyenda h4 {
        font-size: 1rem;
        margin-bottom: 10px;
    }

    .leyenda-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .leyenda-item {
        padding: 8px;
        font-size: 0.85rem;
    }

    .icono-espacio {
        width: 28px;
        height: 28px;
        font-size: 1.1rem;
    }

    .modal-content-calendario {
        width: 95%;
        margin: 5% auto;
        max-height: 90vh;
    }

    .modal-header-custom {
        padding: 20px 15px;
    }

    .modal-header-custom h3 {
        font-size: 1.2rem;
    }

    .modal-body-custom {
        padding: 15px;
        max-height: calc(90vh - 200px);
    }

    .modal-footer-custom {
        padding: 15px;
    }

    .btn-reservar-modal {
        padding: 12px 24px;
        font-size: 1rem;
    }

    .disponibilidad-detalles h4 {
        font-size: 1.1rem;
    }
}

/* Móviles muy pequeños */
@media (max-width: 375px) {
    .dia-celda {
        min-height: 50px;
        padding: 3px 1px;
    }

    .dia-numero {
        font-size: 0.85rem;
    }

    .icono-mini {
        width: 16px;
        height: 16px;
        font-size: 0.7rem;
    }
}

/* Tablet */
@media (min-width: 769px) and (max-width: 1024px) {
    .calendario-dias {
        gap: 8px;
    }

    .dia-celda {
        min-height: 70px;
    }
}
/* ============================================
   ESTILOS PARA ESPACIOS DESACTIVADOS - v8.1.2
   ============================================
   
   Agregar estos estilos al archivo:
   assets/calendario.css
   
   Al FINAL del archivo
   ============================================ */

/* Mensaje de espacio desactivado en el modal del calendario */
.espacio-desactivado {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    border: 2px solid #ef4444;
    border-radius: 12px;
    padding: 25px;
    text-align: center;
    margin: 10px 0;
}

.espacio-desactivado h4 {
    color: #991b1b;
    margin: 0 0 15px 0;
    font-size: 1.3rem;
    font-weight: 800;
}

.espacio-desactivado p {
    color: #7f1d1d;
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
}

.espacio-desactivado strong {
    color: #991b1b;
    font-weight: 800;
}

/* Responsive para móvil */
@media (max-width: 768px) {
    .espacio-desactivado {
        padding: 20px 15px;
    }
    
    .espacio-desactivado h4 {
        font-size: 1.1rem;
    }
    
    .espacio-desactivado p {
        font-size: 0.95rem;
    }
}

/* ============================================
   FIN DE ESTILOS PARA ESPACIOS DESACTIVADOS
   ============================================ */

/* ==========================================
   v14.20.3 (Auditoría 4.4) — TOGGLE MES / LISTA
   ========================================== */
.calendario-modo-toggle {
    display: inline-flex;
    gap: 4px;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 12px;
    margin: 0 auto 20px;
    width: fit-content;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.06);
}
.calendario-modo-toggle {
    display: flex; /* centrar en el flujo */
}
.calendario-controles + .calendario-modo-toggle {
    margin-top: -10px;
}
.calendario-modo-toggle {
    justify-content: center;
    align-self: center;
}
.cal-modo-btn {
    background: transparent;
    border: 0;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    color: #64748b;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.cal-modo-btn:hover { color: #1e293b; }
.cal-modo-btn[aria-selected="true"] {
    background: #ffffff;
    color: #6366f1;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* ==========================================
   v14.20.3 — VISTA LISTA (14 días desde hoy)
   ========================================== */
.calendario-lista {
    background: #ffffff;
    border-radius: 16px;
    padding: 15px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}
.cal-lista-header {
    font-weight: 700;
    color: #1e293b;
    font-size: 0.95rem;
    padding: 6px 8px 12px;
    border-bottom: 1px solid #e2e8f0;
    margin-bottom: 8px;
}
.cal-lista-items {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.cal-lista-mes-sep {
    padding: 12px 8px 4px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.cal-lista-mes-sep:first-child { padding-top: 4px; }

.cal-lista-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.cal-lista-item:hover,
.cal-lista-item:focus {
    transform: translateX(2px);
    border-color: #6366f1;
    box-shadow: 0 4px 12px rgba(99,102,241,0.15);
    outline: none;
}
.cal-lista-item.hoy {
    background: linear-gradient(135deg, #dbeafe, #eff6ff);
    border-color: #3b82f6;
}
.cal-lista-item.totalmente-disponible {
    background: linear-gradient(135deg, #ecfdf5, #f0fdf4);
    border-color: #86efac;
}
.cal-lista-item.tiene-reservas.parcial {
    background: linear-gradient(135deg, #fffbeb, #fef3c7);
    border-color: #fbbf24;
}
.cal-lista-item.tiene-reservas.ocupado {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    border-color: #ef4444;
}

.cal-lista-fecha {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 56px;
    padding: 6px 8px;
    background: #ffffff;
    border-radius: 8px;
    line-height: 1;
}
.cal-lista-item.hoy .cal-lista-fecha { background: #3b82f6; color: #ffffff; }
.cal-lista-dia-num {
    font-size: 1.5rem;
    font-weight: 800;
    color: inherit;
}
.cal-lista-dia-semana {
    font-size: 0.7rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    margin-top: 2px;
    letter-spacing: 0.03em;
}
.cal-lista-item.hoy .cal-lista-dia-semana { color: rgba(255,255,255,0.9); }

.cal-lista-iconos {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.cal-lista-libre-txt {
    color: #059669;
    font-size: 0.85rem;
    font-weight: 600;
}

.cal-lista-chip {
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}
.cal-chip-disponible { background: #d1fae5; color: #065f46; }
.cal-chip-parcial    { background: #fef3c7; color: #78350f; }
.cal-chip-ocupado    { background: #fee2e2; color: #991b1b; }

/* Móvil — más compacto */
@media (max-width: 640px) {
    .cal-lista-item {
        gap: 10px;
        padding: 10px 12px;
    }
    .cal-lista-fecha {
        min-width: 48px;
        padding: 5px 6px;
    }
    .cal-lista-dia-num { font-size: 1.25rem; }
    .cal-lista-dia-semana { font-size: 0.65rem; }
    .cal-lista-chip { padding: 4px 9px; font-size: 0.7rem; }
    .cal-modo-btn { padding: 7px 12px; font-size: 0.85rem; }
}