/* landing.css - Premium Modern Design */

:root {
    --bg-color: #0b0f19;
    --bg-secondary: #131a2a;
    --text-primary: #e2e8f0;
    --text-secondary: #94a3b8;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --border-color: rgba(255, 255, 255, 0.08);
    --glass-bg: rgba(19, 26, 42, 0.6);
    --glass-border: rgba(255, 255, 255, 0.1);
    --sidebar-inset: 18px;
    --mobile-sidebar-inset: 8px;
    --mobile-header-pad-y: 10px;
    --mobile-header-pad-x: 12px;
    --mobile-logo-size: 1.05rem;
    --mobile-logo-gap: 6px;
    --mobile-subtitle-gap: 2px;
    --mobile-subtitle-size: 0.72rem;
    --mobile-container-pad-x: 10px;
    --mobile-container-pad-top: 10px;
    --mobile-container-pad-bottom: 18px;
    --mobile-list-gap: 10px;
    --mobile-card-height: 96px;
    --mobile-fab-size: 48px;
    --mobile-fab-right: 16px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    height: 100%;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow: hidden;
    height: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
    max-width: 100vw;
}

.app-layout {
    position: relative;
    height: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
    max-width: 100vw;
    overflow: hidden;
    box-sizing: border-box;
    padding-top: env(safe-area-inset-top, 0px);
    padding-right: env(safe-area-inset-right, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    padding-left: env(safe-area-inset-left, 0px);
}

.app-layout.sidebar-collapsed .map-view {
    width: 100%;
    height: 100%;
}

/* ── Map (always fullscreen behind everything) ── */
.map-view {
    position: absolute;
    inset: 0;
}

/* Solo fade-in: transform/filter en el contenedor compiten con el canvas WebGL y suelen causar parpadeos al mover la cámara. */
.map-container {
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.55s ease;
}

.map-container.is-ready {
    opacity: 1;
}

/* ── Sidebar Panel ── */
.sidebar {
    position: absolute;
    left: var(--sidebar-inset);
    top: var(--sidebar-inset);
    bottom: var(--sidebar-inset);
    width: min(440px, 36vw);
    min-width: 340px;
    background: rgba(19, 26, 42, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    z-index: 30;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.28);
    transform-origin: top left;
    transition: width 0.45s ease, min-width 0.45s ease, opacity 0.35s ease,
                transform 0.45s ease, background-color 0.35s ease, border-color 0.35s ease;
}

.sidebar.is-hiding {
    width: 0;
    min-width: 0;
    opacity: 0;
    transform: translateY(28px);
    background: transparent;
    pointer-events: none;
    border-color: transparent;
    box-shadow: none;
    overflow: hidden;
}

.sidebar-header {
    flex: 0 0 auto;
    padding: 18px 18px;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.35rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    letter-spacing: -0.5px;
}

.subtitle {
    margin-top: 6px;
    font-size: 0.82rem;
    color: var(--text-secondary);
}

.landify-user-bar {
    margin-top: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
}

.landify-user-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.landify-user-avatar {
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.landify-user-name {
    font-size: 0.8rem;
    color: var(--text-primary);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 160px;
}

.landify-user-logout {
    flex-shrink: 0;
    font-size: 0.72rem;
    font-weight: 500;
    font-family: inherit;
    color: var(--accent);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px 0;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.landify-user-logout:hover {
    color: var(--accent-hover);
}

.projects-container {
    flex: 1 1 0%;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    padding: 12px 14px 16px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
    border-radius: 0 0 14px 14px;
}

.projects-container::-webkit-scrollbar {
    width: 5px;
}
.projects-container::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 4px;
}

.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 44px;
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    padding: 10px 14px;
    border-radius: 8px;
    font-weight: 500;
    transition: background 0.2s;
    border: none;
    font-size: 0.92rem;
    line-height: 1.25;
    text-align: center;
    white-space: normal;
    overflow-wrap: anywhere;
}

/* ── FAB Add Project ── */
.fab-add-project {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 52px;
    height: 52px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.4);
    z-index: 100;
    transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease, bottom 0.3s ease, opacity 0.35s ease;
}

.fab-add-project:hover {
    background: var(--accent-hover);
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 12px 26px rgba(37, 99, 235, 0.48);
}

