/* ==========================================
   ESTILOS GENERALES
   ========================================== */
:root {
    --primary-color:   #007bff;
    --secondary-color: #6c757d;
    --success-color:   #28a745;
    --danger-color:    #dc3545;
    --warning-color:   #ffc107;
    --info-color:      #17a2b8;
    --light-color:     #f8f9fa;
    --dark-color:      #343a40;

    /* Sidebar */
    --sidebar-width:         260px;
    --sidebar-collapsed-w:   68px;
    --sidebar-bg:            #1e2a3a;
    --sidebar-text:          #8fa3b1;
    --sidebar-hover-bg:      rgba(255, 255, 255, 0.06);
    --sidebar-active-bg:     rgba(59, 130, 246, 0.15);
    --sidebar-active-text:   #60a5fa;
    --sidebar-accent:        #3b82f6;
    --topbar-height:         56px;
    --transition:            0.22s ease;
    --sidebar-transition:    0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f0f2f5;
}

/* ==========================================
   LAYOUT — SIDEBAR IZQUIERDO FIJO
   ========================================== */

/* ── Sidebar ── */
.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: width var(--sidebar-transition), transform var(--transition);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.18);
    overflow: hidden;
}

/* ── Estado colapsado (desktop) ── */
body.sidebar-collapsed .app-sidebar {
    width: var(--sidebar-collapsed-w);
}

/* ── Botón toggle desktop ── */
.sidebar-toggle {
    background: none;
    border: none;
    color: var(--sidebar-text);
    font-size: 1rem;
    padding: 0.3rem;
    cursor: pointer;
    border-radius: 6px;
    transition: color var(--transition), background var(--transition);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sidebar-toggle:hover { color: #fff; background: rgba(255,255,255,0.08); }

/* ── Cabecera del sidebar ── */
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.1rem 1rem 1.1rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    flex-shrink: 0;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    overflow: hidden;
    min-width: 0;
    flex: 1;
}

.sidebar-logo-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--sidebar-accent), #6366f1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.05rem;
    flex-shrink: 0;
}

.sidebar-logo-text {
    display: flex;
    align-items: baseline;
    gap: 3px;
    transition: opacity var(--sidebar-transition), width var(--sidebar-transition);
    white-space: nowrap;
    overflow: hidden;
}
body.sidebar-collapsed .sidebar-logo-text {
    opacity: 0;
    width: 0;
}

.logo-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.3px;
}

.logo-pro {
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--sidebar-accent);
    background: rgba(59, 130, 246, 0.18);
    padding: 1px 5px;
    border-radius: 4px;
}

.sidebar-close {
    display: none;
    background: none;
    border: none;
    color: var(--sidebar-text);
    font-size: 1rem;
    padding: 0.3rem;
    cursor: pointer;
    border-radius: 6px;
    transition: color var(--transition), background var(--transition);
}
.sidebar-close:hover { color: #fff; background: rgba(255,255,255,0.08); }

/* ── Navegación ── */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.72rem 1.25rem;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: all var(--transition);
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-link span {
    transition: opacity var(--sidebar-transition);
    overflow: hidden;
    white-space: nowrap;
}
body.sidebar-collapsed .sidebar-link span {
    opacity: 0;
    width: 0;
}
body.sidebar-collapsed .sidebar-link {
    justify-content: center;
    padding: 0.72rem 0;
    border-left-color: transparent !important;
}
body.sidebar-collapsed .sidebar-link i {
    margin: 0;
}
body.sidebar-collapsed .sidebar-link.active {
    background: var(--sidebar-active-bg);
    border-left: 3px solid var(--sidebar-accent) !important;
}

.sidebar-link:hover {
    color: #ffffff;
    background: var(--sidebar-hover-bg);
    border-left-color: rgba(255,255,255,0.15);
}

.sidebar-link.active {
    color: var(--sidebar-active-text);
    background: var(--sidebar-active-bg);
    border-left-color: var(--sidebar-accent);
}

.sidebar-link i {
    font-size: 1rem;
    width: 1.1rem;
    text-align: center;
    flex-shrink: 0;
}

/* ── Footer / usuario ── */
.sidebar-footer {
    padding: 0.9rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
    overflow: hidden;
}
body.sidebar-collapsed .sidebar-header {
    justify-content: center;
    padding: 1.1rem 0;
}
body.sidebar-collapsed .sidebar-logo {
    display: none;
}
body.sidebar-collapsed .sidebar-footer {
    justify-content: center;
    padding: 0.9rem 0;
}
body.sidebar-collapsed .sidebar-user-info,
body.sidebar-collapsed .sidebar-logout {
    display: none;
}
body.sidebar-collapsed .sidebar-user {
    flex: 0 0 auto;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex: 1;
    min-width: 0;
}

.sidebar-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--sidebar-accent), #6366f1);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-user-info { min-width: 0; }

