/* web/css/trip_modals.css
   Modales de viajes (detalle, crear/editar, equipo, confirmaciones) y aviso
   flotante. Se cargan en todas las páginas desde el footer, igual que los modales.
   Los formularios siguen el patrón de los modales de formulario de la web:
   cabecera bg-success con el título, nota de campos obligatorios, etiquetas en
   mayúsculas, inputs con icono y borde verde de 2px, listas en caja oscura y pie
   con Cancelar (btn-outline-secondary) + botón verde (btn-success).
   ───────────────────────────────────────────────────────────────────────── */

.tm-modal,
.tm-toast {
    --tm-card: var(--rcw-bg-card, #1e293b);
    --tm-card-2: #172133;
    --tm-ink: #0b1220;
    --tm-field: #0d1117;
    --tm-field-line: #30363d;
    --tm-line: rgba(255, 255, 255, 0.1);
    --tm-line-soft: rgba(255, 255, 255, 0.06);
    --tm-label: #94a3b8;
    --tm-head: #198754;
    --tm-head-2: #157347;
    --tm-forest: #146c43;
    --tm-deep: #0f5132;
    --tm-night: #0a3622;
    --tm-green: var(--rcw-green-neon, #10b981);
    --tm-green-2: var(--rcw-green-bright, #34d399);
    --tm-mint: #6ee7b7;
    --tm-lime: #a3e635;
    --tm-red: #f87171;
    --tm-accent: var(--tm-head);
}
.tm-modal-danger { --tm-accent: #dc3545; }

.tm-modal .modal-content {
    position: relative;
    background: var(--tm-card);
    border: 0;
    border-radius: 0;
    color: var(--rcw-text-primary, #fff);
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
}
.tm-modal .modal-header {
    padding: 1rem 1.5rem;
    border: 0;
    border-radius: 0;
    background: var(--tm-accent);
    color: #fff;
}
.tm-modal .modal-title {
    margin: 0;
    font-family: var(--rcw-font-title, sans-serif);
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.2;
    color: #fff;
}
/* El hueco entre cuerpo y pie va en el pie: así se mantiene aunque el cuerpo haga scroll */
.tm-modal .modal-body {
    padding: 1.5rem 1.5rem 0.5rem;
}
.tm-modal .modal-footer {
    gap: 0.5rem;
    padding: 1rem 1.5rem 1.5rem;
    border: 0;
    border-radius: 0;
}
.tm-modal .modal-footer > * {
    margin: 0;
}
/* El detalle no tiene cabecera: su pie se separa del contenido */
#trip-detail-modal .modal-footer {
    padding-top: 1rem;
    background: var(--tm-card-2);
}
.tm-close {
    position: absolute;
    top: 0.9rem;
    right: 0.9rem;
    z-index: 5;
    opacity: 1;
    filter: invert(1) grayscale(100%) brightness(200%) drop-shadow(0 0 3px rgba(0, 0, 0, 0.9));
}

.tm-label {
    font-family: var(--rcw-font-title, sans-serif);
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--tm-label);
}
/* Títulos de sección del detalle: banda verde oscura */
.tm-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    padding: 0.55rem 0.8rem;
    background: var(--tm-deep);
    color: #fff;
    font-family: var(--rcw-font-title, sans-serif);
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.tm-hint {
    font-size: 0.8rem;
    color: var(--tm-label);
}
.tm-section-title .tm-hint {
    font-family: var(--rcw-font-body, sans-serif);
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
    color: #a7f3d0;
}
.tm-req {
    color: #dc3545;
    font-weight: 700;
}

/* Botones sobre la foto del detalle (Editar / Equipo) */
.tm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.55rem 1rem;
    border: 0;
    border-radius: 0;
    background: rgba(11, 18, 32, 0.6);
    color: #fff;
    font-family: var(--rcw-font-title, sans-serif);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
    cursor: pointer;
    transition: background 0.15s ease;
}
.tm-btn:hover {
    background: var(--tm-head);
    color: #fff;
}

/* ── Formularios ─────────────────────────────────────────────────────────── */
.tm-req-note {
    margin: 0 0 1.25rem;
    font-size: 0.82rem;
    color: var(--tm-label);
}
.tm-flabel {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--tm-label);
}

/* Input con icono: borde verde de 2px y el icono en su casilla */
.tm-ig {
    display: flex;
    align-items: stretch;
    min-height: 46px;
    background: var(--tm-field);
    border: 2px solid var(--tm-head);
    transition: border-color 0.15s ease;
}
.tm-ig:focus-within {
    border-color: var(--tm-green);
}
.tm-ig-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    flex-shrink: 0;
    color: var(--tm-green);
}
.tm-ig-icon.is-top {
    align-items: flex-start;
    padding-top: 0.8rem;
}
/* Doble clase para ganar a globals.css y a ".modal .form-control" de trips.css */
.tm-modal .tm-ig .form-control {
    flex: 1;
    min-width: 0;
    padding: 0.6rem 0.75rem 0.6rem 0;
    background: transparent !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    color: #e6edf3 !important;
    color-scheme: dark;
}
.tm-modal .tm-ig .form-control::placeholder {
    color: #64748b !important;
    opacity: 1;
}
.tm-modal .tm-ig .btn {
    flex-shrink: 0;
}

