:root {
    --bg-color: #FDFBF7;
    /* Blanco roto / pergamino */
    --text-color: #333333;
    --primary-color: #6495ED;
    /* Azul escandinavo */
    --secondary-color: #F2A65A;
    /* Amarillo mostaza */
    --accent-red: #D9534F;
    /* Rojo vikingo */
    --accent-green: #5CB85C;
    /* Verde bosque */
    --accent-blue: #5BC0DE;
    /* Turquesa */

    --card-bg: #FFFFFF;
    --border-radius: 16px;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 12px 32px rgba(0, 0, 0, 0.12);

    --font-main: 'Outfit', 'Inter', system-ui, sans-serif;

    /* Escala de texto global (modificada por preferencia de usuario) */
    --text-scale: 1;
}

html {
    font-size: calc(16px * var(--text-scale));
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-color);
    overflow: hidden;
    /* SPA behavior */
    width: 100vw;
    height: 100vh;
    height: 100dvh;
}

/* Papercraft texture overlay */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"><filter id="noiseFilter"><feTurbulence type="fractalNoise" baseFrequency="0.85" numOctaves="3" stitchTiles="stitch"/></filter><rect width="100%" height="100%" filter="url(%23noiseFilter)" opacity="0.05"/></svg>');
    pointer-events: none;
    z-index: 9999;
}

/* Utils */
.hidden {
    display: none !important;
}

.fade-in {
    animation: fadeIn 0.3s ease-out forwards;
}

.slide-up {
    animation: slideUp 0.3s ease-out forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Botones */
.btn {
    display: inline-block;
    padding: 14px 24px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 1.1rem;
    text-align: center;
    cursor: pointer;
    border: none;
    outline: none;
    transition: transform 0.2s, box-shadow 0.2s;
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(100, 149, 237, 0.3);
}

.btn:active {
    transform: scale(0.95);
}

.btn-secondary {
    background: white;
    color: var(--text-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 2px solid #EEE;
}

/* Contenedores Principales */
#app-container {
    width: 100%;
    height: 100%;
    position: relative;
}

/* Login Screen */
#login-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('/static/images/traveltales_login_portrait_02.webp') center center / cover no-repeat;
    z-index: 1000;
}

/* Fondo específico para pantallas más anchas (Desktop / Tablets) */
@media (min-aspect-ratio: 3/2) {
    #login-screen {
        background-image: url('/static/images/traveltales_login_desktop_02.webp');
    }
}

.login-overlay-form {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 420px;
    min-height: 450px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 30px;
    align-items: center;
    background: rgba(255, 255, 255, 0.75);
    border-radius: 20px;
    padding: 40px 32px;
    box-sizing: border-box;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.login-title-img {
    width: 100%;
    max-width: 280px;
    height: auto;
    object-fit: contain;
    margin-bottom: 10px;
}

.login-overlay-form input {
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    border: 2px solid #D5C1A3;
    font-size: 1.2rem;
    text-align: center;
    font-family: var(--font-main);
    background-color: rgba(255, 255, 255, 0.7);
    /* Ligeramente translúcido para fundirse con el pergamino */
    color: #4A3A2C;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.login-overlay-form input:focus {
    border-color: #2D8B9B;
    outline: none;
}

.password-container {
    position: relative;
    width: 100%;
}

.login-overlay-form .password-container input {
    padding-right: 48px;
    padding-left: 48px;
}

.toggle-password-btn {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4A3A2C;
    opacity: 0.6;
    transition: opacity 0.2s;
    z-index: 2;
}

.toggle-password-btn:hover {
    opacity: 1;
}

.toggle-password-btn svg {
    width: 22px;
    height: 22px;
}

.toggle-password-btn svg.hidden {
    display: none;
}

@font-face {
    font-family: 'PRViking';
    src: url('/static/fonts/PR Viking.ttf') format('truetype');
}

@font-face {
    font-family: 'BreatheFire';
    src: url('/static/fonts/Breathe Fire.otf') format('opentype');
}

@font-face {
    font-family: 'Anirb';
    src: url('/static/fonts/anirb___.ttf') format('truetype');
}

@font-face {
    font-family: 'AlegreyaSansBlack';
    src: url('/static/fonts/AlegreyaSans-Black.ttf') format('truetype');
}

@font-face {
    font-family: 'TwinMarker';
    src: url('/static/fonts/TwinMarker.ttf') format('truetype');
}

@font-face {
    font-family: 'Shockhea';
    src: url('/static/fonts/SHOCKHEA.TTF') format('truetype');
}

.btn-viking {
    width: 100%;
    font-family: 'PRViking', sans-serif;
    font-size: 1.4rem;
    padding: 14px 20px;
    background: #17718F;
    color: #FFF;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    letter-spacing: 2px;
}

.btn-viking:hover {
    background: #125A73;
}

/* Map Screen */
#map-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#map {
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 1;
}

/* Selector de ciudad (Flotante) */
.city-selector {
    z-index: 10;
    background: white;
    border-radius: 20px;
    padding: 4px 10px;
    box-shadow: var(--shadow);
    font-weight: bold;
    font-size: 0.95rem;
    cursor: pointer;
    border: 2px solid var(--primary-color);
}

.city-selector select {
    border: none;
    outline: none;
    font-weight: bold;
    font-size: 0.95rem;
    font-family: var(--font-main);
    background: transparent;
    cursor: pointer;
    text-align: center;
    text-align-last: center;
}

#city-select {
    font-size: 1.6rem;
    font-family: 'TwinMarker', sans-serif;
    color: #3b281b;
    /* Marrón oscuro vikingo */
    font-weight: bold;
    width: 100%;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    /* Oculta la flecha nativa para un look de botón limpio */
}

.city-selector:not(.rating-inline) {
    position: absolute;
    top: calc(17px + env(safe-area-inset-top));
    /* Alineado perfectamente con la parte superior y altura de los botones (17px y 55px) */
    left: 50%;
    transform: translateX(-50%);
    padding: 0 20px;
    height: 55px;
    width: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-image: url('/static/icons/menu_v02/label_ciudad_v05.webp');
    background-size: 100% 100%;
    background-repeat: no-repeat;
    background-color: transparent;
    border: none;
    box-shadow: none;
}

/* Chips de Filtros y Wrapper */
.filters-wrapper {
    position: absolute;
    top: calc(90px + env(safe-area-inset-top));
    left: 26.5px;
    right: 20px;
    z-index: 10;
    display: flex;
    gap: 12px;
    align-items: center;
}

.btn-toggle-filters {
    background: white;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18);
    border: 2px solid var(--primary-color);
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    color: var(--primary-color);
}

.btn-toggle-filters:hover {
    background: #f8f9fa;
}

.btn-toggle-filters:active {
    transform: scale(0.95);
}

.btn-toggle-filters.active {
    background: #F0F6FF;
    border-color: var(--primary-color);
}

.btn-toggle-filters svg {
    display: block;
    width: 22px;
    height: 22px;
}

.filters-row-content {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-grow: 1;
    transition: opacity 0.25s ease, transform 0.25s ease, max-width 0.25s ease, visibility 0.25s, margin-left 0.25s ease;
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    max-width: 1000px;
    min-width: 0;
}

.filters-row-content.collapsed {
    opacity: 0;
    visibility: hidden;
    transform: translateX(-15px);
    max-width: 0;
    pointer-events: none;
    margin-left: -12px;
}

.filters-container {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    flex-grow: 1;
    align-items: center;
    scrollbar-width: none; /* Firefox */
}

.filters-container::-webkit-scrollbar {
    display: none;
}

.rating-inline {
    position: static;
    flex-shrink: 0;
    margin-bottom: 0px;
}