.sidebar-user-name {
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    color: var(--sidebar-text);
    font-size: 0.68rem;
}

.sidebar-logout {
    background: none;
    border: none;
    color: var(--sidebar-text);
    padding: 0.4rem;
    cursor: pointer;
    border-radius: 6px;
    flex-shrink: 0;
    transition: color var(--transition), background var(--transition);
}
.sidebar-logout:hover { color: #ef4444; background: rgba(239, 68, 68, 0.1); }

/* ── Overlay móvil ── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1039;
    backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

/* ── Topbar móvil ── */
.app-topbar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height);
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    z-index: 1030;
    align-items: center;
    padding: 0 1rem;
    gap: 0.75rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
}

.topbar-toggle {
    background: none;
    border: none;
    font-size: 1.1rem;
    color: #475569;
    cursor: pointer;
    padding: 0.3rem;
    border-radius: 6px;
    transition: background var(--transition);
}
.topbar-toggle:hover { background: #f1f5f9; }

.topbar-title {
    flex: 1;
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.topbar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--sidebar-accent), #6366f1);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.topbar-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: #475569;
    display: none;
}

.topbar-badge {
    font-size: 0.65rem;
    font-weight: 700;
    color: #fff;
    background: var(--sidebar-accent);
    padding: 2px 6px;
    border-radius: 4px;
    display: none;
}

/* ── Área de contenido ── */
.has-sidebar .app-content {
    margin-left: var(--sidebar-width);
    padding: 1.75rem 2rem;
    min-height: 100vh;
    transition: margin-left var(--sidebar-transition);
}
body.sidebar-collapsed.has-sidebar .app-content {
    margin-left: var(--sidebar-collapsed-w);
}

/* ── Responsive ── */
@media (min-width: 992px) {
    .topbar-name  { display: inline; }
    .topbar-badge { display: inline; }
}

@media (max-width: 991.98px) {
    .app-sidebar {
        transform: translateX(calc(-1 * var(--sidebar-width)));
        width: var(--sidebar-width) !important; /* siempre ancho completo en móvil */
    }
    .app-sidebar.open {
        transform: translateX(0);
    }
    .sidebar-toggle { display: none !important; }
    .sidebar-close   { display: block; }
    .app-topbar      { display: flex; }

    .has-sidebar .app-content,
    body.sidebar-collapsed.has-sidebar .app-content {
        margin-left: 0;
        padding: 1rem;
        padding-top: calc(var(--topbar-height) + 1rem);
    }

    /* Restaurar estilos colapsados en móvil */
    body.sidebar-collapsed .sidebar-logo-text { opacity: 1; width: auto; }
    body.sidebar-collapsed .sidebar-link span  { opacity: 1; width: auto; }
    body.sidebar-collapsed .sidebar-link {
        justify-content: flex-start;
        padding: 0.72rem 1.25rem;
    }
    body.sidebar-collapsed .sidebar-user-info,
    body.sidebar-collapsed .sidebar-logout { display: flex; }
    body.sidebar-collapsed .sidebar-footer  { justify-content: flex-start; padding: 0.9rem 1rem; }
}

