/* ─── gestion.css — estilos compartidos de las vistas de gestión ──────────── */

/* ─── Tabs ─────────────────────────────────────────────────────────────────── */
.gestion-tabs {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    padding: 16px 20px 0;
    border-bottom: 2px solid #e9ecef;
    background: #fff;
}

.gestion-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 9px 18px;
    font-size: 13.5px;
    font-weight: 500;
    color: #6b7280;
    background: transparent;
    border: none;
    border-bottom: 2.5px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    border-radius: 6px 6px 0 0;
    transition: color .15s, border-color .15s, background .15s;
    white-space: nowrap;
}

.gestion-tab:hover {
    color: #105ea6;
    background: #f0f6ff;
}

.gestion-tab.is-active {
    color: #105ea6;
    border-bottom-color: #105ea6;
    background: #f0f6ff;
    font-weight: 600;
}

.gestion-tab-panel {
    display: none;
}

.gestion-tab-panel.is-active {
    display: block;
}

/* Cabecera de pestaña (search + botón) */
.gestion-tab-head {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 16px 20px;
}

.gestion-tab-head__title {
    flex: 1;
    min-width: 0;
}

.gestion-tab-head__title h3 {
    font-size: 15px;
    font-weight: 600;
    color: #1a2233;
    margin: 0;
}

.gestion-tab-head__title p {
    font-size: 12.5px;
    color: #6b7280;
    margin: 2px 0 0;
}

.gestion-tab-head__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

/* ─── Modal ─────────────────────────────────────────────────────────────────── */
.gestion-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .55);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 900;
    padding: 16px;
}

.gestion-modal[hidden] {
    display: none;
}

.gestion-modal__box {
    background: #fff;
    border-radius: 14px;
    padding: 28px 28px 22px;
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,.18);
}

.gestion-modal__close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #f1f5f9;
    color: #475569;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background .15s, color .15s;
}

.gestion-modal__close:hover {
    background: #e2e8f0;
    color: #1a2233;
}

.gestion-modal__title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 17px;
    font-weight: 700;
    color: #1a2233;
    margin: 0 0 20px;
}

.gestion-modal__title i {
    color: #105ea6;
    font-size: 16px;
}

.gestion-modal__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 16px;
}

.gestion-modal__field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.gestion-modal__field--full {
    grid-column: 1 / -1;
}

.gestion-modal__label {
    font-size: 12.5px;
    font-weight: 600;
    color: #374151;
    letter-spacing: .01em;
}

.gestion-modal__label span {
    color: #ef4444;
}

.gestion-modal__input,
.gestion-modal__select {
    padding: 8px 11px;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    font-size: 13.5px;
    color: #1a2233;
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
    outline: none;
    width: 100%;
    box-sizing: border-box;
}

.gestion-modal__input:focus,
.gestion-modal__select:focus {
    border-color: #105ea6;
    box-shadow: 0 0 0 3px rgba(16,94,166,.12);
}

.gestion-modal__input--file {
    padding: 6px 11px;
    cursor: pointer;
}

/* Logo preview */
.gestion-logo-preview {
    width: 72px;
    height: 72px;
    border-radius: 8px;
    object-fit: contain;
    border: 1.5px solid #e9ecef;
    background: #f8fafc;
    display: none;
    margin-top: 6px;
}

.gestion-logo-preview.is-visible {
    display: block;
}

.gestion-modal__error {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12.5px;
    color: #dc2626;
    margin: 12px 0 0;
}

.gestion-modal__error[hidden] {
    display: none;
}

.gestion-modal__footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #f1f5f9;
}

/* ─── Confirm dialog ────────────────────────────────────────────────────────── */
.gestion-confirm {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,.6);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}

.gestion-confirm[hidden] {
    display: none;
}

.gestion-confirm__box {
    background: #fff;
    border-radius: 14px;
    padding: 28px 28px 22px;
    width: 100%;
    max-width: 440px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
}

