/* landing.css - Premium Modern Design
   Alineado con alta.css design system */

@import url('design-system.css');

:root {
    --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;
    --overlay-cta-bg: linear-gradient(135deg, #34d399, #10b981);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    height: 100%;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    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: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    z-index: 30;
    box-shadow: var(--shadow-drop);
    transform-origin: top left;
    will-change: auto;
    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);
}

.sidebar-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.35rem;
    font-weight: 700;
    color: #fff;
    text-decoration: none;
    letter-spacing: -0.5px;
}

/* ── Botón circular "+" agregar proyecto (aparece al seleccionar un proyecto) ── */
.add-project-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border-radius: 999px;
    background: linear-gradient(150deg, #3b82f6 0%, #1d4ed8 100%);
    border: 1px solid rgba(147, 197, 253, 0.85);
    color: #fff;
    text-decoration: none;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4), inset 0 1px 0 rgba(255,255,255,0.22);
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.22s ease;
    opacity: 0;
    pointer-events: none;
}

.add-project-btn.is-visible {
    animation: addProjectBtnIn 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
    opacity: 1;
    pointer-events: auto;
}

.add-project-btn[hidden] {
    display: none !important;
}

.add-project-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.55), inset 0 1px 0 rgba(255,255,255,0.28);
}

.add-project-btn:active {
    transform: scale(0.95);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

.add-project-btn-icon {
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    margin-top: -1px;
}

@keyframes addProjectBtnIn {
    from {
        opacity: 0;
        transform: scale(0.72);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@media (prefers-reduced-motion: reduce) {
    .add-project-btn.is-visible {
        animation: none;
        opacity: 1;
        transform: none;
    }
}

.subtitle {
    margin-top: 6px;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.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: var(--radius-sm);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--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);
    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;
    transition: color 0.15s ease;
}

.landify-user-logout:hover {
    color: var(--accent-dark);
}

.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) transparent;
    border-radius: 0 0 var(--radius) var(--radius);
}

.projects-container::-webkit-scrollbar {
    width: 6px;
}
.projects-container::-webkit-scrollbar-thumb {
    background-color: var(--border);
    border-radius: 3px;
}
.projects-container::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.btn-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 44px;
    background: var(--accent-gradient);
    color: var(--text-inverse);
    text-decoration: none;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    transition: opacity 0.2s, transform 0.15s;
    border: none;
    font-size: 0.92rem;
    line-height: 1.25;
    text-align: center;
    white-space: normal;
    overflow-wrap: anywhere;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover {
    opacity: 0.88;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35);
}


/* ── Project List ── */
.project-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.project-card {
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    will-change: transform;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1),
                background 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
    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: var(--shadow-card);
}

.project-card.active {
    border-color: var(--accent);
    background: rgba(59, 130, 246, 0.12);
}

/* 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: 130px;
}

.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: wrap;
    gap: 6px;
    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-card.is-loading .project-img-container::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        rgba(15, 23, 42, 0) 0%,
        rgba(59, 130, 246, 0.18) 40%,
        rgba(99, 179, 237, 0.28) 50%,
        rgba(59, 130, 246, 0.18) 60%,
        rgba(15, 23, 42, 0) 100%
    );
    background-size: 200% 100%;
    animation: card-shimmer 1.4s ease-in-out infinite;
    pointer-events: none;
    z-index: 2;
}

@keyframes card-shimmer {
    0%   { background-position: 200% center; }
    100% { background-position: -200% center; }
}

@media (prefers-reduced-motion: reduce) {
    .project-card.is-loading .project-img-container::after {
        animation: none;
        background: rgba(59, 130, 246, 0.18);
    }
}

.project-info {
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.project-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 4px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.project-location {
    font-size: 0.74rem;
    color: var(--text-secondary);
    margin: 0 0 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.project-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 10px;
    display: -webkit-box;
    display: box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.project-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.stat-badge {
    background: rgba(0, 0, 0, 0.25);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 0.70rem;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 4px;
    border: 1px solid var(--border);
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
    flex-shrink: 0;
}

.stat-icon {
    opacity: 0.7;
}

/* ── Ubicación del proyecto (esquina superior derecha, siempre visible) ── */
.map-project-location-host {
    position: fixed;
    top: 24px;
    right: 18px;
    transform: translateZ(0);
    will-change: opacity;
    z-index: 90;
    display: flex;
    justify-content: flex-end;
    width: max-content;
    max-width: min(calc(100vw - 24px), 820px);
    pointer-events: none;
    filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.3));
}

