/**
 * Estilos del Módulo de Reservas
 * Diseño estilo OpenAI con mapa de mesas 70% y timeline 30%
 */

/* ============================================== 
   LAYOUT PRINCIPAL 70/30
   ============================================== */

#reservas .content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 0;
}

#reservas .content-header h1 {
    font-size: 24px;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.reservas-date-filter {
    display: flex;
    align-items: center;
    gap: 12px;
}

.reservas-date-filter .date-input {
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    color: #374151;
    background-color: #f9fafb;
    transition: all 0.2s ease;
}

.reservas-date-filter .date-input:focus {
    outline: none;
    border-color: #3b82f6;
    background-color: #ffffff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.reservas-franja-selector {
    display: flex;
    gap: 4px;
    background: #f3f4f6;
    padding: 4px;
    border-radius: 8px;
}

.franja-btn {
    padding: 6px 12px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
}

.franja-btn:hover {
    background: #e5e7eb;
    color: #111827;
}

.franja-btn.active {
    background: #ffffff;
    color: #111827;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.reservas-layout {
    display: grid;
    grid-template-columns: 70% 30%;
    gap: 0;
    height: calc(100vh - 140px);
    overflow: hidden;
}

/* ============================================== 
   CONTENEDOR DEL MAPA (70%)
   ============================================== */

.reservas-map-container {
    display: flex;
    flex-direction: column;
    background: #f9fafb;
    border-right: 1px solid #e5e7eb;
    overflow: hidden;
}

.reservas-zona-tabs {
    display: flex;
    gap: 8px;
    padding: 16px 24px;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    overflow-x: auto;
    flex-shrink: 0;
}

.reservas-zona-tab {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
    background: #f3f4f6;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    border: 2px solid transparent;
}

.reservas-zona-tab:hover {
    background: #e5e7eb;
    color: #374151;
}

.reservas-zona-tab.active {
    background: #eff6ff;
    color: #2563eb;
    border-color: #2563eb;
}

.reservas-map-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
    padding: 16px;
}

#reservas-map {
    position: relative;
    min-height: 100%;
    display: inline-block;
}

/* ============================================== 
   MESAS - ESTILO CARDS
   ============================================== */

.reservas-mesa-card {
    position: absolute;
    width: fit-content;
    min-width: 60px;
    background: #ffffff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.reservas-mesa-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: #3b82f6;
}

.reservas-mesa-card.libre {
    border-color: #e5e7eb;
    background: #ffffff;
}

.reservas-mesa-card.libre:hover {
    border-color: #22c55e;
}

.reservas-mesa-card.proxima {
    border-color: #22c55e;
    background: #f0fdf4;
}

.reservas-mesa-card.cercana {
    border-color: #eab308;
    background: #fefce8;
}

.reservas-mesa-card.inmediata {
    border-color: #ef4444;
    background: #fef2f2;
    animation: pulse-alert 2s ease-in-out infinite;
}

.reservas-mesa-card.pasada {
    border-color: #9ca3af;
    background: #f9fafb;
    opacity: 0.7;
}

@keyframes pulse-alert {
    0%, 100% { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); }
    50% { box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3); }
}

.reservas-mesa-card.drag-over {
    border-color: #3b82f6;
    background: #eff6ff;
    border-style: dashed;
}

.mesa-nombre {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mesa-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    background: #3b82f6;
    color: #ffffff;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.mesa-reserva-info {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 4px;
}

.mesa-reserva-cliente {
    font-weight: 500;
    color: #111827;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mesa-reserva-hora {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
}

.mesa-reserva-hora svg {
    width: 14px;
    height: 14px;
}

.mesa-imagen-decorativa {
    position: absolute;
    pointer-events: none;
    opacity: 0.6;
}

.mesa-imagen-decorativa img {
    max-width: 100%;
    height: auto;
}

/* ============================================== 
   TIMELINE LATERAL (30%)
   ============================================== */

.reservas-timeline-panel {
    display: flex;
    flex-direction: column;
    background: #ffffff;
    overflow: hidden;
}

