/* ═══════════════════════════════════════════════════════════
   Xplora360 — Design System: Components
   Botones, Cards, Forms, Modals, Chat, Badges, Toasts
   ═══════════════════════════════════════════════════════════ */

/* ─── BOTONES ────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 0.625rem 1.25rem;
    font-family: var(--font-body);
    font-size: var(--text-sm);
    font-weight: 600;
    line-height: 1.5;
    border: 2px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    min-height: 44px;
    white-space: nowrap;
    text-decoration: none;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-primary {
    background: var(--primary);
    color: var(--text-inverse);
    box-shadow: 0 1px 3px rgba(79, 70, 229, 0.3);
}
.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
    color: var(--text-inverse);
}

.btn-accent {
    background: var(--accent);
    color: #1a1a1a;
    box-shadow: 0 1px 3px rgba(245, 158, 11, 0.3);
}
.btn-accent:hover {
    background: var(--accent-dark);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.btn-success {
    background: var(--success);
    color: var(--text-inverse);
}
.btn-success:hover { background: #059669; }

.btn-danger {
    background: var(--danger);
    color: var(--text-inverse);
}
.btn-danger:hover { background: #DC2626; }

.btn-outline {
    background: transparent;
    border-color: var(--border-strong);
    color: var(--text-primary);
}
.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-50);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}
.btn-ghost:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.btn-sm {
    padding: 0.375rem 0.875rem;
    font-size: var(--text-xs);
    min-height: 36px;
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: var(--text-base);
    min-height: 52px;
    border-radius: var(--radius-md);
}

.btn-icon {
    padding: 0.5rem;
    min-height: 40px;
    min-width: 40px;
}

.btn-block { width: 100%; }

/* ─── CARDS ──────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: all var(--transition);
}

.card-hover:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    border-color: var(--border-strong);
}

.card-header {
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--border);
}

.card-body {
    padding: var(--space-6);
}

.card-footer {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--border);
    background: var(--surface-hover);
}

.card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.card-image-overlay {
    position: relative;
}

.card-image-overlay::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(to top, rgba(0,0,0,0.6), transparent);
    pointer-events: none;
}

/* ─── FORMULARIOS ────────────────────────────────────────── */
.form-group {
    margin-bottom: var(--space-5);
    position: relative;
}

.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

/* Inputs generados por crispy-forms/Bootstrap (.form-control):
   heredan el tema de Xplora360 para que sean legibles también en modo oscuro */
.form-control {
    display: block;
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-base);
    font-family: inherit;
    color: var(--text-primary);
    background-color: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-100);
    background-color: var(--background);
    color: var(--text-primary);
}

.form-control::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

select.form-control option {
    background-color: var(--surface);
    color: var(--text-primary);
}