.map-project-location {
    position: relative;
    top: auto;
    right: auto;
    z-index: 0;
    display: inline-flex;
    align-items: center;
    flex-direction: row;
    justify-content: flex-end;
    gap: 6px;
    max-width: min(96vw, 800px);
    max-height: min(40vh, 7rem);
    padding: 0;
    border-radius: 0;
    background: transparent;
    border: none;
    box-shadow: none;
    pointer-events: none;
    opacity: 1;
    overflow: visible;
    box-sizing: border-box;
    --map-loc-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --map-loc-dur: 0.42s;
    transition:
        max-width var(--map-loc-dur) var(--map-loc-ease),
        max-height var(--map-loc-dur) var(--map-loc-ease),
        gap var(--map-loc-dur) var(--map-loc-ease),
        opacity 0.28s ease;
}

/* Franja de vidrio solo en el texto; el ícono queda a la derecha (espejo del FAB). */
.map-project-location-body {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-width: 0;
    min-height: 32px;
    max-width: min(calc(96vw - 32px - 14px), calc(800px - 42px));
    padding: 8px 14px 8px 16px;
    border-radius: 14px 10px 10px 14px;
    box-sizing: border-box;
    overflow: hidden;
    transition:
        max-width var(--map-loc-dur) var(--map-loc-ease),
        opacity 0.26s ease,
        padding var(--map-loc-dur) var(--map-loc-ease),
        min-height var(--map-loc-dur) var(--map-loc-ease),
        border-radius calc(var(--map-loc-dur) * 0.85) var(--map-loc-ease),
        visibility 0s linear 0s;
}

.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;
    }
    to {
        opacity: 1;
    }
}

.map-project-location-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.92rem;
    line-height: 1;
    background: linear-gradient(160deg, rgba(59, 130, 246, 0.28), rgba(37, 99, 235, 0.52));
    border: 1px solid rgba(147, 197, 253, 0.62);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24), 0 5px 14px rgba(15, 23, 42, 0.32);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    user-select: none;
}

.map-project-location-text {
    font-size: 0.79rem;
    font-weight: 500;
    line-height: 1.42;
    color: var(--text-primary);
    text-align: right;
    display: -webkit-box;
    display: box;
    -webkit-box-orient: vertical;
    box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    overflow: hidden;
    margin-block: 0;
    min-width: 0;
    width: 100%;
    max-width: min(56vw, 500px);
    opacity: 1;
}

.map-project-location.is-collapsed {
    max-width: 34px;
    max-height: 34px;
    gap: 0;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
}

.map-project-location.is-collapsed .map-project-location-body {
    max-width: 0;
    min-width: 0;
    min-height: 0;
    padding: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    flex: 0 0 0;
    border-width: 0;
    visibility: hidden;
    border-radius: 0;
    transition:
        max-width var(--map-loc-dur) var(--map-loc-ease),
        opacity 0.2s ease,
        padding var(--map-loc-dur) var(--map-loc-ease),
        min-height var(--map-loc-dur) var(--map-loc-ease),
        visibility 0s linear var(--map-loc-dur);
}

.map-project-location:not(.is-collapsed) .map-project-location-body {
    visibility: visible;
}

.map-project-location.is-editor-travel-pulse {
    max-width: min(96vw, 920px);
    max-height: min(50vh, 16rem);
}

.map-project-location.is-editor-travel-pulse .map-project-location-body {
    max-width: min(calc(96vw - 40px), calc(920px - 42px));
}

.map-project-location.is-editor-travel-pulse .map-project-location-icon {
    background: linear-gradient(160deg, rgba(34, 197, 94, 0.34), rgba(22, 163, 74, 0.58));
    border-color: rgba(134, 239, 172, 0.68);
    animation: map-project-location-travel-pulse 1.15s ease-in-out infinite;
    will-change: transform, opacity;
}