.filter-chip {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    border: 2px solid;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    background: white;
    border-color: currentColor;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.filter-chip:hover {
    background: color-mix(in srgb, currentColor 25%, white);
}

/* Estado DESACTIVADO: gris, semi-transparente, sin sombra */
.filter-chip.disabled {
    background: #e8e8e8 !important;
    color: #393939 !important;
    border-color: #696969 !important;
    box-shadow: none;
    opacity: 0.55;
}

/* Botón "Mostrar todo" */
.filter-chip--show-all {
    background: #F0F6FF !important;
    color: var(--primary-color, #4A7FC1) !important;
    border-color: var(--primary-color, #4A7FC1) !important;
    font-weight: 700;
    opacity: 1 !important;
    text-decoration: none !important;
}

.filter-chip--show-all:hover {
    background: #dce9ff !important;
}

/* Botones flotantes GPS / Menu */
.floating-btn {
    position: fixed;
    z-index: 15;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    border: none;
    font-size: 1.2rem;
}

/* Botones con iconos personalizados */
.btn-menu,
.btn-add-poi {
    background: transparent;
    box-shadow: none;
    width: 55px;
    height: 55px;
    padding: 0;
}

.btn-add-poi {
    right: 20px;
}

.btn-menu {
    left: 20px;
    top: calc(17px + env(safe-area-inset-top));
}

.btn-add-poi {
    top: calc(17px + env(safe-area-inset-top));
}

/* GPS y Brújula: botones circulares modernos */
.btn-gps,
.btn-compass {
    right: 20px;
    width: 42px;
    height: 42px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18);
    border: 2px solid var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.15s;
    padding: 0;
}

.btn-gps:hover,
.btn-compass:hover {
    background: #f0f4ff;
}

.btn-gps:active,
.btn-compass:active {
    transform: scale(0.92);
}

.btn-gps {
    bottom: calc(80px + env(safe-area-inset-bottom));
    /* Subido más para evitar tapar la atribución */
}

.btn-compass {
    bottom: calc(80px + 42px + 18px + env(safe-area-inset-bottom));
    /* 42px de alto + 18px de espacio */
}

/* =========================================================
   PESTAÑA + BOTTOM SHEET: LISTA DE POIs
   ========================================================= */

/* Pestaña discreta (pill) en la esquina inferior izquierda */
.btn-poi-list-tab {
    position: fixed;
    left: 20px;
    bottom: calc(80px + env(safe-area-inset-bottom));
    z-index: 15;
    display: flex;
    align-items: center;
    gap: 6px;
    height: 42px;
    padding: 0 14px 0 12px;
    background: white;
    border: 2px solid var(--primary-color);
    border-radius: 21px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18);
    cursor: pointer;
    font-family: var(--font-main);
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--primary-color);
    white-space: nowrap;
    transition: background 0.2s, transform 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.btn-poi-list-tab:hover {
    background: #f0f4ff;
}

.btn-poi-list-tab:active {
    transform: scale(0.94);
}

/* Panel Bottom Sheet */
.poi-list-sheet {
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100%;
    max-height: 82vh;
    background: var(--bg-color);
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.15);
    z-index: 22;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.1, 0.8, 0.2, 1);
    will-change: transform;
}

.poi-list-sheet.open {
    transform: translateY(0);
}

/* Handle / tirador */
.poi-list-sheet-handle {
    width: 40px;
    height: 5px;
    background: #DDD;
    border-radius: 3px;
    margin: 12px auto 0;
    flex-shrink: 0;
    cursor: grab;
}

/* Cabecera del panel */
.poi-list-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px 8px;
    flex-shrink: 0;
}

.poi-list-sheet-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-color);
}

.poi-list-sheet-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #AAA;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px;
    border-radius: 50%;
    transition: background 0.15s;
    -webkit-tap-highlight-color: transparent;
}

.poi-list-sheet-close:hover {
    background: #F0F0F0;
    color: var(--text-color);
}

/* Barra de búsqueda */
.poi-list-search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 16px 8px;
    padding: 10px 12px;
    background: white;
    border-radius: 12px;
    border: 1.5px solid #E8E8E8;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
}

.poi-list-search-bar svg {
    flex-shrink: 0;
}

#poi-list-search-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-family: var(--font-main);
    font-size: 0.95rem;
    color: var(--text-color);
    min-width: 0;
}

#poi-list-search-input::placeholder {
    color: #BBB;
}

.poi-list-search-clear {
    background: none;
    border: none;
    cursor: pointer;
    color: #AAA;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}

/* Cuerpo scrollable */
.poi-list-sheet-body {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 4px 0 calc(20px + env(safe-area-inset-bottom, 0px));
    -webkit-overflow-scrolling: touch;
}

.poi-list-sheet-body::-webkit-scrollbar {
    display: none;
}

/* Grupos de categoría */
.poi-list-cat-group {
    margin-bottom: 4px;
}

.poi-list-cat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px 6px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.poi-list-cat-header-icon {
    width: 22px;
    height: 22px;
    object-fit: contain;
    flex-shrink: 0;
}

.poi-list-cat-header-name {
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    flex: 1;
}

.poi-list-cat-chevron {
    color: #CCC;
    font-size: 0.85rem;
    transition: transform 0.2s;
    flex-shrink: 0;
}

.poi-list-cat-group.collapsed .poi-list-cat-chevron {
    transform: rotate(-90deg);
}

.poi-list-cat-items {
    overflow: hidden;
}

.poi-list-cat-group.collapsed .poi-list-cat-items {
    display: none;
}

/* Fila de cada POI */
.poi-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px 10px 52px;
    cursor: pointer;
    transition: background 0.12s;
    -webkit-tap-highlight-color: transparent;
    border-bottom: 1px solid #F5F2EE;
}

.poi-list-item:last-child {
    border-bottom: none;
}

.poi-list-item:active,
.poi-list-item:hover {
    background: #F7F5F1;
}

.poi-list-item-name {
    flex: 1;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-color);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.poi-list-item-stars {
    font-size: 0.78rem;
    flex-shrink: 0;
    letter-spacing: 1px;
    opacity: 0.85;
}

/* Mensaje cuando no hay resultados */
.poi-list-empty {
    text-align: center;
    color: #AAA;
    font-size: 0.9rem;
    padding: 40px 20px;
}

/* Animación spring-bounce para resaltar el POI seleccionado desde la lista */
@keyframes poi-marker-spring {
    0%   { transform: scale(1); }
    30%  { transform: scale(1.8); }
    50%  { transform: scale(0.85); }
    70%  { transform: scale(1.25); }
    85%  { transform: scale(0.95); }
    100% { transform: scale(1); }
}

.btn-menu img,
.btn-add-poi img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.5));
    transition: transform 0.2s;
}

.btn-menu:active img,
.btn-add-poi:active img {
    transform: scale(0.9);
}

.menu-profile-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 76px;
}

/* POI Modal (Bocadillo / Detalle) */
.poi-modal {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 20;
    background: white;
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.15);
    padding: 24px;
    padding-bottom: 40px;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.1, 0.8, 0.2, 1);
    max-height: 90vh;
    overflow-y: auto;
}

.poi-modal.open {
    transform: translateY(0);
}

.modal-handle {
    width: 40px;
    height: 5px;
    background: #DDD;
    border-radius: 3px;
    margin: 0 auto 16px;
}

.poi-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-top: 12px;
    margin-bottom: 24px;
}

.poi-detail-header-left {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.poi-detail-header-left .poi-category {
    margin-bottom: 4px;
}

.poi-detail-header-left .poi-title {
    margin-bottom: 4px;
    line-height: 1.25;
}

.poi-detail-header-left .poi-rating {
    margin-bottom: 6px;
}

.poi-detail-header-left .poi-address {
    margin-bottom: 0;
}

.poi-image {
    width: 120px;
    height: 120px;
    object-fit: cover;
    border-radius: 12px;
    background: #EEE;
    flex-shrink: 0;
    margin-top: 22px;
}

.poi-title {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 4px;
}

.poi-category {
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 12px;
    text-transform: uppercase;
}

.poi-rating {
    color: var(--secondary-color);
    margin-bottom: 16px;
    letter-spacing: 2px;
}

.poi-desc {
    font-size: 1.05rem;
    line-height: 1.5;
    margin-bottom: 16px;
    color: #444;
}

.poi-address {
    font-size: 1.05rem;
    font-style: italic;
    line-height: 1.4;
    color: #888;
    margin-bottom: 2em;
}

.poi-meta {
    font-size: 1.05rem;
    color: #555;
    margin-bottom: 24px;
}

.poi-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.poi-actions .btn {
    flex: 1;
    min-width: min(120px, 100%);
}

/* Menú Hamburguesa */
#main-menu {
    position: fixed;
    top: 0;
    left: -345px;
    width: 322px;
    height: 100%;
    background: #FDFBF7 url('/static/icons/menu_v02/menu_bg.webp') no-repeat center;
    background-size: 100% 100%;
    z-index: 30;
    box-shadow: 8px 0 24px rgba(0, 0, 0, 0.1);
    transition: left 0.3s;
    padding: 24px 24px 18px 24px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#main-menu::-webkit-scrollbar {
    display: none;
}