/* Errores de validación de crispy-forms (Bootstrap los oculta sin su CSS) */
.form-control.is-invalid,
.is-invalid .form-control {
    border-color: var(--danger, #dc2626);
}

.invalid-feedback {
    display: block;
    color: var(--danger, #dc2626);
    font-size: var(--text-sm);
    margin-top: var(--space-1);
    font-weight: 500;
}

.alert-danger, .alert-block {
    background: rgba(220, 38, 38, 0.1);
    border: 1px solid var(--danger, #dc2626);
    color: var(--danger, #dc2626);
    border-radius: var(--radius);
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-4);
}

.form-label-required::after {
    content: ' *';
    color: var(--danger);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: var(--text-sm);
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    transition: all var(--transition);
    min-height: 44px;
}

.form-input:hover,
.form-select:hover,
.form-textarea:hover {
    border-color: var(--border-strong);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-100);
}

.form-input.is-invalid,
.form-select.is-invalid,
.form-textarea.is-invalid {
    border-color: var(--danger);
}

.form-input.is-invalid:focus {
    box-shadow: 0 0 0 3px var(--danger-light);
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2364748B' viewBox='0 0 16 16'%3E%3Cpath d='M4.646 6.646a.5.5 0 0 1 .708 0L8 9.293l2.646-2.647a.5.5 0 0 1 .708.708l-3 3a.5.5 0 0 1-.708 0l-3-3a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
}

.form-check {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    cursor: pointer;
    min-height: 44px;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
    cursor: pointer;
}

.form-help {
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    margin-top: var(--space-1);
}

.form-error {
    font-size: var(--text-xs);
    color: var(--danger);
    margin-top: var(--space-1);
}

/* El asesor dentro del área del usuario. La tarjeta ya trae su propio fondo,
   así que aquí solo hace falta aire alrededor. */
.hero-agente-usuario {
    margin-top: var(--space-8);
}

/* ─── DIRECTORIO DE UN SECTOR ────────────────────────────── */
/* Lo usan los tres: Turismo Rural, Turismo Urbano y Comercio Local. Estaba
   suelto dentro de la plantilla de comercio, y era la razón de que los otros
   dos sectores no tuvieran este diseño: copiarlo era demasiado trabajo. */
.dir-header { text-align: center; }

.dir-filtros {
    display: flex;
    justify-content: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

/* ─── Pestañas del área de trabajo ───────────────────────────────────────
   Unen las páginas del negocio (ficha, catálogo, cobros) después de partir
   los paneles de los tres sectores. Scroll horizontal en el móvil: antes de
   envolverlas en dos filas, es mejor que se arrastren. */
.pestanas-negocio {
    display: flex;
    gap: 0.4rem;
    overflow-x: auto;
    scrollbar-width: none;
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--space-6);
}

.pestanas-negocio::-webkit-scrollbar { display: none; }

.pestanas-negocio .pestana {
    flex: 0 0 auto;
    padding: 0.7rem 1.1rem;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    white-space: nowrap;
    transition: color var(--transition), border-color var(--transition);
}

.pestanas-negocio .pestana:hover { color: var(--text); }

.pestanas-negocio .pestana.activa {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

.dir-carrusel-wrap { position: relative; }

.dir-carrusel {
    display: flex;
    gap: 1.25rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding: 0.5rem 0.25rem 1rem;
    scrollbar-width: none;
}

.dir-carrusel::-webkit-scrollbar { display: none; }

.dir-card {
    position: relative;
    flex: 0 0 340px;
    height: 420px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    scroll-snap-align: start;
    text-decoration: none;
    background: var(--surface-hover);
    transition: transform var(--transition), box-shadow var(--transition);
}

.dir-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }

.dir-card-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.dir-card-ph {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4.5rem;
    background: linear-gradient(135deg, var(--primary-100), var(--warning-light));
}

.dir-card-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.92) 0%, rgba(0,0,0,0.62) 45%, rgba(0,0,0,0.25) 72%, rgba(0,0,0,0.05) 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1.25rem;
    color: white;
}

.dir-card-overlay .badge { align-self: flex-start; margin-bottom: 0.6rem; }
.dir-card-overlay h3 { color: white; margin: 0 0 0.3rem; text-shadow: 0 1px 8px rgba(0,0,0,0.5); }
.dir-card-loc { color: rgba(255,255,255,0.9); font-size: 0.85rem; margin: 0 0 0.6rem; }
.dir-card-desc { color: rgba(255,255,255,0.82); font-size: 0.85rem; line-height: 1.5; margin: 0 0 0.8rem; }

.dir-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    border-top: 1px solid rgba(255,255,255,0.2);
    padding-top: 0.7rem;
    font-size: 0.8rem;
    color: rgba(255,255,255,0.85);
}

.dir-card-dom {
    background: var(--success, #16a34a);
    color: white;
    border-radius: var(--radius-full);
    padding: 0.2rem 0.6rem;
    font-size: 0.72rem;
    font-weight: 600;
}

.dir-flecha {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-md);
    font-size: 1.4rem;
    line-height: 1;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
}

.dir-flecha:hover { background: var(--primary); color: white; }
.dir-flecha.prev { left: -10px; }
.dir-flecha.next { right: -10px; }

.dir-vacio { text-align: center; padding: 3rem 1rem; }

@media (max-width: 640px) {
    .dir-card { flex-basis: 82vw; height: 380px; }
    .dir-flecha { display: none; }   /* en móvil se desliza con el dedo */
}

/* Los paneles abren en lectura y se desbloquean con "Editar" (ver main.js).
   El fieldset es solo el interruptor: no debe verse como una caja. */
.campos-panel {
    border: 0;
    padding: 0;
    margin: 0;
    min-width: 0;   /* sin esto un fieldset no se encoge y desborda en el móvil */
}

.campos-panel:disabled {
    opacity: 0.75;
}

/* El mapa vive dentro del formulario de la ficha, y un fieldset deshabilitado
   no lo detiene: sin esto se podría arrastrar el marcador en modo lectura y
   el cambio no se guardaría en ninguna parte. */
.mapa-bloqueado {
    pointer-events: none;
    opacity: 0.75;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
}