/* Caja oscura para listas (días del viaje, miembros) */
.tm-listbox {
    background: var(--tm-field);
    border: 2px solid var(--tm-field-line);
}
.tm-listbox-empty {
    padding: 1.25rem 1rem;
    text-align: center;
    font-size: 0.88rem;
    color: var(--tm-label);
}
.tm-count-badge {
    margin-left: 0.5rem;
    padding: 0.15rem 0.5rem;
    background: var(--rcw-green-dim, #059669);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: none;
}
.tm-count-badge:empty {
    display: none;
}

/* Autocompletado (amigos, países, parques) */
.tm-ac {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    z-index: 1060;
    display: none;
    max-height: 240px;
    overflow-y: auto;
    margin: 0;
    padding: 0;
    list-style: none;
    background: var(--tm-field);
    border: 2px solid var(--tm-head);
    border-top: 0;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
.tm-ac.show {
    display: block;
}
.tm-ac-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 0;
    background: transparent;
    color: var(--rcw-text-primary, #fff);
    text-align: left;
    font-size: 0.9rem;
    cursor: pointer;
}
.tm-ac-item:hover {
    background: var(--tm-head);
}
.tm-ac-item small {
    color: var(--tm-label);
}
.tm-ac-item:hover small {
    color: #d1fae5;
}
.tm-ac-item img {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    object-fit: cover;
}
.tm-ac-empty {
    padding: 0.6rem 0.75rem;
    color: var(--tm-label);
    font-size: 0.85rem;
}

/* Etiquetas de países (dentro del input con icono) */
.tm-tags {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.5rem 0.35rem 0;
    cursor: text;
}
.tm-tags-input {
    flex: 1;
    min-width: 140px;
    border: 0;
    outline: none;
    background: transparent;
    color: #e6edf3;
    padding: 0.2rem 0;
}
.tm-tags-input::placeholder {
    color: #64748b;
}
.tm-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.25rem 0.55rem;
    background: var(--tm-head);
    color: #fff;
    font-size: 0.82rem;
    font-weight: 600;
}
.tm-tag button {
    border: 0;
    padding: 0;
    background: none;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1;
}
.tm-tag button:hover {
    color: #fff;
}

/* Días del viaje (solo al crear) */
.tm-day-row {
    display: grid;
    grid-template-columns: 130px minmax(0, 1fr);
    align-items: start;
    gap: 0.75rem;
    padding: 0.75rem;
}
.tm-day-row + .tm-day-row {
    border-top: 1px solid var(--tm-field-line);
}
.tm-day-row-label {
    padding-top: 0.45rem;
    line-height: 1.25;
}
.tm-day-row-label b {
    display: block;
    color: #fff;
    font-weight: 700;
}
.tm-day-row-label span {
    font-size: 0.8rem;
    color: var(--tm-label);
}
.tm-park-slot {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.4rem;
}
.tm-modal .tm-slot-input {
    height: 38px;
    background: var(--tm-card) !important;
    border: 1px solid var(--tm-field-line) !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    color: #e6edf3 !important;
    font-size: 0.9rem;
}
.tm-modal .tm-slot-input:focus {
    border-color: var(--tm-green) !important;
}
.tm-modal .tm-slot-input::placeholder {
    color: #64748b !important;
    opacity: 1;
}
.tm-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.15rem 0;
    border: 0;
    background: none;
    color: var(--tm-green-2);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
}
.tm-link:hover {
    color: var(--tm-mint);
    text-decoration: underline;
}

/* Miembros del viaje */
.tm-collab {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
}
.tm-collab + .tm-collab {
    border-top: 1px solid var(--tm-field-line);
}
.tm-collab img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--tm-ink);
}
.tm-collab-name {
    flex: 1;
    min-width: 0;
    font-weight: 600;
}
.tm-pill {
    padding: 0.2rem 0.5rem;
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
}
.tm-pill.is-ok {
    background: var(--tm-head);
    color: #fff;
}
.tm-pill.is-wait {
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}
.tm-pill.is-no {
    background: rgba(220, 53, 69, 0.2);
    color: #ff6b6b;
}