.timeline-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.timeline-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.timeline-list {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.timeline-franja {
    margin-bottom: 24px;
}

.timeline-franja-hora {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.timeline-franja-hora::before {
    content: '';
    display: block;
    width: 8px;
    height: 8px;
    background: #3b82f6;
    border-radius: 50%;
}

.timeline-reserva-item {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 8px;
    cursor: grab;
    transition: all 0.2s ease;
}

.timeline-reserva-item:hover {
    border-color: #3b82f6;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.timeline-reserva-item.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.timeline-reserva-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.timeline-reserva-mesa {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: #eff6ff;
    color: #2563eb;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.timeline-reserva-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.timeline-reserva-status.pendiente {
    background: #9ca3af;
}

.timeline-reserva-status.confirmada {
    background: #22c55e;
}

.timeline-reserva-status.en-curso {
    background: #3b82f6;
}

.timeline-reserva-status.completada {
    background: #6b7280;
}

.timeline-reserva-status.cancelada {
    background: #ef4444;
}

.timeline-reserva-cliente {
    font-size: 14px;
    font-weight: 500;
    color: #111827;
    margin-bottom: 4px;
}

.timeline-reserva-detalles {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: #6b7280;
}

.timeline-reserva-comensales,
.timeline-reserva-duracion {
    display: flex;
    align-items: center;
    gap: 4px;
}

.timeline-reserva-notas {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #f3f4f6;
    font-size: 12px;
    color: #6b7280;
    font-style: italic;
}

.timeline-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
    text-align: center;
    color: #9ca3af;
}

.timeline-empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.timeline-empty-state p {
    font-size: 14px;
    margin: 0;
}

/* ============================================== 
   MODAL DE RESERVA
   ============================================== */

.reserva-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;
    backdrop-filter: blur(2px);
}

.reserva-modal {
    background: #ffffff;
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

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

.reserva-modal-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: #111827;
    margin: 0;
}


.reserva-modal-close:hover {
    background: #e5e7eb;
}

.reserva-modal-close svg {
    width: 20px;
    height: 20px;
    color: #6b7280;
}

.reserva-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.reserva-modal-section {
    margin-bottom: 24px;
}

.reserva-modal-section:last-child {
    margin-bottom: 0;
}

.reserva-modal-section-title {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.reserva-historico-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
    max-height: 200px;
    overflow-y: auto;
}

.reserva-historico-item {
    padding: 10px 12px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 13px;
}

.reserva-historico-item-hora {
    font-weight: 600;
    color: #111827;
    margin-bottom: 4px;
}

.reserva-historico-item-cliente {
    color: #6b7280;
}

.reserva-form-group {
    margin-bottom: 16px;
    position: relative;
}

.reserva-form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
}

.reserva-form-label.required::after {
    content: '*';
    color: #ef4444;
    margin-left: 4px;
}

.reserva-form-input,
.reserva-form-select,
.reserva-form-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    color: #111827;
    background-color: #ffffff;
    transition: all 0.2s ease;
}

.reserva-form-input:focus,
.reserva-form-select:focus,
.reserva-form-textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.reserva-form-textarea {
    resize: vertical;
    min-height: 80px;
}

.reserva-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Búsqueda de clientes */
.cliente-search-container {
    position: relative;
}

.cliente-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.cliente-search-results.active {
    display: block;
}

.cliente-search-item {
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid #f3f4f6;
}

.cliente-search-item:last-child {
    border-bottom: none;
}

.cliente-search-item:hover {
    background: #f9fafb;
}

.cliente-search-item-nombre {
    font-size: 14px;
    font-weight: 500;
    color: #111827;
    margin-bottom: 2px;
}

.cliente-search-item-info {
    font-size: 12px;
    color: #6b7280;
}

.cliente-crear-rapido {
    padding: 10px 12px;
    background: #eff6ff;
    border-top: 1px solid #e5e7eb;
    color: #2563eb;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
}

.cliente-crear-rapido:hover {
    background: #dbeafe;
}

.cliente-selected {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: #f0fdf4;
    border: 1px solid #22c55e;
    border-radius: 8px;
    margin-bottom: 12px;
}

.cliente-selected-info {
    flex: 1;
}

.cliente-selected-nombre {
    font-size: 14px;
    font-weight: 500;
    color: #111827;
    margin-bottom: 2px;
}

.cliente-selected-telefono {
    font-size: 12px;
    color: #6b7280;
}