@media (max-width: 640px) {
    .form-row { grid-template-columns: 1fr; }
}

/* Toggle switch */
.toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    cursor: pointer;
    min-height: 44px;
}

.toggle input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-track {
    width: 48px;
    height: 26px;
    background: var(--border-strong);
    border-radius: var(--radius-full);
    transition: background var(--transition);
    flex-shrink: 0;
}

.toggle-track::after {
    content: '';
    display: block;
    width: 20px;
    height: 20px;
    margin: 3px;
    background: white;
    border-radius: 50%;
    transition: transform var(--transition);
    box-shadow: var(--shadow-sm);
}

.toggle input:checked + .toggle-track {
    background: var(--primary);
}

.toggle input:checked + .toggle-track::after {
    transform: translateX(22px);
}

/* ─── BADGES ─────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: var(--text-xs);
    font-weight: 600;
    border-radius: var(--radius-full);
    line-height: 1.4;
}

.badge-primary {
    background: var(--primary-50);
    color: var(--primary);
}

.badge-success {
    background: var(--success-light);
    color: #065F46;
}

.badge-warning {
    background: var(--warning-light);
    color: #92400E;
}

.badge-danger {
    background: var(--danger-light);
    color: #991B1B;
}

.badge-info {
    background: var(--info-light);
    color: #1E40AF;
}

.badge-neutral {
    background: var(--surface-hover);
    color: var(--text-secondary);
}

/* ─── AVATAR ─────────────────────────────────────────────── */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border);
    flex-shrink: 0;
}

.avatar-sm { width: 32px; height: 32px; }
.avatar-lg { width: 56px; height: 56px; }
.avatar-xl { width: 80px; height: 80px; }
.avatar-2xl { width: 120px; height: 120px; }

.avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-100);
    color: var(--primary);
    font-weight: 700;
    font-family: var(--font-heading);
}

/* ─── RATING (Estrellas) ─────────────────────────────────── */
.rating-stars {
    display: inline-flex;
    gap: 2px;
    color: var(--accent);
    font-size: var(--text-lg);
}

.rating-stars .star-empty {
    color: var(--border-strong);
}

.rating-value {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--text-primary);
    margin-left: var(--space-2);
}

/* ─── TABLAS ─────────────────────────────────────────────── */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

.table th {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--surface-hover);
    border-bottom: 2px solid var(--border);
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

.table-sm th,
.table-sm td {
    padding: var(--space-2) var(--space-3);
}

.table tbody tr:hover {
    background: var(--surface-hover);
}

/* ─── TABS ───────────────────────────────────────────────── */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    gap: 0;
    overflow-x: auto;
}

.tab {
    padding: var(--space-3) var(--space-5);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}

.tab:hover {
    color: var(--primary);
    background: var(--primary-50);
}

.tab-active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

.tab-content {
    display: none;
    padding: var(--space-6) 0;
    animation: fadeIn 0.2s ease-out;
}

.tab-content.active {
    display: block;
}

/* ─── MODAL ──────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: var(--z-modal-backdrop);
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    animation: fadeInUp 0.3s ease-out;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: var(--text-lg);
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: var(--radius);
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-xl);
    transition: all var(--transition);
}

.modal-close:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: var(--space-6);
}

.modal-footer {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
}

/* ─── CHAT BUBBLES ───────────────────────────────────────── */
.chat-container {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    padding: var(--space-4);
    max-height: 500px;
    overflow-y: auto;
}

.chat-message {
    display: flex;
    gap: var(--space-3);
    max-width: 80%;
    animation: fadeIn 0.3s ease-out;
}

.chat-message-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-bubble {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
    line-height: 1.6;
    word-break: break-word;
}

.chat-bubble-agent {
    background: var(--surface-hover);
    color: var(--text-primary);
    border-bottom-left-radius: var(--radius-sm);
}

.chat-bubble-user {
    background: var(--primary);
    color: var(--text-inverse);
    border-bottom-right-radius: var(--radius-sm);
}

.chat-typing {
    display: flex;
    gap: 4px;
    padding: var(--space-3) var(--space-4);
    background: var(--surface-hover);
    border-radius: var(--radius-lg);
    width: fit-content;
}

.chat-typing span {
    width: 8px;
    height: 8px;
    background: var(--text-tertiary);
    border-radius: 50%;
    animation: pulse 1.4s ease-in-out infinite;
}

.chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing span:nth-child(3) { animation-delay: 0.4s; }