#main-menu.open {
    left: 0;
}

.menu-close {
    align-self: flex-end;
    font-size: 1.8rem;
    font-weight: bold;
    cursor: pointer;
    border: none;
    background: none;
    margin-bottom: 12px;
    margin-right: 12px;
    /* Separar del marco metálico */
    color: #4a3b32;
    /* Marrón oscuro sólido */
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
    transition: color 0.2s, transform 0.2s;
}

.menu-close:hover {
    color: #111;
    transform: scale(1.1);
}

/* Menu Nav Items */
.menu-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-height: 0;
    /* permite que flex shrink + scroll funcionen */
    margin-left: 16px;
    width: calc(100% - 16px);
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 12px;
    /* evita que el último item toque el marco inferior */
    -webkit-overflow-scrolling: touch;
}

.menu-nav::-webkit-scrollbar {
    width: 4px;
}

.menu-nav::-webkit-scrollbar-track {
    background: transparent;
}

.menu-nav::-webkit-scrollbar-thumb {
    background: #DDD;
    border-radius: 3px;
}

.menu-nav::-webkit-scrollbar-thumb:hover {
    background: #BBB;
}

.menu-nav-item {
    display: flex;
    align-items: center;
    width: 100%;
    gap: 14px;
    padding: 12px 10px;
    border-radius: 14px;
    cursor: pointer;
    transition: background 0.18s, transform 0.12s;
    position: relative;
}

.menu-nav-item:hover,
.menu-nav-item:active {
    background: rgba(0, 0, 0, 0.05);
    transform: translateX(2px);
}

.menu-nav-icon {
    width: 44px;
    height: 44px;
    object-fit: contain;
    flex-shrink: 0;
}

.menu-nav-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    flex: 1;
}

.menu-nav-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-color);
    line-height: 1.2;
}

.menu-nav-sub {
    font-size: 0.78rem;
    color: #999;
    font-weight: 400;
}

.menu-nav-arrow {
    font-size: 1.4rem;
    color: #bbb;
    transition: transform 0.25s;
    line-height: 1;
}

.menu-nav-expandable.expanded .menu-nav-arrow {
    transform: rotate(90deg);
}

.menu-nav-submenu {
    display: none;
    flex-direction: column;
    gap: 2px;
    padding: 0 10px 4px 52px;
}

.menu-nav-submenu.open {
    display: flex;
}

.menu-nav-subitem {
    font-size: 0.95rem;
    font-weight: 600;
    color: #555;
    padding: 9px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s;
}

.menu-nav-subitem:hover {
    background: rgba(0, 0, 0, 0.06);
}

.menu-nav-item--logout .menu-nav-title {
    color: var(--accent-red);
}

.menu-nav-item--logout .menu-nav-sub {
    color: #e8a0a0;
}



.menu-profile-pic {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--primary-color);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 12px;
}

.menu-username {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-color);
    margin-bottom: 2px;
}

.menu-role {
    font-size: 0.85rem;
    font-weight: bold;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.menu-logout-subtle {
    font-size: 0.75rem;
    color: #999;
    cursor: pointer;
    margin-top: 6px;
    text-decoration: underline;
    transition: color 0.2s;
}

.menu-logout-subtle:hover {
    color: var(--accent-red);
}

.menu-divider {
    height: 1px;
    background: #EEE;
    margin: 16px 0;
}

.menu-tools-section h4 {
    font-size: 0.85rem;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

.menu-tools-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.menu-tool-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.95rem;
    font-weight: 600;
    color: #444;
}



#converter-modal {
    height: 50vh !important;
    max-height: 50vh !important;
    border-radius: 32px 32px 0 0;
    display: flex;
    flex-direction: column;
    padding: 20px 24px 32px;
    box-sizing: border-box;
}

.converter-card {
    background: transparent;
    border-radius: 12px;
    padding: 0;
    border: none;
    margin-top: 10px;
}

.converter-card h5 {
    font-size: 0.95rem;
    color: #4A5568;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 800;
}

.converter-row {
    display: flex;
    align-items: center;
    width: 100%;
}

.converter-input-group {
    display: flex;
    align-items: center;
    width: 100%;
    background: #F8F9FA;
    border: 2px solid #E2E8F0;
    border-radius: 16px;
    padding: 14px 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    transition: all 0.2s ease-in-out;
}

.converter-input-group:focus-within {
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 3px rgba(100, 149, 237, 0.15);
}

.converter-input-group input {
    border: none;
    outline: none;
    font-size: 1.8rem;
    font-weight: 700;
    width: 100%;
    padding: 0;
    color: var(--text-color);
    background: transparent;
}

.currency-label {
    font-size: 1.2rem;
    font-weight: 800;
    color: #4A5568;
    margin-left: 12px;
}

.converter-select {
    border: none;
    outline: none;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--primary-color);
    background: transparent;
    cursor: pointer;
    text-align: right;
    padding-right: 8px;
    margin-left: 12px;
}

/* ==========================================================================
   Buscador de Lugares (Photon)
   ========================================================================== */

.search-map-wrapper {
    position: absolute;
    top: calc(204px + env(safe-area-inset-top));
    /* Bajado para dejar espacio para el botón de fuentes */
    left: 26.5px;
    z-index: 10;
    display: flex;
    gap: 12px;
    align-items: center;
    max-width: calc(100% - 40px);
}

.btn-toggle-search {
    background: white;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18);
    border: 2px solid var(--primary-color);
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    color: var(--primary-color);
}

.btn-toggle-search:hover {
    background: #f8f9fa;
}

.btn-toggle-search:active {
    transform: scale(0.95);
}

.btn-toggle-search.active {
    background: #F0F6FF;
    border-color: var(--primary-color);
}

.btn-toggle-search svg {
    display: block;
    width: 22px;
    height: 22px;
}

.btn-fountain-toggle {
    position: absolute;
    top: calc(150px + env(safe-area-inset-top)); /* 90px (filters top) + 42px (filters height) + 18px (gap) */
    left: 26.5px;
    z-index: 10;
    background: #4A7FC1;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18);
    border: 2px solid #4A7FC1;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    opacity: 0.5; /* Default OFF state: transparency/lower opacity */
}

.btn-fountain-toggle:hover {
    background: #4A7FC1;
    opacity: 0.7;
}

.btn-fountain-toggle:active {
    transform: scale(0.95);
}

.btn-fountain-toggle.active {
    opacity: 1; /* Turn ON: full opacity */
    background: #315C91; /* Active background highlight */
    border-color: #315C91;
}

.btn-fountain-toggle.active:hover {
    opacity: 0.9;
}

.btn-fountain-toggle svg {
    display: block;
    width: 22px;
    height: 22px;
}

.btn-wc-toggle {
    position: absolute;
    top: calc(150px + env(safe-area-inset-top)); /* Same row as fountains */
    left: 80.5px; /* Directly to the right of fountains (26.5px + 42px + 12px) */
    z-index: 10;
    background: #4A7FC1;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18);
    border: 2px solid #4A7FC1;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    opacity: 0.5; /* Default OFF state: transparency/lower opacity */
}

.btn-wc-toggle:hover {
    background: #4A7FC1;
    opacity: 0.7;
}

.btn-wc-toggle:active {
    transform: scale(0.95);
}

.btn-wc-toggle.active {
    opacity: 1; /* Turn ON: full opacity */
    background: #315C91; /* Active background highlight */
    border-color: #315C91;
}

.btn-wc-toggle.active:hover {
    opacity: 0.9;
}

.btn-wc-text {
    font-family: var(--font-main);
    font-weight: bold;
    font-size: 15px;
    color: white;
    line-height: 1;
}

.search-map-content {
    display: flex;
    flex-direction: column;
    position: relative;
    width: 280px;
    max-width: calc(100vw - 100px);
    transition: opacity 0.25s ease, transform 0.25s ease, max-width 0.25s ease, visibility 0.25s, margin-left 0.25s ease;
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
    overflow: visible;
}