/* 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;
    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 {
        --map-loc-dur: 0.01ms;
    }

    .map-project-location.is-visible {
        animation: none;
        opacity: 1;
    }

    .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, 480px);
    padding: 28px 28px 24px;
    border-radius: 20px;
    text-align: center;
    pointer-events: auto;
    will-change: opacity;
    contain: layout style;
    transition: opacity 0.42s cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.map-overlay-info.is-dismissing {
    opacity: 0;
    pointer-events: none;
}

/* 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-icon {
    font-size: 2.4rem;
    line-height: 1;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.35));
    margin-bottom: 2px;
}

.map-overlay-info h2 {
    font-size: 1.35rem;
    margin: 0;
    color: #fff;
    font-weight: 700;
    letter-spacing: -0.3px;
    line-height: 1.25;
}

.map-overlay-info p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.5;
    margin: 0;
    max-width: 340px;
}

.map-overlay-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    padding: 11px 22px;
    border-radius: 12px;
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    text-decoration: none;
    border: 1px solid #93c5fd;
    box-shadow: 0 4px 18px rgba(59, 130, 246, 0.38), inset 0 1px 0 rgba(255,255,255,0.22);
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
    letter-spacing: 0.1px;
    white-space: nowrap;
}

.map-overlay-cta:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 8px 28px rgba(59, 130, 246, 0.48), inset 0 1px 0 rgba(255,255,255,0.28);
}

.map-overlay-cta:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 2px 10px rgba(59, 130, 246, 0.3);
}

.map-overlay-cta-icon {
    font-size: 0.88rem;
    line-height: 1;
}

/* ── 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);
}

/* ── FAB Editar Proyecto (esquina inferior izquierda, opuesta al FAB agregar) ── */
.edit-project-fab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transform: translateZ(0);
    will-change: opacity, transform;
    position: fixed;
    left: 28px;
    bottom: 28px;
    z-index: 100;
    width: max-content;
    max-width: min(96vw, 600px);
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    text-align: left;
    font-family: inherit;
    font-size: inherit;
    color: var(--text-primary);
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.3));
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.edit-project-fab[hidden] {
    display: none !important;
}

.edit-project-fab.is-visible {
    animation: editProjectFabIn 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.edit-project-fab-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.92rem;
    line-height: 1;
    background: linear-gradient(160deg, #3b82f6, #2563eb);
    border: 1px solid #60a5fa;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24), 0 5px 14px rgba(15, 23, 42, 0.32);
}

/* Franja solo a la derecha del ícono */
.edit-project-fab-body {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    max-width: min(calc(96vw - 32px - 6px), calc(600px - 38px));
    padding: 0 12px 0 8px;
    border-radius: 10px 14px 14px 10px;
    box-sizing: border-box;
    background: rgba(19, 26, 42, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.edit-project-fab-label {
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@keyframes editProjectFabIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .edit-project-fab.is-visible {
        animation: none;
        opacity: 1;
        transform: none;
    }
}

/* Móvil: ajustar posición del botón editar */
@media (max-width: 768px) {
    .edit-project-fab {
        left: var(--mobile-fab-right);
        /* bottom se controla via JavaScript (positionEditFab) para alinearse con el FAB + */
    }
}

/* ── FAB Calculadora de Precios (encima del FAB editar) ── */
.calc-project-fab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transform: translateZ(0);
    will-change: opacity, transform;
    position: fixed;
    left: 28px;
    bottom: 70px;
    z-index: 100;
    width: max-content;
    max-width: min(96vw, 600px);
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    flex-direction: row;
    justify-content: flex-start;
    align-items: center;
    text-align: left;
    font-family: inherit;
    font-size: inherit;
    color: var(--text-primary);
    cursor: pointer;
    text-decoration: none;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.3));
    transition: opacity 0.22s ease, transform 0.22s ease;
}

.calc-project-fab[hidden] {
    display: none !important;
}