.chat-input-area {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-4);
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.chat-input {
    flex: 1;
    padding: var(--space-3) var(--space-4);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    background: var(--background);
    min-height: 44px;
}

.chat-input:focus {
    outline: none;
    border-color: var(--primary);
}

/* ─── TOAST NOTIFICATIONS ────────────────────────────────── */
.toast-container {
    position: fixed;
    top: var(--space-4);
    right: var(--space-4);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    font-size: var(--text-sm);
    font-weight: 500;
    min-width: 300px;
    max-width: 420px;
    pointer-events: all;
    animation: slideInRight 0.3s ease-out;
}

.toast-success { border-left: 4px solid var(--success); }
.toast-error { border-left: 4px solid var(--danger); }
.toast-warning { border-left: 4px solid var(--warning); }
.toast-info { border-left: 4px solid var(--info); }

/* ─── SKELETON LOADERS ───────────────────────────────────── */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--surface-hover) 25%,
        var(--border) 50%,
        var(--surface-hover) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius);
}

.skeleton-text {
    height: 16px;
    margin-bottom: var(--space-2);
}

.skeleton-heading {
    height: 28px;
    width: 60%;
    margin-bottom: var(--space-3);
}

.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

.skeleton-image {
    width: 100%;
    height: 200px;
}

/* ─── DROPDOWN ───────────────────────────────────────────── */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 200px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: var(--z-dropdown);
    padding: var(--space-2);
    display: none;
    animation: fadeIn 0.15s ease-out;
}

.dropdown-menu.active {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-sm);
    color: var(--text-primary);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background var(--transition-fast);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    min-height: 40px;
}

.dropdown-item:hover {
    background: var(--surface-hover);
    color: var(--primary);
}

.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: var(--space-2) 0;
}

/* ─── ALERTAS ────────────────────────────────────────────── */
.alert {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    font-size: var(--text-sm);
    line-height: 1.5;
    border: 1px solid;
}

.alert-success {
    background: var(--success-light);
    border-color: var(--success);
    color: #065F46;
}

.alert-danger {
    background: var(--danger-light);
    border-color: var(--danger);
    color: #991B1B;
}

.alert-warning {
    background: var(--warning-light);
    border-color: var(--warning);
    color: #92400E;
}

.alert-info {
    background: var(--info-light);
    border-color: var(--info);
    color: #1E40AF;
}

/* ─── EMPTY STATE ────────────────────────────────────────── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-16) var(--space-8);
    text-align: center;
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: var(--space-4);
    opacity: 0.5;
}

.empty-state h3 {
    font-size: var(--text-xl);
    margin-bottom: var(--space-2);
}

.empty-state p {
    max-width: 400px;
    margin-bottom: var(--space-6);
}

/* ─── Carrusel de destacados (portada, uno por sector) ───────────────── */
.dest-wrap { position: relative; }
.dest-pista {
    display: flex;
    gap: 1.25rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding: 0.5rem 0.25rem 1rem;
    scrollbar-width: none;
}
.dest-pista::-webkit-scrollbar { display: none; }

.dest-card {
    flex: 0 0 260px;
    scroll-snap-align: start;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    transition: transform var(--transition), box-shadow var(--transition);
}
.dest-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }

.dest-img { width: 100%; height: 150px; object-fit: cover; display: block; }
.dest-img-ph {
    display: flex; align-items: center; justify-content: center;
    font-size: 3rem;
    background: linear-gradient(135deg, var(--primary-100), var(--surface-hover));
}
.dest-body { padding: 0.9rem; display: flex; flex-direction: column; flex: 1; }
.dest-nombre { font-size: 1rem; margin: 0 0 0.2rem; line-height: 1.3; }
.dest-meta { font-size: 0.82rem; color: var(--text-secondary); margin: 0 0 0.6rem; }
/* Distancia al visitante: se destaca porque es el criterio de orden */
.dest-distancia {
    display: inline-block;
    margin-left: 0.4rem;
    padding: 0.05rem 0.4rem;
    border-radius: var(--radius-full);
    background: var(--primary-50);
    color: var(--primary);
    font-weight: 600;
    white-space: nowrap;
}
.dest-pie {
    margin-top: auto;
    display: flex; justify-content: space-between; align-items: center; gap: 0.5rem;
    border-top: 1px solid var(--border);
    padding-top: 0.6rem;
}