.cliente-selected-remove {
    padding: 6px 12px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 12px;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cliente-selected-remove:hover {
    background: #f9fafb;
    color: #111827;
}

.reserva-modal-footer {
    padding: 20px 24px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.btn-modal {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-modal-secondary {
    background: #f3f4f6;
    color: #374151;
}

.btn-modal-secondary:hover {
    background: #e5e7eb;
}

.btn-modal-danger {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.btn-modal-danger:hover {
    background: #fee2e2;
}

.btn-modal-primary {
    background: #3b82f6;
    color: #ffffff;
}

.btn-modal-primary:hover {
    background: #2563eb;
}

.btn-modal-primary:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

/* ============================================== 
   ALERTAS Y NOTIFICACIONES
   ============================================== */

.reserva-conflict-alert {
    padding: 12px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.reserva-conflict-alert svg {
    width: 20px;
    height: 20px;
    color: #dc2626;
    flex-shrink: 0;
    margin-top: 2px;
}

.reserva-conflict-alert-content {
    flex: 1;
}

.reserva-conflict-alert-title {
    font-size: 14px;
    font-weight: 600;
    color: #991b1b;
    margin-bottom: 4px;
}

.reserva-conflict-alert-message {
    font-size: 13px;
    color: #7f1d1d;
}

/* ============================================== 
   RESPONSIVE
   ============================================== */

@media (max-width: 1024px) {
    .reservas-layout {
        grid-template-columns: 60% 40%;
    }
}

@media (max-width: 768px) {
    .reservas-layout {
        grid-template-columns: 1fr;
        grid-template-rows: 60% 40%;
    }
    
    .reservas-map-container {
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
    }
    
    .reserva-modal {
        width: 95%;
        max-height: 95vh;
    }
}

/* ============================================== 
   MODAL EDITAR RESERVA
   ============================================== */

.reserva-edit-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.btn-edit-action {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-edit-action svg {
    width: 16px;
    height: 16px;
}

.btn-edit-action.btn-edit {
    color: #2563eb;
    border-color: #2563eb;
}

.btn-edit-action.btn-edit:hover {
    background: #eff6ff;
}

.btn-edit-action.btn-delete {
    color: #dc2626;
    border-color: #dc2626;
}

.btn-edit-action.btn-delete:hover {
    background: #fef2f2;
}

.btn-edit-action.btn-notify {
    color: #16a34a;
    border-color: #16a34a;
}

.btn-edit-action.btn-notify:hover {
    background: #f0fdf4;
}

/* ============================================== 
   MODAL AFILIADOS
   ============================================== */

.afiliados-btn {
    padding: 8px 16px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.afiliados-btn:hover {
    background: #f9fafb;
    border-color: #3b82f6;
    color: #2563eb;
}

.afiliados-btn svg {
    width: 18px;
    height: 18px;
}

/* Tabs de afiliados */
.afiliados-tab {
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    margin-bottom: -1px;
}

.afiliados-tab:hover {
    color: #111827;
    background: #f9fafb;
}

.afiliados-tab.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
    background: transparent;
}

.afiliados-tab svg {
    transition: all 0.2s ease;
}

.afiliados-tab-content {
    display: none;
}

.afiliados-tab-content.active {
    display: block;
}

.afiliados-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

.afiliado-item {
    padding: 16px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.afiliado-item:hover {
    border-color: #3b82f6;
    background: #eff6ff;
}

.afiliado-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.afiliado-item-nombre {
    font-size: 15px;
    font-weight: 600;
    color: #111827;
}

.afiliado-item-comision {
    font-size: 14px;
    font-weight: 600;
    color: #16a34a;
}

.afiliado-item-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 12px;
    color: #6b7280;
    font-family: monospace;
    margin-bottom: 8px;
    word-break: break-all;
}

.afiliado-item-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.btn-afiliado-action {
    padding: 6px 12px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-afiliado-action.btn-copy {
    color: #2563eb;
}

.btn-afiliado-action.btn-copy:hover {
    background: #eff6ff;
    border-color: #2563eb;
}

.btn-afiliado-action.btn-delete-afiliado {
    color: #dc2626;
}

.btn-afiliado-action.btn-delete-afiliado:hover {
    background: #fef2f2;
    border-color: #dc2626;
}

.afiliados-empty {
    text-align: center;
    padding: 48px 24px;
    color: #9ca3af;
}

.afiliados-empty svg {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    opacity: 0.5;
}

/* Timeline item clickable */
.timeline-reserva-item {
    cursor: pointer;
}

.timeline-reserva-item:active {
    transform: scale(0.98);
}

.timeline-reserva-telefono {
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
}

/* ============================================== 
   BLOQUEADOR DE ESTABLECIMIENTO
   ============================================== */

.reservas-blocker {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: 8px;
}

.reservas-blocker-content {
    text-align: center;
    padding: 48px 24px;
    max-width: 400px;
}

.reservas-blocker-content svg {
    width: 64px;
    height: 64px;
    color: #9ca3af;
    margin-bottom: 24px;
}

.reservas-blocker-content h3 {
    font-size: 20px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 12px 0;
}

.reservas-blocker-content p {
    font-size: 14px;
    color: #6b7280;
    line-height: 1.5;
    margin: 0;
}