.calc-project-fab.is-visible {
    animation: editProjectFabIn 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.calc-project-fab:hover {
    transform: translateY(-2px);
}

.calc-project-fab:active {
    transform: translateY(0) scale(0.98);
}

.calc-project-fab-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.92rem;
    line-height: 1;
    background: linear-gradient(160deg, #f59e0b, #d97706);
    border: 1px solid #fcd34d;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.24), 0 5px 14px rgba(15, 23, 42, 0.32);
}

.calc-project-fab-body {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    max-width: min(calc(96vw - 32px - 6px), calc(600px - 38px));
    padding: 0 12px 0 8px;
    border-radius: 10px 14px 14px 10px;
    box-sizing: border-box;
    background: rgba(19, 26, 42, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.calc-project-fab-label {
    font-size: 0.8rem;
    font-weight: 600;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (prefers-reduced-motion: reduce) {
    .calc-project-fab.is-visible {
        animation: none;
        opacity: 1;
        transform: none;
    }
}

/* Móvil: posición controlada via JS (igual que edit-project-fab) */
@media (max-width: 768px) {
    .calc-project-fab {
        left: var(--mobile-fab-right);
    }
}

/* PC/Tablet: agrandar badge de ubicación */
@media (min-width: 769px) {
    .map-project-location-icon {
        width: 42px;
        height: 42px;
        font-size: 1.15rem;
    }

    .map-project-location-body {
        min-height: 42px;
        padding: 10px 16px 10px 18px;
    }

    .map-project-location-text {
        font-size: 0.88rem;
    }

    .edit-project-fab,
    .calc-project-fab {
        gap: 8px;
    }

    .edit-project-fab-icon,
    .calc-project-fab-icon {
        width: 42px;
        height: 42px;
        font-size: 1.15rem;
    }

    .edit-project-fab-body,
    .calc-project-fab-body {
        min-height: 42px;
        padding: 0 16px 0 10px;
    }

    .edit-project-fab-label,
    .calc-project-fab-label {
        font-size: 0.92rem;
    }

    .edit-project-fab {
        left: calc(var(--sidebar-inset) + min(440px, 36vw) + 28px);
        bottom: calc(var(--sidebar-inset) + 18px);
    }

    .calc-project-fab {
        left: calc(var(--sidebar-inset) + min(440px, 36vw) + 28px);
        bottom: calc(var(--sidebar-inset) + 18px + 54px);
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .edit-project-fab {
        left: calc(14px + min(400px, 46vw) + 28px);
        bottom: calc(14px + 18px);
    }

    .calc-project-fab {
        left: calc(14px + min(400px, 46vw) + 28px);
        bottom: calc(14px + 18px + 54px);
    }
}

@media (min-width: 1025px) {
    .edit-project-fab {
        left: calc(var(--sidebar-inset) + min(480px, 38vw) + 28px);
    }

    .calc-project-fab {
        left: calc(var(--sidebar-inset) + min(480px, 38vw) + 28px);
    }
}

/* ── 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: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--text);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 28px 32px;
    min-width: 320px;
    max-width: 90vw;
    box-shadow: var(--shadow-card);
    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: var(--accent);
    letter-spacing: 0.3px;
}

.app-info-modal-card {
    max-width: min(92vw, 420px);
}

.app-modal-message {
    margin: 2px 0 0;
    color: var(--text);
    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,
.modal-btn-eliminar,
.modal-btn-editar,
.modal-btn-dev {
    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, #34d399, #10b981);
    color: #ffffff;
}

.modal-btn-eliminar {
    flex: 1;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #ffffff;
}

.modal-btn-editar {
    flex: 1;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #ffffff;
}

.modal-btn-dev {
    flex: 1;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #1a1000;
}

.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,
.modal-btn-eliminar:hover,
.modal-btn-editar:hover,
.modal-btn-dev: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: tamaños predeterminados */
@media (min-width: 769px) {
    .app-project-edit-card {
        width: 100%;
        max-width: 952px; /* 70% más ancho que 560px */
        padding: 24px;
    }
}

.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 arriba */
.app-project-edit-modal.modal-overlay {
    align-items: flex-start;
    justify-content: center;
    padding-top: 32px;
    padding-bottom: 16px;
    padding-left: 16px;
    padding-right: 16px;
}

/* Móvil: panel con altura automática, sin estiramiento */
@media (max-width: 768px) {
    .app-project-edit-modal.modal-overlay {
        padding-top: 24px;
        padding-bottom: 16px;
        padding-left: 16px;
        padding-right: 16px;
    }

    .app-project-edit-card {
        width: 100%;
        max-width: 100%;
        max-height: 90vh;
    }
}

/* Tablet y PC — panel centrado verticalmente */
@media (min-width: 769px) {
    .app-project-edit-modal.modal-overlay {
        align-items: center; /* centrado vertical */
        justify-content: flex-end; /* alineado a la derecha para animación de derecha a izquierda */
        padding-top: 24px;
        padding-bottom: 24px;
        padding-left: 24px;
        padding-right: 56px; /* margen derecho para separar del borde */
    }
}

/* Tablet: márgenes estándar */
@media (min-width: 769px) and (max-width: 1024px) {
    .app-project-edit-modal.modal-overlay {
        padding: 20px;
        align-items: center;
        justify-content: center;
    }

    .app-project-edit-card {
        max-width: 680px; /* más ancho en tablet */
        max-height: 80vh;
        padding: 24px;
    }
}

.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,
.app-project-edit-fields select {
    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: 120px;
    overflow-wrap: break-word;
}

.app-project-edit-fields input:focus,
.app-project-edit-fields textarea:focus,
.app-project-edit-fields select: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;
}

/* Acciones del modal de edición */
.app-project-edit-actions {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.app-project-edit-actions .modal-btn-guardar,
.app-project-edit-actions .modal-btn-eliminar,
.app-project-edit-actions .modal-btn-editar,
.app-project-edit-actions .modal-btn-dev {
    flex: 1;
    min-height: 40px;
    padding: 8px 12px;
    border-radius: 6px;
}

.app-project-edit-btn-inner {
    display: flex;
    align-items: center;
    gap: 8px;
}

.app-project-edit-btn-icon {
    font-size: 1.1rem;
}

/* ── 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(40vw, 480px);
    }
}

/* 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;
    }

    .project-list {
        gap: var(--mobile-list-gap);
    }

    .project-card {
        flex-direction: row;
        height: auto;
        border-radius: 10px;
        align-items: stretch;
    }

    .project-img-container {
        display: block;
        width: 72px;
        height: 72px;
        flex-shrink: 0;
        align-self: center;
        border-radius: 8px;
        margin: 6px 0 6px 10px;
        overflow: hidden;
    }

    .project-info {
        padding: 7px 10px;
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 3px;
    }

    .project-title {
        font-size: 0.86rem;
        font-weight: 600;
        margin-bottom: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .project-desc {
        font-size: 0.7rem;
        color: var(--text-secondary);
        margin: 0;
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        line-height: 1.2;
        max-height: 1.2em;
    }

    .project-list.single-item .project-card {
        flex-direction: row;
        height: auto;
    }

    .project-list.single-item .project-img-container {
        display: block;
        width: 72px;
        height: 72px;
        align-self: center;
    }

    .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: 4px;
        flex-wrap: wrap;
    }

    .stat-badge {
        font-size: 0.62rem;
        padding: 3px 6px;
        border-radius: 6px;
    }

    .map-project-location-host {
        top: max(10px, calc(env(safe-area-inset-top, 0px) + 6px));
        right: max(10px, env(safe-area-inset-right, 0px));
    }

    .map-project-location {
        max-width: min(96vw, 620px);
        max-height: min(38vh, 6.5rem);
    }

    .map-project-location-body {
        min-height: 28px;
        max-width: min(calc(96vw - 28px - 12px), calc(620px - 40px));
        padding: 7px 12px 7px 14px;
        border-radius: 10px 8px 8px 10px;
    }

    .map-project-location-icon {
        width: 28px;
        height: 28px;
        font-size: 0.82rem;
    }

    .map-project-location-text {
        font-size: 0.74rem;
        max-width: min(90vw, 412px);
    }

    .map-project-location.is-collapsed {
        max-width: 30px;
        max-height: 30px;
        justify-content: center;
        align-items: center;
        box-sizing: border-box;
    }

    .map-project-location.is-editor-travel-pulse {
        max-height: min(48vh, 14rem);
    }

    .map-project-location.is-editor-travel-pulse .map-project-location-body {
        max-width: min(calc(96vw - 36px), calc(920px - 40px));
    }

    .map-overlay-info {
        left: 50%;
        transform: translateX(-50%);
        width: min(94vw, 380px);
        padding: 20px 20px 18px;
        border-radius: 16px;
        gap: 8px;
    }

    .map-overlay-info.is-dismissing {
        transform: translateX(-50%);
    }

    .map-overlay-icon {
        font-size: 1.9rem;
    }

    .map-overlay-info h2 {
        font-size: 1.05rem;
    }

    .map-overlay-info p {
        font-size: 0.78rem;
        line-height: 1.3;
    }

    .map-overlay-cta {
        padding: 9px 18px;
        font-size: 0.87rem;
        border-radius: 10px;
    }

    .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;
    }
}