.search-map-content.collapsed {
    opacity: 0;
    visibility: hidden;
    transform: translateX(-15px);
    max-width: 0;
    pointer-events: none;
    margin-left: -12px;
}

.search-place-input-group {
    display: flex;
    align-items: center;
    background: white;
    border: 2px solid transparent;
    border-radius: 20px;
    padding: 6px 14px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    position: relative;
    width: 100%;
}

.search-place-input-group:focus-within {
    border-color: var(--primary-color);
}

.search-place-input-group input {
    border: none;
    outline: none;
    font-size: 0.95rem;
    width: 100%;
    padding: 0;
    color: var(--text-color);
    background: transparent;
}

#btn-search-place {
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0 0 0 8px;
    display: flex;
    align-items: center;
    color: #666;
    transition: color 0.2s;
}

#btn-search-place:hover {
    color: var(--primary-color);
}

.search-place-spinner {
    position: absolute;
    right: 36px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
}

#search-place-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid #EAEAEA;
    max-height: 240px;
    overflow-y: auto;
    z-index: 100;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#search-place-status {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid #EAEAEA;
    padding: 12px;
    z-index: 100;
    font-size: 0.85rem;
    color: #888;
    text-align: center;
}

.spinner-small {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin-search 0.6s linear infinite;
}

@keyframes spin-search {
    to {
        transform: rotate(360deg);
    }
}

.search-place-result-item {
    padding: 8px;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.search-place-result-item:hover {
    background: #F5F9FF;
}

.search-place-result-name {
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--text-color);
}

.search-place-result-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: #777;
    gap: 8px;
}

.search-place-result-type {
    font-weight: bold;
    color: var(--primary-color);
    text-transform: uppercase;
    font-size: 0.65rem;
    letter-spacing: 0.3px;
    flex-shrink: 0;
}

.search-place-result-address {
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    max-width: 70%;
}

/* Animaciones para el marcador de búsqueda temporal */
.search-marker {
    animation: marker-appear 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) both,
        marker-bounce 1.5s ease-in-out infinite alternate;
    transform-origin: bottom center;
}

@keyframes marker-appear {
    0% {
        transform: scale(0) translateY(20px);
        opacity: 0;
    }

    100% {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

@keyframes marker-bounce {
    0% {
        transform: translateY(0);
    }

    100% {
        transform: translateY(-8px);
    }
}



/* Backdrop */
.backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 15;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
}

.backdrop.active {
    opacity: 1;
    pointer-events: all;
}

/* Formularios genéricos */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 6px;
    font-size: 0.9rem;
    color: #555;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border-radius: 12px;
    border: 2px solid #E0E0E0;
    font-family: var(--font-main);
    font-size: 1rem;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--primary-color);
    outline: none;
}

/* Notificaciones (Toast) */
#toast {
    position: absolute;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #333;
    color: white;
    padding: 12px 24px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.95rem;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transition: transform 0.3s, opacity 0.3s, visibility 0.3s;
}

#toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
}

/* Vistas adicionales */
#admin-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    z-index: 5;
    padding: 20px;
    overflow-y: auto;
    padding-bottom: calc(90px + env(safe-area-inset-bottom, 0px));
}

#memories-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #e2dacf url('/static/images/recuerdos_bg.webp') repeat;
    z-index: 5;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#memories-screen .memories-banner {
    background: transparent;
}

/* Banner Superior */
.memories-banner {
    width: 100%;
    height: 82px;
    /* Reducido un ~75% de 110px */
    background-image: url('/static/icons/menu_v02/banner_cuaderno_viaje_v03.webp'), url('/static/icons/menu_v02/bg_banner_cuaderno_v04.webp');
    background-color: #edc891;
    background-repeat: no-repeat, repeat-x;
    background-position: left center, left center;
    background-size: auto 100%, auto 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    box-sizing: border-box;
    position: relative;
    flex-shrink: 0;
}

.memories-banner .screen-header {
    font-family: 'PRViking', sans-serif;
    font-size: 2.1rem;
    /* Aumentado de 1.8rem */
    font-weight: bold;
    line-height: 1.0;
    margin: 0 auto;
    color: #3b281b;
    /* Viking style dark brown */
    text-shadow: 1px 1px 0px rgba(255, 255, 255, 0.5);
    white-space: nowrap;
    text-align: center;
    display: inline-block;
    transform: scaleY(1.2);
    /* Estirar verticalmente */
    transform-origin: center center;
    opacity: 0.9;
    /* Transparencia muy sutil para integración */
}

#memories-screen .memories-banner .screen-header,
#settings-screen .memories-banner .screen-header,
#crew-screen .memories-banner .screen-header,
#backup-screen .memories-banner .screen-header,
#adventures-screen .memories-banner .screen-header,
#my-trip-screen .memories-banner .screen-header,
#my-trip-modal .memories-banner .screen-header {
    font-family: 'TwinMarker', sans-serif;
}

.btn-add-memory-banner {
    background: transparent;
    border: none;
    width: 45px;
    /* Proporcional a la menor altura */
    height: 45px;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
}

.btn-add-memory-banner img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.35));
    transition: transform 0.2s;
}

.btn-add-memory-banner:active img {
    transform: scale(0.9);
}

.crew-back-btn {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #4a3b32;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
    transition: color 0.2s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    width: 45px;
    height: 45px;
    padding: 0;
}

.crew-back-btn img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.35));
    transition: transform 0.2s;
}

.crew-back-btn:active img {
    transform: scale(0.9);
}

.btn-menu-memories {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    width: 45px;
    height: 45px;
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.btn-menu-memories img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.35));
    transition: transform 0.2s;
}

.btn-menu-memories:active img {
    transform: scale(0.9);
}

/* Pestañas */
.memories-tabs {
    display: flex;
    width: 100%;
    background: transparent;
    border-bottom: 1.5px solid rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
    height: 60px;
    /* Altura reducida a 60px */
}

.memories-tab {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    cursor: pointer;
    font-family: 'Shockhea', sans-serif;
    font-size: 34px;
    font-weight: bold;
    color: #555555;
    position: relative;
    transition: color 0.3s ease;
    gap: 8px;
    user-select: none;
}

.memories-tab img {
    width: 34px;
    /* Aumentado de 30px */
    height: 34px;
    /* Aumentado de 30px */
    object-fit: contain;
    transition: transform 0.3s ease;
}

.memories-tab span {
    line-height: 1;
}

/* Línea inferior en pestaña activa */
.memories-tab::after {
    content: '';
    position: absolute;
    bottom: -1.5px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 3px;
    background-color: #17718F;
    transition: width 0.3s ease;
}

.memories-tab.active {
    color: #17718F;
}

.memories-tab.active::after {
    width: 100%;
}

.memories-tab:hover {
    color: #17718F;
}

/* Contenedor de contenido */
.memories-content-container {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: calc(115px + env(safe-area-inset-bottom));
    -webkit-overflow-scrolling: touch;
}

.mobile-only {
    display: none;
}

/* Responsive queries */
@media (max-width: 480px) {
    .mobile-only {
        display: inline;
    }

    .memories-banner .screen-header {
        font-size: 1.6rem;
        /* Aumentado de 1.4rem */
        margin-left: 0;
        margin: 0 auto;
        white-space: nowrap;
    }

    .memories-banner {
        height: 70px;
    }
}

@media (min-width: 768px) {
    .memories-tab {
        font-size: 24px;
        /* Aumentado de 22px */
    }

    .memories-banner {
        height: 90px;
    }

    .memories-banner .screen-header {
        font-size: 2.6rem;
        /* Aumentado de 2.2rem */
        margin-left: 0;
        margin: 0 auto;
    }
}

/* Lista Recuerdos */
.memory-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
    position: relative;
    min-height: 280px;
    display: flex;
    flex-direction: column;
}

.memory-card .memory-main-photo {
    width: 100%;
    height: 220px;
    object-fit: cover;
    flex-shrink: 0;
}

.memory-content {
    padding: 16px;
    position: relative;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.memory-date-author {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.memory-date {
    font-size: 0.8rem;
    color: #888;
    font-weight: bold;
}

.memory-author-card {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: bold;
    color: #555;
}

.author-avatar-small {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #ccc;
}

.memory-card.draft-card {
    border: 2px dashed #e67e22;
    background: #fffdf9;
}

.memory-draft-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(230, 126, 34, 0.95);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.25);
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 4px;
}