.gestion-confirm__icon {
    font-size: 36px;
    color: #f59e0b;
    margin-bottom: 12px;
}

.gestion-confirm__title {
    font-size: 16px;
    font-weight: 700;
    color: #1a2233;
    margin: 0 0 8px;
}

.gestion-confirm__body {
    font-size: 13.5px;
    color: #6b7280;
    margin: 0 0 20px;
}

.gestion-confirm__footer {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.gestion-confirm__ok {
    background: #dc2626 !important;
    color: #fff !important;
}

.gestion-confirm__ok:hover {
    background: #b91c1c !important;
}

/* ─── Toast ─────────────────────────────────────────────────────────────────── */
.gestion-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    background: #1a2233;
    color: #fff;
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 500;
    z-index: 2000;
    box-shadow: 0 8px 24px rgba(0,0,0,.22);
    animation: toast-in .25s ease;
}

.gestion-toast[hidden] {
    display: none;
}

.gestion-toast--success .gestion-toast__icon { color: #22c55e; }
.gestion-toast--error   .gestion-toast__icon { color: #ef4444; }

@keyframes toast-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ─── Tabla dentro de tab panel ─────────────────────────────────────────────── */
.gestion-table-wrap {
    overflow-x: auto;
    padding: 0 20px 20px;
}

/* Tom Select overrides para modales de gestión */
.gestion-modal__field .ts-wrapper {
    width: 100%;
}

.gestion-modal__field .ts-control {
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    padding: 7px 11px;
    font-size: 13.5px;
    min-height: 38px;
    box-shadow: none;
    background: #fff;
}

.gestion-modal__field .ts-control:focus-within {
    border-color: #105ea6;
    box-shadow: 0 0 0 3px rgba(16,94,166,.12);
}

/* El dropdown de Tom Select se inserta en <body> (dropdownParent: 'body'),
   por lo que necesita un z-index mayor al del modal para no quedar oculto detrás. */
.ts-dropdown {
    z-index: 1500 !important;
}

@media (max-width: 560px) {
    .gestion-modal__grid {
        grid-template-columns: 1fr;
    }
    .gestion-modal__field--full {
        grid-column: 1;
    }
}

/* ─── Paginación ─────────────────────────────────────────────────────────────── */
.gestion-pagination-wrap {
    padding: 6px 20px 16px;
    display: flex;
    justify-content: center;
    min-height: 44px;
}

.gestion-pagination {
    display: flex;
    align-items: center;
    gap: 4px;
}

.gestion-pag-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 10px;
    border: 1.5px solid #e2e8f0;
    border-radius: 7px;
    background: #fff;
    color: #374151;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background .12s, border-color .12s, color .12s;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.gestion-pag-btn:hover:not(:disabled):not(.is-active) {
    background: #f0f6ff;
    border-color: #105ea6;
    color: #105ea6;
}

.gestion-pag-btn.is-active {
    background: #105ea6;
    border-color: #105ea6;
    color: #fff;
    cursor: default;
    pointer-events: none;
}

.gestion-pag-btn:disabled {
    opacity: 0.38;
    cursor: not-allowed;
}

/* ─── Lista de ciudades afectadas dentro del confirm de eliminación ────────── */
.gestion-confirm__warn-list {
    margin-top: 14px;
    text-align: left;
    background: #fff7ed;
    border: 1.5px solid #fed7aa;
    border-radius: 9px;
    padding: 10px 14px 10px 14px;
    font-size: 12.5px;
    color: #92400e;
}

.gestion-confirm__warn-list strong {
    display: block;
    margin-bottom: 6px;
    color: #78350f;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.gestion-confirm__warn-list ul {
    margin: 0;
    padding-left: 18px;
    max-height: 140px;
    overflow-y: auto;
}

.gestion-confirm__warn-list li {
    margin-bottom: 3px;
    line-height: 1.4;
}