/* ==========================================
   CARDS ESTADÍSTICAS
   ========================================== */
.card {
    border: none;
    border-radius: 0.375rem;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
}

.border-left-primary {
    border-left: 0.25rem solid var(--primary-color) !important;
}

.border-left-success {
    border-left: 0.25rem solid var(--success-color) !important;
}

.border-left-info {
    border-left: 0.25rem solid var(--info-color) !important;
}

.border-left-warning {
    border-left: 0.25rem solid var(--warning-color) !important;
}

.text-xs {
    font-size: 0.7rem;
}

.font-weight-bold {
    font-weight: 700;
}

.text-gray-800 {
    color: #5a5c69;
}

.text-gray-300 {
    color: #dddfeb;
}

/* ==========================================
   CALENDARIO
   ========================================== */
.calendar-container {
    background: white;
    border-radius: 0.375rem;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
    padding: 1.5rem;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e3e6f0;
}

.calendar-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background-color: #e3e6f0;
    border: 1px solid #e3e6f0;
}

.calendar-day-header {
    background-color: var(--primary-color);
    color: white;
    padding: 0.75rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.875rem;
}

.calendar-day {
    background-color: white;
    min-height: 120px;
    padding: 0.5rem;
    position: relative;
    border: 1px solid #e3e6f0;
    transition: background-color 0.2s;
}

.calendar-day:hover {
    background-color: #f8f9fa;
}

.calendar-day.other-month {
    background-color: #f8f9fa;
    color: #adb5bd;
}

.calendar-day.today {
    background-color: #e3f2fd;
    border: 2px solid var(--primary-color);
}