.author-avatar-tiny {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid #fff;
}

.memory-title {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 8px;
}

.memory-desc {
    font-size: 1.1rem;
    color: #555;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.memory-minimap-link {
    background: white;
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    cursor: pointer;
}

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

.memory-card-header h3 {
    font-size: 1.4rem;
    margin: 0 0 4px 0;
}

.memory-card-header p {
    font-size: 0.9rem;
    color: #888;
    margin: 0;
}

.memory-card-body {
    display: flex;
    gap: 16px;
}

.memory-card-text {
    flex: 1;
}

.memory-card-text p {
    font-size: 1.1rem;
    line-height: 1.4;
    margin: 0 0 12px 0;
    color: #444;
}

.memory-card-photo {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    object-fit: cover;
}

.memory-admin-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 12px;
}

.memory-admin-actions button {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: var(--shadow);
}

.memory-admin-actions button:hover {
    background: #f0f0f0;
}

/* Galería Inmersiva (Tipo TikTok) */
#memory-gallery {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: black;
    z-index: 100;
    overflow: hidden;
}

#memory-gallery-content {
    height: 100%;
    will-change: transform;
    transition: transform 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

#memory-gallery::-webkit-scrollbar {
    display: none;
}

.memory-gallery-close {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 110;
    width: 40px;
    height: 40px;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    cursor: pointer;
    border: none;
}

.memory-slide {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    position: relative;
}

.memory-photos-scroll {
    width: 100%;
    height: 100%;
    display: flex;
    overflow-x: scroll;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    overscroll-behavior-x: none;
}

.memory-photos-scroll::-webkit-scrollbar {
    display: none;
}

.memory-photo-container {
    min-width: 100vw;
    height: 100%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    position: relative;
}

.memory-photo-container>img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.memory-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 120px 20px calc(20px + env(safe-area-inset-bottom)) 20px;
    background: linear-gradient(to top, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0.8) 50%, rgba(0, 0, 0, 0.4) 80%, transparent 100%);
    color: white;
    pointer-events: none;
}

.memory-info {
    width: 100%;
    pointer-events: auto;
}

.memory-info h2 {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 8px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

.memory-info p {
    font-size: 1.25rem;
    line-height: 1.5;
    margin-bottom: 20px;
    color: #EEE;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
    max-height: 35vh;
    overflow-y: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.memory-info p::-webkit-scrollbar {
    display: none;
}

.memory-meta {
    font-size: 1.0rem;
    color: #EEE;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    font-weight: bold;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
    pointer-events: auto;
}

.memory-meta-left {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
}

.memory-date-row {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.95rem;
    color: #DDD;
}

.memory-author-detail {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.5rem;
    color: white;
    font-weight: 800;
}

.memory-author-detail img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 1.5px solid #fff;
}

.memory-minimap {
    width: 66px;
    height: 66px;
    margin-left: 10px;
    pointer-events: auto;
    background-image: url('/static/icons/icon_map_recuerdo.webp');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    position: relative;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.4));
    flex-shrink: 0;
}

.photo-dots {
    position: absolute;
    bottom: calc(20px + env(safe-area-inset-bottom) + 33px);
    left: 50%;
    transform: translate(-50%, 50%);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    z-index: 101;
    pointer-events: none;
    background: rgba(0, 0, 0, 0.4);
    padding: 6px 12px;
    border-radius: 9999px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.photo-dot {
    width: 6px;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.4);
    transition: background 0.3s, transform 0.3s;
}

.photo-dot.active {
    background: white;
    transform: scale(1.4);
}

/* UI Toggle (TikTok Style) */
.memory-overlay,
.memory-gallery-close {
    transition: opacity 0.3s ease;
}

#memory-gallery.ui-hidden .memory-overlay {
    opacity: 0;
    pointer-events: none;
}

/* Botones de Navegación Lateral (Estilo Reddit, similar a la X de cierre) */
.gallery-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    border: none;
    z-index: 110;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease, background-color 0.2s;
    user-select: none;
}

#memory-gallery.ui-hidden .gallery-nav-btn {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

@media (hover: hover) {
    .gallery-nav-btn:hover {
        background: rgba(0, 0, 0, 0.7);
    }
}

.gallery-nav-btn.prev {
    left: 20px;
}

.gallery-nav-btn.next {
    right: 20px;
}

.gallery-nav-btn.at-boundary {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* Pantallas vacías */
.empty-state {
    text-align: center;
    margin-top: 60px;
    color: #888;
}

.empty-state span {
    font-size: 4rem;
    display: block;
    margin-bottom: 16px;
}

.custom-marker,
.custom-marker * {
    pointer-events: none !important;
}

.custom-marker {
    background-size: cover;
    width: var(--marker-size, 64px);
    height: var(--marker-size, 64px);
    border-radius: 50%;
    border: var(--marker-border, 3px) solid white;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    cursor: default;
    background-color: var(--secondary-color);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: var(--marker-font-size, 20px);
    font-weight: bold;
    color: white;
    transition: width 0.1s, height 0.1s, font-size 0.1s, border-width 0.1s;
    overflow: hidden;
}

.nav-icon {
    width: 32px;
    height: 32px;
    vertical-align: text-bottom;
    margin-right: 4px;
    object-fit: contain;
}

.memory-admin-actions button img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

/* --- GALERÍA DE VIAJE --- */
.screen-header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.screen-header-container .screen-header {
    font-family: 'PRViking', sans-serif;
    font-size: 2.6rem;
    line-height: 1.1;
    margin-bottom: 0;
    margin-top: 10px;
}

.btn-gallery-access {
    background: none;
    border: none;
    width: 90px;
    height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.35));
}

.btn-gallery-access:active {
    transform: scale(0.9);
}

.btn-gallery-access img {
    width: 76px;
    height: 76px;
    object-fit: contain;
}

/* Pantalla de Rejilla (Grid View) */
#trip-gallery-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #e5dec9;
    /* Warm parchment tone */
    background-image:
        radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.4) 0%, rgba(0, 0, 0, 0.05) 100%),
        url('data:image/svg+xml;utf8,<svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"><filter id="noiseFilter"><feTurbulence type="fractalNoise" baseFrequency="0.65" numOctaves="3" stitchTiles="stitch"/></filter><rect width="100%" height="100%" filter="url(%23noiseFilter)" opacity="0.08"/></svg>');
    color: #2b221a;
    /* Deep brown readable text */
    z-index: 200;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.trip-gallery-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: calc(15px + env(safe-area-inset-top)) 20px 15px 20px;
    background: rgba(229, 222, 201, 0.95);
    border-bottom: 1px solid rgba(43, 34, 26, 0.12);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 201;
}

.trip-gallery-header-left {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 100%;
}

.trip-gallery-close-btn {
    background: rgba(43, 34, 26, 0.08);
    border: none;
    color: #2b221a;
    font-size: 1.2rem;
    cursor: pointer;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.1s;
}

.trip-gallery-close-btn:active {
    background: rgba(43, 34, 26, 0.15);
    transform: scale(0.9);
}

.trip-gallery-title {
    font-size: 1.4rem;
    font-weight: 800;
    margin: 0;
    font-family: 'Outfit', sans-serif;
    letter-spacing: -0.5px;
    color: #2b221a;
}

.trip-gallery-grid {
    flex-grow: 1;
    overflow-y: auto;
    padding: 8px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
    -webkit-overflow-scrolling: touch;
}

.trip-gallery-grid::-webkit-scrollbar {
    display: none;
}

.trip-gallery-grid-item {
    aspect-ratio: 1 / 1;
    overflow: hidden;
    position: relative;
    border-radius: 6px;
    background: #d8ceb3;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(43, 34, 26, 0.15);
}

.trip-gallery-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.25s ease;
}

.trip-gallery-grid-item:active img {
    opacity: 0.85;
}

/* Pantalla de Carrete Detalle (Fullscreen Carrete) */
#trip-gallery-fullscreen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000000;
    z-index: 300;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.trip-fullscreen-header {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: calc(20px + env(safe-area-inset-top, 0px)) 20px 15px 20px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
    z-index: 302;
    pointer-events: none;
}