.dest-flecha {
    position: absolute; top: 45%; transform: translateY(-50%);
    width: 40px; height: 40px; border-radius: 50%; border: none; cursor: pointer;
    background: var(--surface); color: var(--text); box-shadow: var(--shadow-md);
    font-size: 1.5rem; line-height: 1; z-index: 3;
    display: flex; align-items: center; justify-content: center;
}
.dest-flecha:hover { background: var(--primary); color: #fff; }
.dest-flecha.prev { left: -14px; }
.dest-flecha.next { right: -14px; }
@media (max-width: 700px) {
    .dest-flecha { display: none; }
    .dest-card { flex-basis: 78%; }
}

/* ─── Aviso de ubicación obligatoria (paneles de negocio) ──── */
.aviso-ubicacion {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    flex-wrap: wrap;
    padding: var(--space-4) var(--space-5);
    margin-bottom: var(--space-6);
    border: 1px solid #F59E0B;
    border-left: 4px solid #F59E0B;
    border-radius: var(--radius-lg);
    background: rgba(245, 158, 11, 0.08);
}
.aviso-ubicacion > div { flex: 1; min-width: 240px; }
.aviso-ubicacion strong { display: block; margin-bottom: 0.25rem; }
.aviso-ubicacion p { margin: 0; font-size: 0.88rem; color: var(--text-secondary); }
.aviso-ubicacion-icono { font-size: 1.6rem; line-height: 1; }

/* Marca de campo obligatorio en los títulos de tarjeta */
.obligatorio {
    margin-left: 0.4rem;
    padding: 0.1rem 0.45rem;
    border-radius: var(--radius-full);
    background: rgba(245, 158, 11, 0.15);
    color: #B45309;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    vertical-align: middle;
}

/* ─── Separación entre los carruseles de destacados ──────────
   Con el relleno estándar de .section quedaban 238 px entre un sector y
   el siguiente: tanto aire que el visitante creía que la página había
   terminado y dejaba de bajar. Aquí se aprieta a poco más de la mitad,
   manteniendo el encabezado con aire suficiente para no verse apelmazado. */
.dest-seccion { padding-top: var(--space-5); padding-bottom: var(--space-5); }
.dest-seccion .section-header { margin-bottom: var(--space-2); }
/* El encabezado tambien aporta: el titulo y su bajada iban muy separados */
.dest-seccion .section-header h2 { margin-bottom: var(--space-1); }
.dest-seccion .section-header p { font-size: var(--text-base); }

@media (max-width: 768px) {
    .dest-seccion { padding-top: var(--space-3); padding-bottom: var(--space-3); }
    .dest-seccion .section-header { margin-bottom: var(--space-2); }

    /* En movil el grueso del hueco no era el relleno sino el encabezado:
       el boton "Ver todos" caia a su propia linea y la bajada ocupaba otra.
       Aqui el titulo y el boton comparten fila y la bajada se retira: el
       titulo del sector ya dice lo mismo en una pantalla estrecha. */
    .dest-seccion .section-header {
        flex-wrap: nowrap;
        align-items: center;
        gap: var(--space-2);
    }
    .dest-seccion .section-header p { display: none; }
    .dest-seccion .section-header h2 { font-size: var(--text-xl); margin-bottom: 0; }
    .dest-seccion .section-header > a { flex-shrink: 0; }
}

/* ═══ BOTÓN DE COMPARTIR ═══
   El menú solo se ve en escritorio: en el teléfono se abre la hoja de
   compartir del sistema y este desplegable nunca llega a mostrarse. */
.compartir {
    position: relative;
    display: inline-block;
}

.compartir-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    min-width: 190px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: var(--z-dropdown);
    padding: var(--space-2);
    animation: fadeIn 0.15s ease-out;
}

.compartir-menu[hidden] {
    display: none;
}

/* Dentro de un contenedor con overflow: hidden (el hero de la portada tiene
   uno por el video de fondo) un menú hacia abajo se recorta: ahí abre arriba. */
.compartir-arriba .compartir-menu {
    top: auto;
    bottom: calc(100% + 6px);
}

.compartir-menu a,
.compartir-menu button {
    display: block;
    width: 100%;
    text-align: left;
    padding: var(--space-2) var(--space-3);
    border: none;
    background: none;
    /* El menú puede abrirse sobre la portada, cuyo texto es blanco: el color
       se fija aquí a propósito para no heredarlo y quedar ilegible. */
    color: var(--text-primary);
    font: inherit;
    font-size: var(--text-sm);
    border-radius: var(--radius-md);
    cursor: pointer;
    text-decoration: none;
}

.compartir-menu a:hover,
.compartir-menu button:hover {
    background: var(--surface-hover);
}