.fab-add-project:active {
    transform: translateY(0) scale(0.97);
}

/* ── Glassmorphism utility ── */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
}

/* ── Project List ── */
.project-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: opacity 0.35s ease, transform 0.35s ease, filter 0.35s ease;
}

.project-card {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    animation: fadeIn 0.5s ease backwards;
}

.project-card:hover {
    transform: translateY(-3px);
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--accent);
    box-shadow: 0 10px 20px rgba(0,0,0,0.2), 0 0 15px rgba(59, 130, 246, 0.2);
}

.project-card.active {
    border-color: var(--accent);
    background: rgba(59, 130, 246, 0.1);
}

/* Cuando solo hay un proyecto, mantener card compacta con más detalle visible. */
.project-list.single-item .project-card {
    flex-direction: row;
    height: auto;
    min-height: 120px;
}

.project-list.single-item .project-img-container {
    width: 108px;
    height: 100%;
    flex-shrink: 0;
}

.project-list.single-item .project-desc {
    display: none;
}

.project-list.single-item .project-stats {
    flex-wrap: nowrap;
    gap: 8px;
    align-items: center;
}

.project-list.single-item .project-info {
    justify-content: flex-start;
}

.project-list.single-item .project-title {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    line-height: 1.25;
}

.project-list.single-item .stat-badge {
    font-size: 0.68rem;
    padding: 4px 8px;
}

.project-img-container {
    width: 100%;
    height: 150px;
    overflow: hidden;
    position: relative;
}

.project-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.project-card:hover .project-img {
    transform: scale(1.05);
}

.project-info {
    padding: 12px 14px;
}

.project-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.project-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.project-stats {
    display: flex;
    gap: 10px;
}

.stat-badge {
    background: rgba(0, 0, 0, 0.3);
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.72rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 5px;
    border: 1px solid rgba(255,255,255,0.05);
}

.stat-icon {
    opacity: 0.7;
}

/* ── Ubicación del proyecto (esquina superior derecha, siempre visible) ── */
.map-project-location {
    position: fixed;
    top: 28px;
    right: 20px;
    z-index: 90;
    max-width: min(42vw, 340px);
    padding: 10px 14px;
    border-radius: 12px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    pointer-events: none;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.map-project-location[hidden] {
    display: none !important;
}

.map-project-location.is-visible {
    animation: locationBadgeIn 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes locationBadgeIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.map-project-location-icon {
    flex-shrink: 0;
    font-size: 0.95rem;
    line-height: 1.35;
    opacity: 0.9;
}

.map-project-location-text {
    font-size: 0.86rem;
    font-weight: 500;
    line-height: 1.35;
    color: var(--text-primary);
    text-align: right;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow: hidden;
}

/* Transición al editor: pulso sobre el mensaje “Viajando a…” */
@keyframes map-project-location-travel-pulse {
    0%,
    100% {
        opacity: 1;
        transform: scale(1);
        text-shadow: 0 0 0 transparent;
    }
    50% {
        opacity: 0.92;
        transform: scale(1.035);
        text-shadow: 0 0 14px rgba(99, 179, 237, 0.45);
    }
}

.map-project-location.is-editor-travel-pulse .map-project-location-text {
    display: block;
    -webkit-line-clamp: unset;
    overflow: visible;
    animation: map-project-location-travel-pulse 1.15s ease-in-out infinite;
    will-change: transform, opacity;
}

@media (prefers-reduced-motion: reduce) {
    .map-project-location.is-editor-travel-pulse .map-project-location-text {
        animation: none;
        transform: none;
        text-shadow: none;
        opacity: 1;
    }
}

/* ── Map Overlay Message ── */
.map-overlay-info {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(92vw, 520px);
    padding: 16px 20px;
    border-radius: 16px;
    text-align: center;
    pointer-events: none;
    transition: opacity 0.42s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.42s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 50;
}

.map-overlay-info.is-dismissing {
    opacity: 0;
    transform: translate(-50%, -50%) translateY(-40px);
}

/* Invisible hasta el primer layout (p. ej. top en móvil); evita salto visual antes de la posición final. */
.map-overlay-info.map-overlay-info--layout-pending {
    opacity: 0;
    visibility: hidden;
    transition: none;
}

.map-overlay-info h2 {
    font-size: 1.4rem;
    margin-bottom: 6px;
    color: #fff;
}

.map-overlay-info p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ── Popup de proyecto (landing) ── */
.landing-project-popup .mapboxgl-popup-content {
    background: rgba(19, 26, 42, 0.94);
    color: #e2e8f0;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35);
    padding: 0;
    overflow: hidden;
}

.landing-project-popup .mapboxgl-popup-tip {
    border-top-color: rgba(19, 26, 42, 0.94);
}

.landing-project-popup-card {
    min-width: auto;
    max-width: none;
    padding: 8px;
}

.landing-project-popup-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.landing-popup-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    min-width: 42px;
    min-height: 38px;
    border-radius: 9px;
    border: 1px solid transparent;
    text-decoration: none;
    cursor: pointer;
    font-size: 0.84rem;
    font-weight: 600;
    transition: transform 0.15s ease, opacity 0.15s ease, background 0.2s ease;
}

.landing-popup-btn:hover {
    transform: translateY(-1px);
}

.landing-popup-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.85rem;
    min-height: 1.85rem;
    padding: 3px;
    border-radius: 9px;
    font-size: 1.08rem;
    line-height: 1;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.28),
        0 2px 8px rgba(0, 0, 0, 0.22);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    transition: background 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.landing-popup-btn-edit .landing-popup-btn-icon {
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.38), rgba(255, 255, 255, 0.1));
    border: 1px solid rgba(191, 219, 254, 0.65);
}