.trip-fullscreen-close-btn {
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: #ffffff;
    font-size: 1.5rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, transform 0.1s;
}

.trip-fullscreen-close-btn:active {
    background-color: rgba(255, 255, 255, 0.25);
    transform: scale(0.9);
}

/* Botones de Navegación Lateral para Carrete Fullscreen (Estilo Reddit / X de cierre) */
.trip-gallery-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    border: none;
    z-index: 305;
    transition: opacity 0.3s ease, visibility 0.3s ease, background-color 0.2s;
    user-select: none;
}

@media (hover: hover) {
    .trip-gallery-nav-btn:hover {
        background: rgba(0, 0, 0, 0.7);
    }
}

.trip-gallery-nav-btn.prev {
    left: 20px;
}

.trip-gallery-nav-btn.next {
    right: 20px;
}

.trip-gallery-nav-btn.at-boundary {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.trip-fullscreen-container {
    width: 100%;
    height: 100%;
    display: flex;
    will-change: transform;
}

.trip-fullscreen-slide {
    flex-shrink: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.trip-fullscreen-slide img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
    touch-action: none;
    transform-origin: center center;
    will-change: transform;
}

/* PWA Install Banner & Menu Item Styles */
.pwa-install-banner {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(120%);
    width: 92%;
    max-width: 420px;
    background: var(--card-bg);
    color: var(--text-color);
    padding: 14px 18px;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    z-index: 10000;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s, visibility 0.3s;
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.pwa-install-banner.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
}

.pwa-install-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    object-fit: cover;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.pwa-install-info {
    flex-grow: 1;
}

.pwa-install-title {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.pwa-install-desc {
    font-size: 0.75rem;
    color: #666;
}

.pwa-install-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(100, 149, 237, 0.2);
    transition: transform 0.2s, background-color 0.2s;
}

.pwa-install-btn:active {
    transform: scale(0.95);
}

.pwa-install-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #999;
    cursor: pointer;
    padding: 0 4px;
    transition: color 0.2s;
}

.pwa-install-close:hover {
    color: var(--text-color);
}

#menu-install-pwa {
    color: var(--primary-color);
}

#menu-install-pwa:hover {
    background: rgba(100, 149, 237, 0.1);
}

/* Modern file upload area */
.modern-upload-area {
    border: 2px dashed #D3CBBF;
    border-radius: 16px;
    background: #FAF8F5;
    padding: 24px 16px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.25s, background-color 0.25s, transform 0.15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
}

.modern-upload-area:hover {
    border-color: var(--primary-color);
    background: #F2F6FE;
    transform: translateY(-1px);
}

.modern-upload-area.dragover {
    border-color: var(--primary-color);
    background: #E5EEFE;
    transform: scale(1.02);
}

.modern-upload-area .upload-icon {
    font-size: 2rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.05));
}

.modern-upload-area .upload-text {
    font-size: 0.95rem;
    color: #555;
    font-weight: 500;
}

.modern-upload-area .upload-hint {
    font-size: 0.75rem;
    color: #888;
}

.btn-modern-upload {
    background: linear-gradient(135deg, var(--primary-color), #4B79D3);
    color: white;
    border: none;
    border-radius: 28px;
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.2, 0.8, 0.2, 1);
    box-shadow: 0 6px 20px rgba(100, 149, 237, 0.35);
    margin: 10px 0;
    width: 85%;
    max-width: 280px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    -webkit-tap-highlight-color: transparent;
}

.btn-modern-upload:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(100, 149, 237, 0.45);
}

.btn-modern-upload:active {
    transform: translateY(1px) scale(0.96);
    box-shadow: 0 4px 12px rgba(100, 149, 237, 0.25);
}

.memory-photo-container>video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.trip-fullscreen-slide video {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    backdrop-filter: blur(5px);
    transition: opacity 0.3s ease;
}

#loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(255, 255, 255, 0.2);
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.loading-text {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 8px;
    text-align: center;
}

.loading-subtext {
    font-size: 0.9rem;
    color: #ccc;
    text-align: center;
}

.mini-spinner {
    width: 32px;
    height: 32px;
    border: 3.5px solid rgba(100, 149, 237, 0.2);
    border-top: 3.5px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 12px;
}

.btn-stars-auto {
    background: linear-gradient(135deg, #a8c0ff, #3f2b96);
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    box-shadow: 0 2px 8px rgba(63, 43, 150, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
    padding: 0;
}

.btn-stars-auto:hover:not(:disabled) {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(63, 43, 150, 0.5);
}

.btn-stars-auto:active:not(:disabled) {
    transform: scale(0.95);
}

.btn-stars-auto:disabled {
    background: #ccc;
    cursor: not-allowed;
    box-shadow: none;
}

/* ==========================================================================
   ESTILOS: PANTALLA DE PREPARACIÓN MULTIMEDIA (PWA PREMIUM)
   ========================================================================== */
.prep-thumbnail {
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.prep-thumbnail:hover {
    opacity: 0.95 !important;
    transform: translateY(-2px);
}

.prep-thumbnail.active {
    box-shadow: 0 0 12px rgba(100, 149, 237, 0.7);
    transform: translateY(-2px) scale(1.05);
}

.video-trimmer-handle {
    transition: background-color 0.15s, transform 0.15s;
}

.video-trimmer-handle:active {
    background-color: var(--secondary-color) !important;
    transform: scale(1.15);
    color: white !important;
}

/* Animación de pulsación suave para la carga de FFmpeg */
@keyframes pulseGlow {
    0% {
        box-shadow: 0 0 8px rgba(100, 149, 237, 0.4);
    }

    50% {
        box-shadow: 0 0 18px rgba(100, 149, 237, 0.8);
    }

    100% {
        box-shadow: 0 0 8px rgba(100, 149, 237, 0.4);
    }
}

#btn-prep-continue {
    animation: pulseGlow 3s infinite ease-in-out;
}

#btn-prep-continue:active {
    animation: none;
    transform: scale(0.95);
}

/* ==========================================================================
   ESTILOS: POPUP MINIMALISTA DE POI
   ========================================================================== */
.minimal-poi-popup.maplibregl-popup,
.minimal-poi-popup.maplibregl-popup * {
    pointer-events: none !important;
}

/* Redefinir el contenedor del popup de Maplibre */
.minimal-poi-popup .maplibregl-popup-content {
    background: #ffffff !important;
    border-radius: 12px !important;
    padding: var(--popup-padding, 8px 14px) !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04) !important;
    border: 1px solid rgba(0, 0, 0, 0.06) !important;
    font-family: var(--font-main);
    text-align: center;
    max-width: var(--popup-max-width, 220px) !important;
    transform-origin: bottom center;
    transform: scale(var(--popup-scale, 1)) !important;
    transition: box-shadow 0.2s ease, opacity 0.15s ease;
}

.minimal-poi-popup .maplibregl-popup-content:hover {
    transform: scale(calc(var(--popup-scale, 1) * 1.05)) translateY(-2px) !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.06) !important;
}

/* Ocultar el botón por defecto de cierre de Maplibre si se renderizara */
.minimal-poi-popup .maplibregl-popup-close-button {
    display: none !important;
}

/* Estilo del contenido */
.minimal-poi-popup-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    user-select: none;
}

.poi-popup-title {
    font-size: var(--popup-font-size, 0.95rem);
    font-weight: 600;
    line-height: 1.25;
    word-break: break-word;
}

.poi-popup-stars {
    font-size: var(--popup-stars-size, 0.85rem);
    display: flex;
    justify-content: center;
    gap: 1px;
    margin-top: 2px;
}

/* Permitir que el popup detallado de búsqueda esté sobre los minimalistas */
.detail-popup.maplibregl-popup {
    z-index: 99999 !important;
}

/* Responsive columns for memories based on aspect ratio */
@media (min-aspect-ratio: 4/5) {
    #memories-list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
        align-items: start;
    }

    .memory-card {
        margin-bottom: 0;
    }
}