/* Pegado al borde derecho, el menú se saldría de la pantalla en móviles
   estrechos donde la hoja del sistema no esté disponible. */
@media (max-width: 480px) {
    .compartir-menu {
        left: auto;
        right: 0;
    }
}

/* En la portada va entre los accesos secundarios, con su mismo aspecto: es una
   acción secundaria y no debe competir con lo que la gente viene a hacer. */
.hero-compartir-btn {
    border: none;
    background: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
    padding: 0;
}

.hero-compartir-btn:hover {
    text-decoration: underline;
}

/* ═══ BOTÓN DE INSTALAR Y SU GUÍA PARA iPHONE ═══ */
#btn-instalar[hidden] {
    display: none;
}

.guia-instalar {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal, 1000);
    background: rgba(15, 23, 42, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
}

.guia-instalar[hidden] {
    display: none;
}

.guia-instalar-caja {
    background: var(--surface);
    color: var(--text-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: var(--space-6);
    max-width: 420px;
    width: 100%;
}

.guia-instalar-caja ol {
    margin: var(--space-3) 0 0;
    padding-left: var(--space-5);
    line-height: 1.8;
    /* El reset global quita las viñetas; aquí los números sí importan, porque
       son los dos pasos que el usuario tiene que seguir en orden. */
    list-style: decimal;
}

/* ═══ COMPARTIR FLOTANTE ═══
   Redondo y fijo en la esquina, como cualquier acción principal de una app.
   Antes era un enlace de texto perdido entre los accesos secundarios y nadie
   lo encontraba. */
.compartir-flotante {
    position: fixed;
    right: var(--space-4);
    bottom: var(--space-4);
    z-index: var(--z-dropdown);
}

.compartir-fab {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: #fff;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, background 0.15s ease;
}

.compartir-fab:hover {
    background: var(--primary-dark);
    transform: scale(1.06);
}

/* El menú abre hacia arriba y hacia la izquierda: pegado abajo a la derecha,
   hacia cualquier otro lado se saldría de la pantalla. */
.compartir-flotante .compartir-menu {
    top: auto;
    bottom: calc(100% + 10px);
    left: auto;
    right: 0;
}

@media (max-width: 480px) {
    .compartir-flotante {
        right: var(--space-3);
        bottom: var(--space-3);
    }
}

/* ═══ BOTÓN DE DICTAR ═══
   Compartido por la portada y los chats del agente. */
.btn-dictar {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease;
}

.btn-dictar[hidden] {
    display: none;
}

.btn-dictar:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

/* Mientras escucha: rojo y latiendo, para que se note que el micrófono está
   abierto y nadie lo deje corriendo sin darse cuenta. */
.btn-dictar.dictando {
    background: var(--danger);
    border-color: transparent;
    color: #fff;
    animation: latido-dictado 1.2s ease-in-out infinite;
}

@keyframes latido-dictado {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.09); }
}

/* En la portada va dentro del recuadro, a la izquierda del botón de enviar,
   que está pegado al borde derecho. */
.agent-dictar-btn {
    position: absolute;
    right: 58px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    background: transparent;
    border-color: transparent;
}

.agent-dictar-btn.dictando {
    background: var(--danger);
    animation-name: latido-dictado-centrado;
}

/* El de la portada está centrado con translateY, así que su latido tiene que
   conservarlo o saltaría al empezar a escuchar. */
@keyframes latido-dictado-centrado {
    0%, 100% { transform: translateY(-50%) scale(1); }
    50% { transform: translateY(-50%) scale(1.09); }
}

@media (prefers-reduced-motion: reduce) {
    .btn-dictar.dictando { animation: none; }
}

/* ─── Utilidades de bordes y fondos ─────────────────────────
   Van al final del archivo para pisar el borde de componentes como .card,
   que tienen la misma especificidad. El grosor va antes que el color: así
   border-l-4 border-l-primary deja el borde de 4px y del color del sector. */
.rounded { border-radius: var(--radius); }
.border-t { border-top: 1px solid var(--border); }
.border-b { border-bottom: 1px solid var(--border); }
.border-l-4 { border-left: 4px solid var(--border); }
.border-t-4 { border-top: 4px solid var(--border); }
.border-l-primary { border-left-color: var(--primary); }
.border-t-primary { border-top-color: var(--primary); }
.border-t-success { border-top-color: var(--success); }
.border-t-warning { border-top-color: var(--warning); }
.bg-surface-hover { background: var(--surface-hover); }