.landing-popup-btn-delete .landing-popup-btn-icon {
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0.06));
    border: 1px solid rgba(254, 202, 202, 0.55);
}

.landing-popup-btn-edit {
    background: linear-gradient(150deg, #3b82f6 0%, #1d4ed8 100%);
    border-color: rgba(147, 197, 253, 0.9);
    color: #fff;
    font-size: 1rem;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.42);
}

.landing-popup-btn-edit:hover {
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.52);
}

.landing-popup-btn-edit:hover .landing-popup-btn-icon {
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.48), rgba(255, 255, 255, 0.16));
    border-color: rgba(219, 234, 254, 0.85);
}

.landing-popup-btn-delete {
    background: linear-gradient(150deg, rgba(220, 38, 38, 0.55), rgba(153, 27, 27, 0.62));
    border-color: rgba(252, 165, 165, 0.75);
    color: #fff;
    font-size: 1rem;
    box-shadow: 0 4px 14px rgba(185, 28, 28, 0.35);
}

.landing-popup-btn-delete:hover {
    box-shadow: 0 6px 18px rgba(185, 28, 28, 0.45);
}

.landing-popup-btn-delete:hover .landing-popup-btn-icon {
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.38), rgba(255, 255, 255, 0.12));
    border-color: rgba(254, 226, 226, 0.75);
}

/* ── Shared App Modal (same visual style as editor) ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 120;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s;
}

.modal-card {
    background: #131a2a;
    color: #e8e8f0;
    border-radius: 12px;
    padding: 28px 32px;
    min-width: 320px;
    max-width: 90vw;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.07);
    display: flex;
    flex-direction: column;
    gap: 10px;
    animation: slideUp 0.22s cubic-bezier(.22, 1, .36, 1);
    position: relative;
}

.modal-card h3 {
    margin: 0 0 6px;
    font-size: 18px;
    font-weight: 700;
    color: #f5d37a;
    letter-spacing: 0.3px;
}

.app-info-modal-card {
    max-width: min(92vw, 420px);
}

.app-modal-message {
    margin: 2px 0 0;
    color: #e8e8f0;
    font-size: 14px;
    line-height: 1.5;
}

.modal-btns {
    display: flex;
    gap: 10px;
    margin-top: 8px;
    align-items: stretch;
}

.modal-btn-guardar,
.modal-btn-cancelar {
    border: none;
    padding: 11px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s;
    font-family: inherit;
}

.modal-btn-guardar {
    flex: 1;
    background: linear-gradient(135deg, #f5d37a, #c0872a);
    color: #1e1e2e;
}

.modal-btn-cancelar {
    flex: 0 0 46px;
    width: 46px;
    min-width: 46px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.08);
    color: #e8e8f0;
}

.modal-btn-guardar:hover,
.modal-btn-cancelar:hover {
    opacity: 0.85;
    transform: translateY(-1px);
}

/* Confirm modal: misma estética Landify (neutral + acción destructiva). */
.app-confirm-modal .modal-btns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.app-confirm-modal .modal-btn-cancelar {
    width: 100%;
    min-width: 0;
    flex: 1 1 auto;
    padding: 11px 12px;
    background: rgba(255, 255, 255, 0.08);
    color: #f1f2f8;
    border: 1px solid rgba(255, 255, 255, 0.16);
}