@media (min-aspect-ratio: 3/2) {
    #memories-list {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-aspect-ratio: 2/1) {
    #memories-list {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ==========================================
   SECCIÓN: TRIPULACIÓN (Gestión de usuarios)
   ========================================== */

#settings-screen, #crew-screen, #backup-screen, #adventures-screen, #my-trip-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #e2dacf url('/static/images/recuerdos_bg.webp') repeat;
    z-index: 25;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#settings-screen .memories-banner,
#crew-screen .memories-banner,
#backup-screen .memories-banner,
#adventures-screen .memories-banner,
#my-trip-screen .memories-banner,
#collaborators-modal .memories-banner,
#invitation-traveller-modal .memories-banner,
#invitation-follower-modal .memories-banner,
#my-trip-modal .memories-banner,
#about-modal .memories-banner {
    background: transparent;
}

.crew-content-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: 80px;
}

.crew-list-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    align-items: start;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

/* Responsivo para tablets y pantallas grandes */
@media (min-width: 600px) {
    .crew-list-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 900px) {
    .crew-list-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.adventures-grid {
    justify-content: center;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

@media (min-width: 600px) {
    .adventures-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 680px)) !important;
    }
}

.crew-card {
    background: #FFF;
    border: 2px solid #EAE0CE;
    border-radius: 20px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 4px 12px rgba(92, 64, 51, 0.05);
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.crew-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(92, 64, 51, 0.1);
}

.crew-card-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    border: 3px solid var(--primary-color, #d4a373);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    background: #FDFBF7;
}

.crew-card-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.crew-card-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    /* previene desborde de textos largos */
}

.crew-card-name {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-color, #2b1f1d);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.crew-card-title {
    font-size: 0.85rem;
    color: #8b7355;
    font-weight: bold;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.crew-card-badges {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}

.crew-badge {
    font-size: 0.65rem;
    font-weight: bold;
    padding: 3px 8px;
    border-radius: 8px;
    letter-spacing: 0.5px;
}

.badge-admin {
    background: #fde8e8;
    color: #e53e3e;
    border: 1px solid #fecaca;
}

.badge-guest {
    background: #edf2f7;
    color: #4a5568;
    border: 1px solid #e2e8f0;
}

.badge-self {
    background: #e6fffa;
    color: #319795;
    border: 1px solid #b2f5ea;
}

.crew-card-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-crew-action {
    border: none;
    background: #F8F4EB;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.95rem;
    transition: background-color 0.2s, transform 0.1s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.btn-crew-action:active {
    transform: scale(0.92);
}

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

.btn-crew-action.delete:hover {
    background: #fee2e2;
}

/* Modal Formulario Tripulación */
.slide-up-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color, #FAF6EE) !important;
    z-index: 35;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.1, 0.8, 0.2, 1);
}

.slide-up-modal:not(.hidden) {
    transform: translateY(0);
}

#my-trip-modal,
#collaborators-modal,
#invitation-traveller-modal,
#invitation-follower-modal,
#about-modal {
    background: #e2dacf url('/static/images/recuerdos_bg.webp') repeat !important;
}

#crew-modal-title {
    font-family: 'PRViking', sans-serif;
    font-size: 2.1rem;
    font-weight: bold;
    color: #3b281b;
    text-shadow: 1px 1px 0px rgba(255, 255, 255, 0.5);
    text-align: center;
    margin-top: 40px;
    margin-bottom: 48px;
    transform: scaleY(1.2);
    transform-origin: center center;
}

.crew-icon-selectors {
    display: flex;
    gap: 16px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.crew-icon-radio {
    cursor: pointer;
    position: relative;
}

.crew-icon-radio input[type="radio"] {
    display: none;
}

.crew-icon-radio img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid transparent;
    transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    background: #FFF;
}

.crew-icon-radio input[type="radio"]:checked+img {
    border-color: var(--primary-color, #d4a373);
    transform: scale(1.08);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

/* Backups Management Screen Styling */
.backup-list-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 20px 0;
}

.backup-card {
    background: #FFF;
    border: 2px solid #EAE0CE;
    border-radius: 20px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    box-shadow: 0 4px 12px rgba(92, 64, 51, 0.05);
    transition: transform 0.2s, box-shadow 0.2s;
}

.backup-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(92, 64, 51, 0.1);
}

.backup-card-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.backup-card-date {
    font-size: 1.15rem;
    font-weight: bold;
    color: #3b281b;
    margin: 0;
}

.backup-card-filename {
    font-size: 0.9rem;
    color: #666;
    margin: 0;
    font-family: monospace;
    word-break: break-all;
}

.backup-card-size {
    font-size: 0.85rem;
    color: #888;
    margin: 0;
}

.backup-card-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-restore {
    background-color: var(--primary-color, #d4a373) !important;
    color: white !important;
    border: none !important;
    padding: 8px 16px !important;
    border-radius: 12px !important;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.9rem;
    transition: background-color 0.2s, transform 0.1s;
}

.btn-restore:hover {
    background-color: #c59363 !important;
    transform: scale(1.03);
}

.btn-restore:active {
    transform: scale(0.97);
}

/* =========================================================
   MODAL: TAMAÑO DE TEXTO
   ========================================================= */

.ts-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease-out;
}

.ts-modal-overlay.hidden {
    display: none !important;
}

.ts-modal-card {
    background: #FDFBF7;
    border-radius: 24px;
    padding: 28px 24px 24px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    animation: slideUp 0.25s cubic-bezier(0.1, 0.8, 0.2, 1);
    /* Aislamos el modal del escalado global de texto: el usuario está
       eligiendo el tamaño, no viendo el modal ya escalado */
    font-size: 16px;
    /* Scroll vertical de seguridad por si el contenido no cabe */
    max-height: 90vh;
    overflow-y: auto;
}

.ts-modal-title {
    font-size: 1.3em;
    font-weight: 800;
    color: #222;
    margin-bottom: 8px;
}

.ts-modal-desc {
    font-size: 0.88em;
    color: #777;
    line-height: 1.5;
    margin-bottom: 24px;
}

/* Selector de 5 niveles */
.ts-selector {
    display: flex;
    gap: 6px;
    margin-bottom: 24px;
    justify-content: stretch;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

.ts-level-btn {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 10px 2px 8px;
    border: 2px solid #e0ddd6;
    border-radius: 14px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.18s, background 0.18s, transform 0.12s;
    font-family: var(--font-main);
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

.ts-level-btn:active {
    transform: scale(0.94);
}

.ts-level-btn.active {
    border-color: var(--primary-color);
    background: rgba(100, 149, 237, 0.08);
}

.ts-level-icon {
    font-size: 1.1em;
    line-height: 1;
}

.ts-level-label {
    font-size: 0.62em;
    font-weight: 600;
    color: #888;
    text-align: center;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.ts-level-btn.active .ts-level-label {
    color: var(--primary-color);
}

/* Previsualización */
.ts-preview-card {
    border: 2px dashed #d8d4cb;
    border-radius: 16px;
    padding: 16px 18px;
    background: #fff;
    margin-bottom: 22px;
    transition: font-size 0.2s ease;
}

.ts-preview-label {
    font-size: 0.7em;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #bbb;
    font-weight: 600;
    margin-bottom: 10px;
}

.ts-preview-title {
    font-size: 1em;
    font-weight: 800;
    color: #333;
    margin-bottom: 6px;
}

.ts-preview-body {
    font-size: 0.88em;
    color: #555;
    line-height: 1.55;
}

/* Botones del modal */
.ts-modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.ts-btn-cancel {
    flex: 1;
    min-width: min(100px, 100%);
    padding: 13px;
    border-radius: 14px;
    border: 2px solid #e0ddd6;
    background: #fff;
    font-family: var(--font-main);
    font-size: 0.95em;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    transition: background 0.15s;
}

.ts-btn-cancel:active {
    background: #f0ede6;
}

.ts-btn-save {
    flex: 2;
    min-width: min(140px, 100%);
    padding: 13px;
    border-radius: 14px;
    border: none;
    background: var(--primary-color);
    font-family: var(--font-main);
    font-size: 0.95em;
    font-weight: 700;
    color: #fff;
    cursor: pointer;
    transition: filter 0.15s, transform 0.12s;
}

.ts-btn-save:hover {
    filter: brightness(1.08);
}

.ts-btn-save:active {
    transform: scale(0.97);
}

/* Horizontal scroll container for POI and Memory thumbnails */
.thumbnails-scroll-container {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
    /* Solo transicionamos height, no 'all', para evitar que el bounding box
       animado bloquee clicks en elementos de abajo durante la transición */
    transition: height 0.2s ease, margin 0.2s ease, padding 0.2s ease;
}

/* Hide or collapse container if both child elements are empty */
.thumbnails-scroll-container:not(:has(> div:not(:empty))) {
    margin-bottom: 0;
    padding: 0;
    height: 0;
    overflow: hidden;
    /* Evitar que el área invisible intercepte eventos de click */
    pointer-events: none;
}

/* When there are photos, add padding and margin-bottom */
.thumbnails-scroll-container:has(> div:not(:empty)) {
    margin-bottom: 12px;
    padding: 4px 2px;
    pointer-events: auto;
}

/* Hide empty child wrappers so they don't create unnecessary flex gaps */
.thumbnails-scroll-container > div:empty {
    display: none !important;
}

/* Styling for the custom scrollbar of the thumbnails row */
.thumbnails-scroll-container::-webkit-scrollbar {
    height: 6px;
}
.thumbnails-scroll-container::-webkit-scrollbar-track {
    background: transparent;
}
.thumbnails-scroll-container::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 3px;
}
.thumbnails-scroll-container::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* Menú contextual de aventura */
.adventure-context-dropdown .dropdown-item:hover {
    background-color: #f6f4ee;
}
.adventure-context-dropdown .dropdown-item.delete:hover {
    background-color: #ffe6e6;
}

/* Google Sign-in Button Styles */
.btn-google-login {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    background-color: #FFFFFF;
    border: 2px solid #D5C1A3;
    border-radius: 12px;
    color: #4A3A2C;
    font-family: var(--font-main);
    font-size: 1.1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    margin: 0;
    box-sizing: border-box;
    transition: background-color 0.2s, border-color 0.2s, box-shadow 0.2s, transform 0.1s;
}

.btn-google-login:hover {
    background-color: #FDFBF7;
    border-color: #2D8B9B;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.btn-google-login:active {
    transform: scale(0.98);
}

.btn-google-login .google-icon-svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* My Trip Search Results Card */
#my-trip-search-results {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border: 1px solid #EAEAEA;
    overflow: hidden;
}
#my-trip-search-results:empty {
    display: none;
    border: none;
    box-shadow: none;
}