/* ── Detalle del viaje ───────────────────────────────────────────────────── */
.tm-hero {
    position: relative;
    min-height: 250px;
    display: flex;
    align-items: flex-end;
    background: var(--tm-night);
    isolation: isolate;
    overflow: hidden;
}
.tm-hero-img {
    position: absolute;
    inset: 0;
    z-index: -2;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.6;
}
.tm-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        linear-gradient(180deg, rgba(10, 54, 34, 0.1) 0%, rgba(10, 54, 34, 0.95) 88%),
        linear-gradient(90deg, rgba(10, 54, 34, 0.7) 0%, rgba(10, 54, 34, 0) 70%);
}
.tm-hero-body {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    width: 100%;
    padding: 3rem 1.5rem 1.4rem;
}
.tm-hero-main {
    min-width: 0;
    flex: 1 1 420px;
}
.tm-hero-kicker {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-bottom: 0.6rem;
}
.tm-status {
    padding: 0.25rem 0.55rem;
    font-family: var(--rcw-font-title, sans-serif);
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: rgba(11, 18, 32, 0.75);
    color: var(--tm-label);
}
.tm-status.is-active {
    background: var(--tm-lime);
    color: #1a2e05;
}
.tm-status.is-upcoming {
    background: var(--tm-head);
    color: #fff;
}
.tm-countdown {
    font-family: var(--rcw-font-title, sans-serif);
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--tm-mint);
    font-variant-numeric: tabular-nums;
}
.tm-hero-title {
    margin: 0;
    font-family: var(--rcw-font-title, sans-serif);
    font-size: clamp(1.7rem, 4vw, 2.6rem);
    font-weight: 900;
    line-height: 1.05;
    text-shadow: 0 2px 18px rgba(0, 0, 0, 0.5);
}
.tm-hero-meta {
    margin-top: 0.55rem;
    color: var(--rcw-text-secondary, #e2e8f0);
    font-size: 0.92rem;
    font-weight: 600;
}
.tm-hero-desc {
    margin: 0.6rem 0 0;
    max-width: 720px;
    color: var(--rcw-text-muted, #cbd5e1);
    font-size: 0.9rem;
    line-height: 1.5;
    max-height: 4.5em;
    overflow-y: auto;
}
.tm-hero-actions {
    display: flex;
    gap: 0.5rem;
}

/* Cifras: banda en escala de verdes */
.tm-stats {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
}
.tm-stat {
    padding: 0.9rem 1.1rem;
    color: #fff;
}
.tm-stat:nth-child(1) { background: var(--tm-head); }
.tm-stat:nth-child(2) { background: #167a4c; }
.tm-stat:nth-child(3) { background: var(--tm-forest); }
.tm-stat:nth-child(4) { background: #115e3a; }
.tm-stat:nth-child(5) { background: var(--tm-deep); }
.tm-stat:nth-child(6) { background: var(--tm-night); }
.tm-stat .tm-label {
    color: rgba(255, 255, 255, 0.78);
}
.tm-stat-value {
    display: flex;
    align-items: center;
    min-height: 2rem;
    font-family: var(--rcw-font-title, sans-serif);
    font-size: 1.7rem;
    font-weight: 900;
    line-height: 1;
}
.tm-stat-value.is-new {
    color: var(--tm-lime);
}
.tm-avatars {
    display: flex;
}
.tm-avatars img,
.tm-avatars span {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--tm-night);
    margin-left: -8px;
    background: #334155;
}
.tm-avatars > :first-child {
    margin-left: 0;
}
.tm-avatars span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    font-weight: 800;
}

.tm-body {
    padding: 1.4rem 1.5rem 1.6rem;
}
.tm-progress {
    height: 6px;
    margin-bottom: 0.9rem;
    background: rgba(255, 255, 255, 0.07);
}
.tm-progress span {
    display: block;
    height: 100%;
    background: var(--tm-green);
}

/* Itinerario */
.tm-itinerary {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    list-style: none;
    margin: 0;
    padding: 0;
}
.tm-day {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.9rem;
    padding: 0.5rem 0.75rem 0.5rem 0.5rem;
    background: var(--tm-card-2);
    transition: background 0.15s ease;
}
.tm-day.is-link {
    cursor: pointer;
}
.tm-day.is-link:hover {
    background: #1d2a40;
}
.tm-day.is-today {
    background: rgba(25, 135, 84, 0.22);
}
.tm-day-date {
    padding: 0.35rem 0;
    background: var(--tm-head);
    color: #fff;
    text-align: center;
}
.tm-day.is-today .tm-day-date {
    background: var(--tm-lime);
    color: #1a2e05;
}
.tm-day-date b {
    display: block;
    font-family: var(--rcw-font-title, sans-serif);
    font-size: 1.3rem;
    font-weight: 900;
    line-height: 1.05;
}
.tm-day-date span {
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #d1fae5;
}
.tm-day.is-today .tm-day-date span {
    color: #1a2e05;
}
.tm-day-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--tm-label);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.tm-day-parks {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.9rem;
    margin-top: 0.3rem;
}
.tm-day-park {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    min-width: 0;
}
.tm-day-park img {
    width: 34px;
    height: 34px;
    object-fit: cover;
    flex-shrink: 0;
}
.tm-day-empty {
    font-size: 0.88rem;
    color: var(--tm-label);
    font-style: italic;
}
.tm-day-rides {
    text-align: right;
    white-space: nowrap;
}
.tm-day-rides b {
    display: block;
    font-family: var(--rcw-font-title, sans-serif);
    font-size: 1.15rem;
    font-weight: 900;
    line-height: 1;
    color: var(--tm-green-2);
}
.tm-day-rides span {
    font-size: 0.62rem;
    color: var(--tm-label);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.tm-day-rides .fa-chevron-right {
    color: #475569;
    font-size: 0.75rem;
    margin-left: 0.4rem;
}

/* Coasters del viaje */
.tm-coasters {
    max-height: 520px;
    overflow-y: auto;
    padding-right: 4px;
}
.tm-coaster-park {
    margin: 1rem 0 0.35rem;
    color: var(--tm-mint);
}
.tm-coaster-park:first-child {
    margin-top: 0;
}
.tm-coaster {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.45rem 0.4rem;
    color: inherit;
    text-decoration: none;
    transition: background 0.15s ease;
}
.tm-coaster:hover {
    background: rgba(25, 135, 84, 0.12);
    color: inherit;
}
.tm-coaster-img {
    position: relative;
    width: 52px;
    height: 40px;
    flex-shrink: 0;
    overflow: hidden;
    background: var(--tm-ink);
}
.tm-coaster-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.tm-coaster-main {
    min-width: 0;
    flex: 1;
}
.tm-coaster-name {
    font-weight: 700;
    font-size: 0.92rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tm-coaster-meta {
    font-size: 0.75rem;
    color: var(--tm-label);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.tm-coaster-meta b {
    color: var(--tm-mint);
    font-weight: 700;
}
.tm-mark {
    flex-shrink: 0;
    padding: 0.18rem 0.45rem;
    font-family: var(--rcw-font-title, sans-serif);
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.07);
    color: var(--tm-label);
}
.tm-mark.is-ridden {
    background: var(--tm-head);
    color: #fff;
}
.tm-mark.is-new {
    background: var(--tm-lime);
    color: #1a2e05;
}

/* ── Aviso flotante global ───────────────────────────────────────────────── */
.tm-toast {
    position: fixed;
    left: 50%;
    bottom: 1.25rem;
    z-index: 1090;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    width: min(460px, calc(100vw - 2rem));
    padding: 0.8rem 1rem;
    background: var(--tm-forest);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 0.9rem;
    transform: translate(-50%, 200%);
    visibility: hidden;
    transition: transform 0.25s ease, visibility 0.25s ease;
    pointer-events: none;
}
.tm-toast.is-visible {
    transform: translate(-50%, 0);
    visibility: visible;
}
.tm-toast.is-error {
    background: #7f1d1d;
}
.tm-toast.is-warning {
    background: var(--tm-night);
    box-shadow: inset 4px 0 0 var(--tm-lime), 0 12px 40px rgba(0, 0, 0, 0.55);
}
.tm-toast strong {
    font-family: var(--rcw-font-title, sans-serif);
    font-weight: 800;
}
.tm-toast strong:empty {
    display: none;
}

@media (max-width: 991.98px) {
    .tm-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}
@media (max-width: 575.98px) {
    .tm-hero-body {
        padding: 2.6rem 1rem 1.1rem;
    }
    .tm-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .tm-stat-value {
        font-size: 1.4rem;
    }
    .tm-body {
        padding: 1.1rem 1rem 1.3rem;
    }
    .tm-day {
        grid-template-columns: 50px minmax(0, 1fr) auto;
        gap: 0.65rem;
    }
    .tm-modal .modal-header,
    .tm-modal .modal-body {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    .tm-modal .modal-footer {
        padding: 1rem;
    }
    .tm-day-row {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.4rem;
    }
    .tm-day-row-label {
        padding-top: 0;
    }
    .tm-day-row-label b {
        display: inline;
        margin-right: 0.4rem;
    }
}