.day-number {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.reservation-item {
    background-color: var(--primary-color);
    color: white;
    padding: 0.25rem 0.5rem;
    margin-bottom: 0.25rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: transform 0.2s;
}

.reservation-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.reservation-item.conference {
    background-color: var(--primary-color);
}

.reservation-item.computer {
    background-color: var(--success-color);
}

.reservation-item.science {
    background-color: var(--warning-color);
    color: #333;
}

.reservation-item.sports {
    background-color: var(--info-color);
}

.reservation-item.library {
    background-color: var(--secondary-color);
}

.reservation-item.fixed {
    background: linear-gradient(45deg, #dc3545, #fd7e14);
    position: relative;
}

.reservation-item.fixed::before {
    content: '🔒';
    position: absolute;
    top: 0;
    right: 0.25rem;
    font-size: 0.6rem;
}

/* ==========================================
   VISTA DE HORARIOS
   ========================================== */
.schedule-view {
    background: white;
    border-radius: 0.375rem;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
}

.schedule-header {
    display: grid;
    grid-template-columns: 80px repeat(7, 1fr);
    gap: 1px;
    background-color: #e3e6f0;
}

.time-header, .day-header {
    background-color: var(--primary-color);
    color: white;
    padding: 1rem 0.5rem;
    text-align: center;
    font-weight: 600;
}

.schedule-grid {
    display: grid;
    grid-template-columns: 80px repeat(7, 1fr);
    gap: 1px;
    background-color: #e3e6f0;
}

.time-slot {
    background-color: #f8f9fa;
    padding: 0.5rem;
    text-align: center;
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
}

.schedule-cell {
    background-color: white;
    min-height: 60px;
    padding: 0.25rem;
    position: relative;
    cursor: pointer;
    transition: background-color 0.2s;
}

.schedule-cell:hover {
    background-color: #f8f9fa;
}

.schedule-cell.occupied {
    background-color: #e3f2fd;
    border: 2px solid var(--primary-color);
}

.schedule-cell.fixed {
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    border: 2px solid var(--danger-color);
}

.schedule-reservation {
    background-color: var(--primary-color);
    color: white;
    padding: 0.25rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: filter 0.15s, transform 0.1s;
}
.schedule-reservation:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}
.schedule-reservation.conference { background-color: #0d6efd; }
.schedule-reservation.computer   { background-color: #6f42c1; }
.schedule-reservation.science    { background-color: #198754; }
.schedule-reservation.sports     { background-color: #fd7e14; }
.schedule-reservation.library    { background-color: #0dcaf0; color: #212529; }
.schedule-reservation.fixed      { background: linear-gradient(135deg,#dc3545,#fd7e14); }
.schedule-reservation.pending    { opacity: .82; border-left: 3px solid #ffc107; }

/* Day-view grid (2-col) */
.schedule-grid-day {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 1px;
    background-color: #e3e6f0;
}

/* Today highlight in week header */
.day-header.today-header {
    background-color: #0a58ca;
}

/* Environment filter active state */
.env-filter-active {
    outline: 2px solid #0d6efd;
    outline-offset: 1px;
}

/* Day summary list items */
#daySummaryList .summary-row {
    display: flex;
    align-items: flex-start;
    gap: .5rem;
    margin-bottom: .6rem;
    font-size: .82rem;
}

/* ==========================================
   FILTROS Y CONTROLES
   ========================================== */
.filters-panel {
    background: white;
    border-radius: 0.375rem;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.filter-group {
    margin-bottom: 1rem;
}

.filter-group:last-child {
    margin-bottom: 0;
}

.filter-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: block;
}

.color-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 3px;
}

/* ==========================================
   MODALES
   ========================================== */
.modal-content {
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175);
}

.modal-header {
    border-bottom: 1px solid #e3e6f0;
    background-color: #f8f9fa;
}

.modal-footer {
    border-top: 1px solid #e3e6f0;
    background-color: #f8f9fa;
}

/* ==========================================
   TABLAS
   ========================================== */
.table {
    font-size: 0.875rem;
}

.table th {
    border-top: none;
    background-color: #f8f9fa;
    font-weight: 600;
    color: #5a5c69;
}

/* ==========================================
   BADGES Y ESTADOS
   ========================================== */
.badge {
    font-size: 0.75rem;
    padding: 0.35rem 0.65rem;
}

.status-confirmed {
    color: var(--success-color);
}

.status-pending {
    color: var(--warning-color);
}

.status-cancelled {
    color: var(--danger-color);
}

/* ==========================================
   BOTONES PERSONALIZADOS
   ========================================== */
.btn {
    border-radius: 0.375rem;
    font-weight: 500;
    transition: all 0.15s ease-in-out;
}

.btn-icon {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

/* ==========================================
   RESPONSIVE — Calendario y horarios
   ========================================== */
@media (max-width: 767.98px) {
    .calendar-grid {
        font-size: 0.8rem;
    }

    .calendar-day {
        min-height: 80px;
        padding: 0.25rem;
    }

    .schedule-header,
    .schedule-grid {
        grid-template-columns: 60px repeat(7, 1fr);
    }

    .time-header,
    .day-header {
        padding: 0.5rem 0.25rem;
        font-size: 0.75rem;
    }
}

/* ==========================================
   ANIMACIONES
   ========================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

/* ==========================================
   UTILIDADES
   ========================================== */
.shadow-sm {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.border-radius-lg {
    border-radius: 0.5rem;
}

.cursor-pointer {
    cursor: pointer;
}

.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ==========================================
   VALIDACIÓN DE FORMULARIOS
   ========================================== */
.is-invalid {
    border-color: var(--danger-color);
}

.invalid-feedback {
    display: block;
    width: 100%;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: var(--danger-color);
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* ==========================================
   SPINNER DE CARGA
   ========================================== */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==========================================
   TOOLTIPS PERSONALIZADOS
   ========================================== */
.tooltip-inner {
    background-color: var(--dark-color);
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

.tooltip.bs-tooltip-top .tooltip-arrow::before {
    border-top-color: var(--dark-color);
}

.tooltip.bs-tooltip-right .tooltip-arrow::before {
    border-right-color: var(--dark-color);
}

/* ==========================================
   TRANSICIONES DE PÁGINA
   ========================================== */
@keyframes pageEnter {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes pageLeave {
    from { opacity: 1; }
    to   { opacity: 0; }
}

.app-content {
    animation: pageEnter 0.32s ease forwards;
}

body.page-leaving .app-content {
    animation: pageLeave 0.2s ease forwards;
    pointer-events: none;
}

/* ==========================================
   QUICK BOOKING — WIZARD DE RESERVA RÁPIDA
   ========================================== */

/* ── Indicador de pasos ── */
.qb-step-indicator {
    display: flex;
    align-items: center;
    gap: 0;
}

.qb-step-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
}

.qb-step-circle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 700;
    background: #e9ecef;
    color: #6c757d;
    border: 3px solid #dee2e6;
    transition: all 0.3s ease;
}

.qb-step-item.active .qb-step-circle {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(0, 123, 255, 0.18);
}

.qb-step-item.done .qb-step-circle {
    background: #28a745;
    color: #fff;
    border-color: #28a745;
}

.qb-step-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    transition: color 0.3s;
}

.qb-step-item.active .qb-step-label { color: var(--primary-color); }
.qb-step-item.done  .qb-step-label  { color: #28a745; }

.qb-step-divider {
    flex: 1;
    height: 3px;
    background: #dee2e6;
    margin: 0 8px;
    margin-bottom: 24px;
    border-radius: 2px;
    transition: background 0.3s;
    min-width: 30px;
}

/* ── Paso (contenedor) ── */
.qb-step { animation: pageEnter 0.28s ease forwards; }

/* ── Grilla de ambientes ── */
.qb-env-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.1rem;
}

.qb-env-card {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
    border: 2px solid transparent;
    overflow: hidden;
}

.qb-env-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 22px rgba(0,0,0,0.13);
}

.qb-env-card.selected {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0,123,255,0.18), 0 6px 22px rgba(0,0,0,0.1);
}

.qb-env-img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

.qb-env-img-placeholder {
    width: 100%;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
}

.qb-env-card-body {
    padding: 1rem;
}

.qb-env-name {
    font-size: 1rem;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 4px;
}

.qb-env-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 0.8rem;
    color: #6c757d;
}

.qb-env-equip {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.qb-env-schedule { font-size: 0.8rem; }

/* ── Barra de ambiente seleccionado (paso 2) ── */
.qb-selected-env-bar {
    background: #f0f7ff;
    border: 1px solid #bee3ff;
    border-radius: 10px;
    padding: 0.85rem 1rem;
}

.qb-mini-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* ── Navegador de fecha ── */
.qb-date-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 0.7rem 1rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.qb-date-center {
    flex: 1;
    text-align: center;
}

.qb-date-input {
    border: none;
    outline: none;
    text-align: center;
    font-size: 0.9rem;
    color: #495057;
    cursor: pointer;
    width: auto;
}

.qb-date-label {
    font-size: 1rem;
    font-weight: 600;
    color: #1a202c;
    margin-top: 2px;
}

.qb-date-btn {
    background: none;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #495057;
    transition: background 0.15s, border-color 0.15s;
    flex-shrink: 0;
}

.qb-date-btn:hover:not(:disabled) {
    background: #f0f7ff;
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.qb-date-btn:disabled { opacity: 0.4; cursor: default; }

/* ── Leyenda ── */
.qb-legend {
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

.qb-legend.available { color: #28a745; }
.qb-legend.occupied  { color: #dc3545; }
.qb-legend.selected  { color: var(--primary-color); }

/* ── Grilla de franjas ── */
.qb-time-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.6rem;
}

.qb-slot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.7rem 1rem;
    border-radius: 10px;
    border: 2px solid transparent;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.qb-slot.available {
    border-color: #d4edda;
    color: #1a6632;
}

.qb-slot.available:hover {
    background: #d4edda;
    border-color: #28a745;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(40,167,69,0.15);
}

.qb-slot.occupied {
    background: #fff5f5;
    border-color: #f5c6cb;
    color: #721c24;
    cursor: not-allowed;
    opacity: 0.75;
}

.qb-slot.selected {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
    box-shadow: 0 3px 10px rgba(0,123,255,0.3);
}

.qb-slot.selected:hover {
    background: #0069d9;
    border-color: #0069d9;
    transform: translateY(-1px);
}

.qb-slot-time { font-weight: 700; }
.qb-slot-badge { font-size: 0.75rem; opacity: 0.85; }

/* ── Barra de selección activa ── */
.qb-selection-bar {
    background: #e8f4fd;
    border: 1px solid #bee3ff;
    border-radius: 12px;
    padding: 1rem 1.2rem;
    animation: pageEnter 0.25s ease forwards;
}

/* ── Responsive ── */
@media (max-width: 575.98px) {
    .qb-env-grid {
        grid-template-columns: 1fr;
    }

    .qb-time-grid {
        grid-template-columns: 1fr 1fr;
    }

    .qb-step-label { display: none; }

    .qb-date-label { font-size: 0.85rem; }
}

/* ==========================================
   MODAL PERSONALIZADO (AppModal)
   ========================================== */
.app-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    backdrop-filter: blur(3px);
    opacity: 0;
    transition: opacity 0.22s ease;
}

.app-modal-overlay.visible {
    opacity: 1;
}

.app-modal {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 420px;
    padding: 2rem;
    transform: scale(0.9) translateY(14px);
    transition:
        transform 0.26s cubic-bezier(0.34, 1.56, 0.64, 1),
        opacity   0.22s ease;
    opacity: 0;
}

.app-modal-overlay.visible .app-modal {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.app-modal-icon {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    margin: 0 auto 1.25rem;
}
.app-modal-icon.danger  { background: #fef2f2; color: #ef4444; }
.app-modal-icon.warning { background: #fffbeb; color: #f59e0b; }
.app-modal-icon.info    { background: #eff6ff; color: #3b82f6; }
.app-modal-icon.success { background: #f0fdf4; color: #22c55e; }

.app-modal-title {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.5rem;
}

.app-modal-message {
    text-align: center;
    font-size: 0.9rem;
    color: #64748b;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.app-modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.app-modal-btn {
    flex: 1;
    max-width: 180px;
    padding: 0.65rem 1.25rem;
    border: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s ease, transform 0.12s ease;
}
.app-modal-btn:active { transform: scale(0.97); }

.app-modal-btn-cancel {
    background: #f1f5f9;
    color: #475569;
}
.app-modal-btn-cancel:hover { background: #e2e8f0; color: #1e293b; }

.app-modal-btn-confirm.danger   { background: #ef4444; color: #fff; }
.app-modal-btn-confirm.danger:hover   { background: #dc2626; }
.app-modal-btn-confirm.warning  { background: #f59e0b; color: #fff; }
.app-modal-btn-confirm.warning:hover  { background: #d97706; }
.app-modal-btn-confirm.info     { background: #3b82f6; color: #fff; }
.app-modal-btn-confirm.info:hover     { background: #2563eb; }
.app-modal-btn-confirm.success  { background: #22c55e; color: #fff; }
.app-modal-btn-confirm.success:hover  { background: #16a34a; }

.tooltip.bs-tooltip-bottom .tooltip-arrow::before {
    border-bottom-color: var(--dark-color);
}

.tooltip.bs-tooltip-left .tooltip-arrow::before {
    border-left-color: var(--dark-color);
}

/* ==========================================
   CONFLICTOS Y ALERTAS
   ========================================== */
.conflict-alert {
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    border-radius: 0.375rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
}

.conflict-item {
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 0.5rem;
    border-radius: 0.25rem;
    margin-bottom: 0.5rem;
}

.availability-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 0.5rem;
}

.availability-indicator.available {
    background-color: var(--success-color);
}

.availability-indicator.busy {
    background-color: var(--danger-color);
}

.availability-indicator.partial {
    background-color: var(--warning-color);
}