/* Crew Actions Move Buttons Disabled Style */
.btn-crew-action:disabled {
    opacity: 0.3 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
}
.btn-crew-action:hover {
    background: #EAE0CE;
}

/* Campana de Notificaciones PUSH */
.notification-bell-container {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding: 12px 20px;
    gap: 12px;
    width: 100%;
    flex-shrink: 0;
    animation: fadeIn 0.3s ease-out;
    box-sizing: border-box;
}

.btn-notification-bell {
    width: 44px;
    height: 44px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
    border: 2px solid var(--primary-color, #4A7FC1);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
    padding: 0;
    cursor: pointer;
    flex-shrink: 0;
}

.btn-notification-bell:hover {
    background: #f0f4ff;
    box-shadow: 0 5px 12px rgba(0, 0, 0, 0.18);
}

.btn-notification-bell:active {
    transform: scale(0.92);
}

.btn-notification-bell svg {
    display: block;
    color: var(--primary-color, #4A7FC1);
    width: 20px;
    height: 20px;
}

.notification-bell-text {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-color, #333333);
}

/* ==========================================
   SECCIÓN: CONFIGURACIÓN (Pantalla Centralizada)
   ========================================== */
.settings-content-container {
    flex: 1;
    min-height: 0;
    width: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 20px;
    padding-bottom: 90px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    box-sizing: border-box;
}

.settings-card {
    background: #FFFFFF;
    border: 2px solid #EAE0CE;
    border-radius: 20px;
    width: 100%;
    max-width: 580px;
    box-shadow: 0 4px 16px rgba(92, 64, 51, 0.06);
    overflow: hidden;
    flex-shrink: 0;
    transition: transform 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.settings-card:hover {
    box-shadow: 0 6px 20px rgba(92, 64, 51, 0.1);
}

.settings-card-header {
    background: #FAF6EE;
    border-bottom: 1.5px solid #EAE0CE;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.settings-card-icon {
    font-size: 1.25rem;
    line-height: 1;
}

.settings-card-title {
    font-family: 'TwinMarker', sans-serif;
    font-size: 1.2rem;
    color: #3b281b;
    margin: 0;
    letter-spacing: 0.5px;
}

.settings-card-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.settings-profile-avatar-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 8px;
}

.settings-profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 3px solid #3b281b;
    object-fit: cover;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.settings-card-actions {
    margin-top: 8px;
    display: flex;
    justify-content: flex-end;
}

.btn-settings-save {
    padding: 10px 28px;
    font-size: 0.95rem;
    border-radius: 24px;
    background: var(--primary-color, #6495ED);
    color: white;
    font-weight: 600;
    border: none;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(100, 149, 237, 0.3);
    transition: transform 0.15s, box-shadow 0.15s;
}

.btn-settings-save:active {
    transform: scale(0.96);
}

/* Fila de opción tipo botón / link */
.settings-option-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: #FDFBF7;
    border: 1.5px solid #EAE0CE;
    border-radius: 14px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s, transform 0.15s;
}

.settings-option-item:hover {
    background: #F8F3EA;
    border-color: #D9CBBA;
    transform: translateX(2px);
}

.settings-option-item:active {
    transform: scale(0.99);
}

.settings-option-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.settings-option-icon {
    font-size: 1.3rem;
    line-height: 1;
}

.settings-option-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.settings-option-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-color, #333333);
}

.settings-option-sub {
    font-size: 0.8rem;
    color: #777777;
}

.settings-option-arrow {
    font-size: 1.4rem;
    color: #A09080;
    font-weight: 400;
}

/* Fila de setting con control / toggle */
.settings-setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: #FDFBF7;
    border: 1.5px solid #EAE0CE;
    border-radius: 14px;
    gap: 12px;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

.settings-setting-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
    word-break: break-word;
}

.settings-setting-label {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-color, #333333);
    word-break: break-word;
}

.settings-setting-sub {
    font-size: 0.82rem;
    font-weight: 600;
    color: #888;
    word-break: break-word;
}

.settings-setting-sub.active-status {
    color: #2E7D32;
}

.settings-info-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #FDFBF7;
    border: 1.5px solid #EAE0CE;
    border-radius: 14px;
    gap: 12px;
    flex-wrap: wrap;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
}

.settings-info-label {
    font-weight: 500;
    font-size: 0.9rem;
    color: #555;
    min-width: 0;
    word-break: break-word;
}

.settings-info-value {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-color, #333);
    background: #EAE0CE;
    padding: 3px 10px;
    border-radius: 12px;
}

/* Toggle Switch Switcher Component */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #D1C7B7;
    transition: 0.3s;
    border-radius: 28px;
    border: 1.5px solid #BCB09E;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 2.5px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

input:checked + .toggle-slider {
    background-color: var(--primary-color, #6495ED);
    border-color: #4A7FC1;
}

input:checked + .toggle-slider:before {
    transform: translateX(23px);
}

/* Banner de Aviso Offline */
.offline-notice-banner {
    position: fixed;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99999;
    background: rgba(40, 44, 52, 0.92);
    color: #FDFBF7;
    padding: 8px 18px;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    pointer-events: none;
}

.offline-notice-banner.hidden {
    opacity: 0;
    transform: translate(-50%, -20px);
    pointer-events: none !important;
    display: none !important;
}

.offline-banner-icon {
    font-size: 1rem;
}

.btn-restore-order:hover {
    background-color: #edf2f7 !important;
    border-color: #a0aec0 !important;
    color: #2d3748 !important;
}

.btn-restore-order:active {
    background-color: #e2e8f0 !important;
    transform: translateY(1px);
}

/* Reglas globales de prevención de desborde horizontal para texto grande y dispositivos móviles */
@media (max-width: 600px) {
    .crew-content-container {
        padding: 16px 12px !important;
    }

    .memories-banner .screen-header {
        font-size: clamp(1.1rem, 5vw, 1.6rem) !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }
}

.slide-up-modal,
.poi-modal {
    max-width: 100vw !important;
    box-sizing: border-box !important;
}