.app-confirm-modal .modal-btn-guardar {
    width: 100%;
    min-width: 0;
    flex: 1 1 auto;
    background: linear-gradient(135deg, #d5534f, #9f2622);
    color: #fff;
    border: 1px solid rgba(255, 176, 176, 0.28);
}

.app-confirm-modal .app-modal-confirm {
    order: 1;
}

.app-confirm-modal .app-modal-cancel {
    order: 2;
}

.app-project-edit-card {
    width: 100%;
    max-width: min(92vw, 560px);
    min-width: 0;
    max-height: min(92vh, 720px);
    overflow-x: hidden;
    overflow-y: auto;
}

/* Entrada del modal editar: móvil = desde arriba hacia abajo; tablet/PC = desde la derecha */
@keyframes appProjectEditSlideDown {
    from {
        opacity: 0;
        transform: translateY(calc(-100% - 16px));
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes appProjectEditSlideFromRight {
    from {
        opacity: 0;
        transform: translate3d(calc(100% + 28px), 0, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

.app-project-edit-modal .app-project-edit-card {
    animation: appProjectEditSlideDown 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@media (min-width: 769px) {
    .app-project-edit-modal .app-project-edit-card {
        animation: appProjectEditSlideFromRight 0.42s cubic-bezier(0.16, 1, 0.3, 1) both;
    }
}

/* Cierre: sentido inverso a la entrada (móvil = hacia arriba; tablet/PC = hacia la derecha) */
@keyframes appProjectEditSlideUpExit {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(calc(-100% - 16px));
    }
}

@keyframes appProjectEditSlideToRightExit {
    from {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
    to {
        opacity: 0;
        transform: translate3d(calc(100% + 28px), 0, 0);
    }
}

.app-project-edit-modal .app-project-edit-card.app-project-edit-exit--mobile {
    animation: appProjectEditSlideUpExit 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.app-project-edit-modal .app-project-edit-card.app-project-edit-exit--desktop {
    animation: appProjectEditSlideToRightExit 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.app-project-edit-modal.app-project-edit-modal--closing {
    pointer-events: none;
}

/* Modal editar proyecto: más ancho en tablet y escritorio */
@media (min-width: 769px) {
    .app-project-edit-card {
        width: 100%;
        max-width: min(94vw, 640px);
        padding: 30px 34px;
    }
}

@media (min-width: 1025px) {
    .app-project-edit-card {
        width: 100%;
        max-width: min(92vw, 760px);
        padding: 32px 40px;
    }
}

.app-project-edit-close {
    position: absolute;
    right: 10px;
    top: 10px;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: #f2f2f8;
    font-size: 16px;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.15s ease;
    z-index: 1;
}

.app-project-edit-close:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: translateY(-1px);
}

.app-project-edit-title {
    padding-right: 36px;
}

/* Editar proyecto: móvil — panel hacia arriba (legible con sidebar/map) */
.app-project-edit-modal.modal-overlay {
    align-items: flex-start;
    justify-content: center;
    padding: max(18px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    overflow-x: hidden;
}

/* Móvil: panel a altura de pantalla (más espacio para editar; tablet/PC sin cambios) */
@media (max-width: 768px) {
    .app-project-edit-modal.modal-overlay {
        align-items: stretch;
        align-content: stretch;
        padding-top: max(18px, env(safe-area-inset-top));
        padding-bottom: max(18px, env(safe-area-inset-bottom));
        padding-left: max(10px, env(safe-area-inset-left));
        padding-right: max(10px, env(safe-area-inset-right));
        min-height: 100vh;
        min-height: 100dvh;
        min-height: 100svh;
        box-sizing: border-box;
    }

    .app-project-edit-card {
        width: 100%;
        max-width: 100%;
        max-height: none;
        min-height: 0;
        flex: 1 1 auto;
        align-self: stretch;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    .app-project-edit-fields {
        --app-project-edit-pair-gap: 2px;
        display: flex;
        flex-direction: column;
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        gap: 0;
        align-items: stretch;
    }

    /* Mismo hueco título→control que en bloque foto (grid gap); entre bloques un poco menos para dar altura al textarea */
    .app-project-edit-fields label {
        margin-top: 0;
        margin-bottom: var(--app-project-edit-pair-gap);
        line-height: 1.25;
    }

    .app-project-edit-fields .app-project-edit-photo-block {
        gap: var(--app-project-edit-pair-gap);
        margin-bottom: 12px;
    }

    .app-project-edit-fields input#project-edit-nombre,
    .app-project-edit-fields .app-project-edit-geo-wrap {
        margin-bottom: 12px;
    }

    /* El alto extra va al textarea descripción */
    .app-project-edit-fields > *:not(#project-edit-descripcion) {
        flex-shrink: 0;
    }

    .app-project-edit-fields #project-edit-descripcion {
        flex: 1 1 auto;
        min-height: 92px;
        resize: none;
    }

    .app-project-edit-actions {
        flex-shrink: 0;
    }
}

/* Tablet y PC — panel a la derecha y centrado en vertical */
@media (min-width: 769px) {
    .app-project-edit-modal.modal-overlay {
        align-items: center;
        justify-content: flex-end;
        padding: max(24px, env(safe-area-inset-top)) max(28px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(28px, env(safe-area-inset-left));
        /* No recortar el translateX del panel (overflow-x:hidden producía corte al entrar/salir) */
        overflow-x: visible;
        overflow-y: visible;
    }
}

/* Tablet: modal más ancho y menos aire arriba/abajo (el panel usa mejor el viewport) */
@media (min-width: 769px) and (max-width: 1024px) {
    .app-project-edit-modal.modal-overlay {
        padding-top: max(10px, env(safe-area-inset-top));
        padding-bottom: max(10px, env(safe-area-inset-bottom));
        padding-left: max(14px, env(safe-area-inset-left));
        padding-right: max(18px, env(safe-area-inset-right));
    }

    .app-project-edit-card {
        width: 100%;
        max-width: min(97vw, 720px);
        max-height: min(96vh, 780px);
        padding: 26px 28px;
    }
}

.app-project-edit-fields {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.app-project-edit-fields label {
    font-size: 12px;
    font-weight: 600;
    color: #a0a0c0;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.app-project-edit-fields input,
.app-project-edit-fields textarea {
    width: 100%;
    min-width: 0;
    background: #2a2a3e;
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #e8e8f0;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    box-sizing: border-box;
}

.app-project-edit-fields textarea {
    resize: vertical;
    min-height: 92px;
    overflow-wrap: break-word;
}

.app-project-edit-fields input:focus,
.app-project-edit-fields textarea:focus {
    border-color: #c0872a;
}

.app-project-edit-geo-wrap {
    position: relative;
    z-index: 2;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.app-project-edit-geo-suggestions {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    margin: 0;
    padding: 4px 0;
    list-style: none;
    max-height: 220px;
    overflow-y: auto;
    background: #1a2235;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
    z-index: 10;
}

/* Lista reubicada bajo el input (JS): mismo ancho, pegada al borde inferior del campo */
.app-project-edit-geo-suggestions.app-project-edit-geo-suggestions--docked {
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.42);
}

.app-project-edit-geo-item {
    padding: 8px 12px;
    font-size: 13px;
    line-height: 1.35;
    color: #e8e8f0;
    cursor: pointer;
    transition: background 0.12s ease;
    overflow-wrap: anywhere;
}

.app-project-edit-geo-item:hover,
.app-project-edit-geo-item:focus {
    background: rgba(59, 130, 246, 0.25);
    outline: none;
}

.app-project-edit-photo-block {
    display: grid;
    gap: 6px;
}

.app-project-edit-photo-label {
    font-size: 12px;
    font-weight: 600;
    color: #a0a0c0;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.app-project-edit-foto-input-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.app-project-edit-photo-dropzone {
    position: relative;
    width: 100%;
    min-height: 148px;
    max-height: 200px;
    border-radius: 10px;
    border: 1px dashed rgba(255, 255, 255, 0.28);
    background: rgba(0, 0, 0, 0.22);
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
    outline: none;
}

.app-project-edit-photo-dropzone:hover {
    border-color: rgba(245, 211, 122, 0.45);
    background: rgba(0, 0, 0, 0.28);
}

.app-project-edit-photo-dropzone:focus-visible {
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.55);
    border-color: rgba(96, 165, 250, 0.65);
}

.app-project-edit-photo-dropzone.is-dragover {
    border-color: rgba(59, 130, 246, 0.85);
    background: rgba(59, 130, 246, 0.14);
    border-style: solid;
}

.app-project-edit-photo-empty {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 16px;
    text-align: center;
    pointer-events: none;
}

.app-project-edit-photo-drop-icon {
    font-size: 1.75rem;
    line-height: 1;
    opacity: 0.75;
}

.app-project-edit-photo-drop-title {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #e0e0f0;
}

.app-project-edit-photo-drop-hint {
    margin: 0;
    font-size: 11px;
    color: #8a8aac;
}

.app-project-edit-photo-preview {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.app-project-edit-photo-dropzone:not(.has-image) .app-project-edit-photo-preview {
    display: none;
}

.app-project-edit-photo-dropzone:not(.has-image) .app-project-edit-photo-overlay-hint {
    display: none;
}

.app-project-edit-photo-overlay-hint {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 8px 10px;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    color: #f8fafc;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.72));
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.app-project-edit-photo-dropzone.has-image:hover .app-project-edit-photo-overlay-hint,
.app-project-edit-photo-dropzone.has-image:focus-visible .app-project-edit-photo-overlay-hint {
    opacity: 1;
}

/* Móvil: editor amplio + guardar solo ícono */
.app-project-edit-actions {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: stretch;
}

.app-project-edit-footer-btn {
    min-width: 0;
    flex: 1 1 auto;
    padding: 10px 12px;
    min-height: 46px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    text-align: left;
}

.app-project-edit-save {
    width: 46px;
    min-width: 46px;
    padding: 0;
    justify-content: center;
    background: linear-gradient(145deg, #34d399 0%, #10b981 50%, #047857 100%);
    color: #f0fdf4;
    border: 1px solid rgba(167, 243, 208, 0.55);
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.28);
}

.app-project-edit-save .app-project-edit-btn-stack {
    display: none;
}

.app-project-edit-save .app-project-edit-btn-inner {
    justify-content: center;
    width: auto;
    gap: 0;
}

/* Tablet y PC: dos botones del mismo ancho, ícono + título + descripción */
@media (min-width: 769px) {
    .app-project-edit-actions {
        grid-template-columns: 1fr 1fr;
    }

    .app-project-edit-footer-btn {
        min-height: 52px;
    }

    .app-project-edit-save {
        width: auto;
        min-width: 0;
        padding: 10px 12px;
        justify-content: flex-start;
    }

    .app-project-edit-save .app-project-edit-btn-stack {
        display: flex;
    }

    .app-project-edit-save .app-project-edit-btn-inner {
        justify-content: flex-start;
        width: 100%;
        gap: 10px;
    }
}

.app-project-edit-btn-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    min-width: 0;
}

.app-project-edit-btn-icon {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.35rem;
    height: 2.35rem;
    font-size: 1.22rem;
    line-height: 1;
    border-radius: 10px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.28),
        0 2px 10px rgba(0, 0, 0, 0.18);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.app-project-edit-go-editor .app-project-edit-btn-icon {
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.12));
    border: 1px solid rgba(191, 219, 254, 0.65);
}

.app-project-edit-go-editor:hover .app-project-edit-btn-icon {
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.18));
    border-color: rgba(219, 234, 254, 0.9);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.35),
        0 3px 12px rgba(0, 0, 0, 0.22);
}

.app-project-edit-save .app-project-edit-btn-icon {
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.38), rgba(255, 255, 255, 0.1));
    border: 1px solid rgba(167, 243, 208, 0.7);
}

.app-project-edit-save:hover .app-project-edit-btn-icon {
    background: linear-gradient(165deg, rgba(255, 255, 255, 0.48), rgba(255, 255, 255, 0.16));
    border-color: rgba(209, 250, 229, 0.95);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.32),
        0 3px 12px rgba(0, 0, 0, 0.2);
}

.app-project-edit-btn-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    min-width: 0;
}

.app-project-edit-btn-label {
    font-weight: 700;
    font-size: 13px;
    line-height: 1.2;
}

.app-project-edit-btn-desc {
    font-weight: 500;
    font-size: 11px;
    line-height: 1.35;
    color: rgba(255, 255, 255, 0.88);
}

.app-project-edit-go-editor {
    background: linear-gradient(145deg, #3b82f6 0%, #2563eb 55%, #1d4ed8 100%);
    color: #fff;
    border: 1px solid rgba(147, 197, 253, 0.55);
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.28);
}

.app-project-edit-go-editor:hover {
    opacity: 1;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.38);
}

.app-project-edit-save .app-project-edit-btn-desc {
    color: rgba(240, 253, 244, 0.92);
}

.app-project-edit-save:hover {
    opacity: 1;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(5, 150, 105, 0.36);
}

/* ── Loading Spinner ── */
.loading-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 50px 0;
    gap: 14px;
    color: var(--text-secondary);
}

.spinner {
    width: 28px;
    height: 28px;
    border: 3px solid rgba(255,255,255,0.1);
    border-radius: 50%;
    border-top-color: var(--accent);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Tablet y escritorio: tarjetas con título y descripción completos (sin recorte) ── */
@media (min-width: 769px) {
    .project-title {
        white-space: normal;
        overflow: visible;
        text-overflow: clip;
        line-height: 1.3;
    }

    .project-desc {
        display: block;
        -webkit-line-clamp: unset;
        line-clamp: unset;
        overflow: visible;
    }

    .project-card {
        height: auto;
        min-height: 0;
    }

    /* Un solo proyecto: misma card en columna que el resto, con descripción visible */
    .project-list.single-item .project-card {
        flex-direction: column;
        min-height: 0;
    }

    .project-list.single-item .project-img-container {
        width: 100%;
        height: 150px;
    }

    .project-list.single-item .project-desc {
        display: block;
        margin-bottom: 12px;
    }

    .project-list.single-item .project-info {
        justify-content: flex-start;
    }
}

/* ── Desktop: overlay message centrado en area libre derecha ── */
@media (min-width: 769px) {
    .map-overlay-info {
        left: calc(var(--sidebar-inset) + min(440px, 36vw) + (100vw - var(--sidebar-inset) - min(440px, 36vw)) / 2);
        width: min(44vw, 520px);
    }
}

/* Sidebar un poco más ancha en PC para acompañar texto completo en cards */
@media (min-width: 1025px) {
    .sidebar {
        width: min(480px, 38vw);
        min-width: 360px;
    }

    .map-overlay-info {
        left: calc(var(--sidebar-inset) + min(480px, 38vw) + (100vw - var(--sidebar-inset) - min(480px, 38vw)) / 2);
    }
}

/* ── Tablet ── */
@media (min-width: 769px) and (max-width: 1024px) {
    .sidebar {
        --sidebar-inset: 14px;
        left: var(--sidebar-inset);
        top: var(--sidebar-inset);
        bottom: var(--sidebar-inset);
        width: min(400px, 46vw);
        min-width: 300px;
        justify-content: flex-start;
        align-items: stretch;
        align-content: flex-start;
        overflow: hidden;
    }

    .sidebar-header {
        flex: 0 0 auto;
        flex-shrink: 0;
        padding: 16px 14px 14px;
        overflow: visible;
    }

    .logo {
        font-size: clamp(1.05rem, 2.4vw + 0.5rem, 1.28rem);
        line-height: 1.28;
        flex-wrap: wrap;
        row-gap: 4px;
    }

    .subtitle {
        margin-top: 8px;
        font-size: clamp(0.76rem, 1.2vw + 0.65rem, 0.88rem);
        line-height: 1.45;
        overflow-wrap: anywhere;
        word-break: break-word;
        hyphens: auto;
        max-width: 100%;
    }

    .projects-container {
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
        flex: 1 1 0%;
        min-height: 0;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
        padding: 12px;
    }

    .project-list {
        flex: 0 0 auto;
        width: 100%;
        justify-content: flex-start;
        align-items: stretch;
    }

    .loading-state {
        flex: 0 0 auto;
        align-self: stretch;
        justify-content: flex-start;
        padding: 20px 0 24px;
        min-height: 0;
    }

    .project-img-container {
        height: 120px;
    }
}

/* ── Mobile ── */
@media (max-width: 768px) {
    .sidebar {
        --sidebar-inset: var(--mobile-sidebar-inset);
        left: var(--sidebar-inset);
        right: var(--sidebar-inset);
        top: auto;
        bottom: var(--sidebar-inset);
        width: auto;
        min-width: 0;
        height: auto;
        overflow: hidden;
        border-radius: 16px;
        transition: opacity 0.35s ease, transform 0.45s ease,
                    background-color 0.35s ease, border-color 0.35s ease;
        transform-origin: center bottom;
        z-index: 35;
    }

    .sidebar.is-hiding {
        height: 0;
        opacity: 0;
        transform: translateY(20px);
        border-color: transparent;
        overflow: hidden;
    }

    .sidebar-header {
        flex: 0 0 auto;
        padding: var(--mobile-header-pad-y) var(--mobile-header-pad-x);
        border-bottom: 1px solid var(--border-color);
    }

    .logo {
        font-size: var(--mobile-logo-size);
        gap: var(--mobile-logo-gap);
    }

    .subtitle {
        margin-top: var(--mobile-subtitle-gap);
        font-size: var(--mobile-subtitle-size);
        line-height: 1.25;
    }

    .projects-container {
        flex: 1 1 0%;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
        padding: var(--mobile-container-pad-top) var(--mobile-container-pad-x) var(--mobile-container-pad-bottom);
        border-radius: 0 0 16px 16px;
    }

    .fab-add-project {
        width: var(--mobile-fab-size);
        height: var(--mobile-fab-size);
        right: var(--mobile-fab-right);
        font-size: calc(var(--mobile-fab-size) * 0.5);
    }

    .project-list {
        gap: var(--mobile-list-gap);
    }

    .project-card {
        flex-direction: row;
        height: var(--mobile-card-height);
        border-radius: 12px;
    }

    .project-img-container {
        width: 100px;
        height: 100%;
        flex-shrink: 0;
    }

    .project-info {
        padding: 8px 10px;
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 4px;
    }

    .project-title {
        font-size: 0.93rem;
        margin-bottom: 0;
    }

    .project-desc {
        display: none;
    }

    .project-list.single-item .project-card {
        flex-direction: row;
        height: auto;
        min-height: var(--mobile-card-height);
    }

    .project-list.single-item .project-img-container {
        width: 110px;
        height: 100%;
    }

    .project-list.single-item .project-info {
        justify-content: center;
    }

    .project-list.single-item .project-desc {
        display: none;
    }

    .project-list.single-item .project-stats {
        flex-wrap: nowrap;
    }

    .project-stats {
        gap: 6px;
        flex-wrap: wrap;
    }

    .stat-badge {
        font-size: 0.68rem;
        padding: 3px 7px;
    }

    .map-project-location {
        top: max(18px, env(safe-area-inset-top, 18px));
        right: 14px;
        max-width: min(72vw, 280px);
        padding: 8px 11px;
        border-radius: 10px;
    }

    .map-project-location-text {
        font-size: 0.8rem;
    }

    .map-overlay-info {
        left: 50%;
        transform: translateX(-50%);
        width: min(94vw, 420px);
        padding: 10px 14px;
        border-radius: 12px;
    }

    .map-overlay-info.is-dismissing {
        transform: translateX(-50%) translateY(-36px);
    }

    .map-overlay-info h2 {
        font-size: 1rem;
        margin-bottom: 4px;
    }

    .map-overlay-info p {
        font-size: 0.78rem;
        line-height: 1.3;
    }

    .landing-project-popup .mapboxgl-popup-content {
        border-radius: 12px;
    }

    .landing-project-popup-card {
        padding: 8px;
    }

    .landing-project-popup-actions {
        display: flex;
        gap: 7px;
    }

    .landing-popup-btn {
        width: 44px;
        min-width: 44px;
        min-height: 42px;
        font-size: 0.86rem;
    }
}
