/* ==========================================
   Live Missions — UI base mobile-first
   ========================================== */

*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    --bg: #05060a;
    --card: #111318;
    --accent: #4ade80;
    --accent-soft: rgba(74, 222, 128, 0.15);
    --accent-strong: #22c55e;
    --text: #f9fafb;
    --muted: #9ca3af;
    --line: #1f2933;
    --danger: #fb7185;
    --radius-lg: 18px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --shadow-soft: 0 18px 35px rgba(0,0,0,0.5);
    --header-h: 58px;
    --bottom-h: 64px;
    --app-max: 480px;
    --transition-fast: 0.18s ease-out;
    --transition-med: 0.25s ease;
}

html, body {
    margin: 0;
    padding: 0;
    background: #000;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
    color: var(--text);
    overflow-x: hidden; /* no scroll lateral */
}

/* Contenedor app centrado para desktop */
.lm-app {
    min-height: 100vh;
    max-width: var(--app-max);
    margin: 0 auto;
    position: relative;
    background: radial-gradient(circle at top, #111827 0, #020617 50%, #000 100%);
    color: var(--text);
    display: flex;
    flex-direction: column;
    transition: transform var(--transition-med);
}

/* Cuando el panel está abierto, ya no movemos la app */
.lm-app--panel-open {
    transform: none;
}

/* ===========================
   HEADER
=========================== */

.lm-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;

    height: var(--header-h);
    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 14px;
    gap: 8px;

    background: rgba(15,23,42,0.92);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(148,163,184,0.14);

    z-index: 9999 !important; /* Queda siempre por encima del panel y del mapa */
}

.lm-icon-btn {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.5);
    background: radial-gradient(circle at 30% 30%, #111827, #020617);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

/* logo header */
.lm-logo {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    font-size: 0.9rem;
}

.lm-logo-mark {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    object-fit: contain;
}

.lm-logo-text-main {
    font-weight: 600;
}

.lm-logo-text-accent {
    color: var(--accent);
    font-weight: 700;
}

/* footer logo */
.lm-footer-logo {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: var(--muted);
}

.lm-logo-mark-footer {
    width: 18px;
    height: 18px;
    border-radius: 6px;
    object-fit: contain;
}

/* Estado header */
.lm-header-badge {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(15, 118, 110, 0.18);
    font-size: 0.7rem;
    color: var(--muted);
    cursor: pointer;
}

.lm-dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: #22c55e;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.4);
}

.lm-header-text {
    white-space: nowrap;
}

/* ===========================
   SWITCH (Start) — Glow permanente
=========================== */

.lm-icon-switch {
    padding: 0;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.6);
    background: radial-gradient(circle at 30% 30%, #111827, #020617);
}

/* El círculo */
.switch {
    position: relative;
    width: 36px;
    height: 36px;
    background-color: rgb(152, 107, 172); /* encendido */
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 0.55em;
    font-weight: 700;
    color: #fff;
    border: 1px solid #fff;

    /* GLOW perma activado */
    box-shadow:
            0px 0px 1px rgb(222, 151, 255) inset,
            0px 0px 2px rgb(222, 151, 255) inset,
            0px 0px 10px rgb(222, 151, 255) inset,
            0px 0px 20px rgb(222, 151, 255),
            0px 0px 40px rgb(222, 151, 255);

    transition: 0.25s ease;
}

/* Icono */
.lm-switch-svg {
    width: 45%;
    height: 45%;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0px 0px 3px rgb(222, 151, 255)); /* glow on */
}

.lm-switch-svg path {
    fill: #fff; /* icono blanco encendido */
}

.lm-switch-label {
    letter-spacing: .05em;
    color: #fff;
}


/* ===========================
   Estado ON (activado)
   Activado por JS con .switch--on
=========================== */

.switch.switch--on .lm-switch-svg {
    filter: drop-shadow(0px 0px 4px rgb(222, 151, 255));
}

.switch.switch--on .lm-switch-svg path {
    fill: #fff;
}

.switch.switch--on {
    box-shadow:
            0 0 1px rgb(222, 151, 255) inset,
            0 0 6px rgb(222, 151, 255) inset,
            0 0 20px rgb(222, 151, 255),
            0 0 40px rgb(222, 151, 255);
    border: 1px solid #fff;
    background-color: rgb(152, 107, 172);
    color: #fff;
}


/* ===========================
   SIDE PANEL + BACKDROP
=========================== */

.lm-sidepanel {
    position: fixed;
    inset: 0 auto 0 0;
    width: 76%;
    max-width: 280px;
    background: #020617;
    border-right: 1px solid rgba(148, 163, 184, 0.2);
    transform: translateX(-100%);
    transition: transform var(--transition-med);
    z-index: 12000;
    display: flex;
    flex-direction: column;
    padding: 12px 12px 14px;
}

.lm-sidepanel-header {
    display: flex;
    align-items: center;
    padding: 4px 4px 10px;
    border-bottom: 1px solid rgba(31, 41, 55, 0.7);
    margin-bottom: 6px;
}

.lm-sidepanel-title {
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.lm-sidepanel-close {
    margin-left: auto;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.5);
    background: transparent;
    color: #e5e7eb;
    cursor: pointer;
}

.lm-sidepanel-links {
    display: flex;
    flex-direction: column;
    padding-top: 8px;
    gap: 4px;
    font-size: 0.9rem;
}

.lm-sidepanel-links .sp-link {
    text-decoration: none;
    color: #cbd5f5;
    padding: 9px 10px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.lm-sidepanel-links .sp-link:hover {
    background: rgba(15, 23, 42, 0.9);
}

.lm-sidepanel-footer {
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid rgba(31, 41, 55, 0.8);
    font-size: 0.75rem;
    color: var(--muted);
}

/* Estado abierto */
.lm-sidepanel--open {
    transform: translateX(0);
}

.lm-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-med);
    z-index: 11000;
}

.lm-backdrop--visible {
    opacity: 1;
    pointer-events: auto;
}

/* ===========================
   MAIN
=========================== */

.lm-main {
    padding-top: var(--header-h);
}

/* HERO */

.lm-hero {
    margin-top: 10px;
    padding: 16px 14px 14px;
    border-radius: var(--radius-lg);
    background:
            radial-gradient(circle at top left, rgba(74, 222, 128, 0.18), transparent 55%),
            radial-gradient(circle at bottom right, rgba(59, 130, 246, 0.16), transparent 55%),
            linear-gradient(145deg, #020617, #020617 30%, #020617 100%);
    box-shadow: var(--shadow-soft);
    border: 1px solid rgba(148, 163, 184, 0.15);
}

.lm-hero h1 {
    font-size: 1.25rem;
    margin: 0 0 6px;
}

.lm-hero p {
    margin: 0 0 10px;
    font-size: 0.85rem;
    color: var(--muted);
}

.lm-hero-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.lm-hero-status {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 0.78rem;
    color: var(--muted);
}

/* Botones genéricos */

.lm-btn {
    border-radius: 999px;
    padding: 8px 14px;
    border: none;
    font-size: 0.85rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}

.lm-btn-primary {
    background: linear-gradient(90deg, var(--accent-strong), var(--accent));
    color: #052e16;
    font-weight: 600;
}

.lm-btn-ghost {
    background: rgba(15, 23, 42, 0.7);
    color: #e5e7eb;
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.lm-btn-small {
    padding: 5px 10px;
    font-size: 0.78rem;
}

.lm-btn-full {
    width: 100%;
}

/* ===========================
   SECCIONES
=========================== */

.lm-section {
    margin-top: 16px;
}

.lm-section-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

.lm-section-header h2 {
    font-size: 1rem;
    margin: 0;
}

.lm-section-subtitle {
    font-size: 0.75rem;
    color: var(--muted);
}

.lm-chip {
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.5);
    background: rgba(15,23,42,0.8);
    color: var(--muted);
    font-size: 0.75rem;
    padding: 5px 10px;
    cursor: pointer;
}

/* chips filtros */
.lm-filter-chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.lm-chip--pill {
    background: rgba(15, 23, 42, 0.9);
}

.lm-chip--active {
    border-color: var(--accent-strong);
    background: rgba(22, 163, 74, 0.18);
    color: var(--accent);
}

/* Misiones */

.lm-mission-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lm-mission-card {
    display: flex;
    gap: 10px;
    padding: 10px 10px;
    border-radius: var(--radius-md);
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(31, 41, 55, 0.9);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast);
}

.lm-mission-card:hover {
    border-color: rgba(74, 222, 128, 0.6);
    box-shadow: 0 10px 24px rgba(0,0,0,0.6);
    transform: translateY(-1px);
}

.lm-mission-card--active {
    border-color: var(--accent-strong);
    box-shadow: 0 12px 28px rgba(22, 163, 74, 0.35);
}

.lm-mission-main {
    flex: 1;
}

.lm-mission-main h3 {
    font-size: 0.9rem;
    margin: 0 0 4px;
}

.lm-mission-desc {
    margin: 0 0 6px;
    font-size: 0.8rem;
    color: var(--muted);
}

.lm-mission-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.lm-tag {
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent-strong);
}

.lm-tag-soft {
    background: rgba(15, 23, 42, 1);
    color: var(--muted);
    border: 1px solid rgba(55, 65, 81, 0.9);
}

.lm-mission-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
}

/* pill de estado */

.lm-mission-status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.7rem;
    margin-bottom: 4px;
}

.lm-status-available {
    background: rgba(37, 99, 235, 0.15);
    color: #60a5fa;
}

.lm-status-accepted {
    background: rgba(234, 179, 8, 0.18);
    color: #facc15;
}

.lm-status-in-progress {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
}

.lm-status-completed {
    background: rgba(22, 163, 74, 0.18);
    color: #4ade80;
}

/* Ganancias */

.lm-earnings-card {
    padding: 12px 12px;
    border-radius: var(--radius-md);
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(31, 41, 55, 0.9);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.lm-earnings-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
}

.lm-earnings-row strong {
    color: var(--accent);
}

/* Progreso */

.lm-earnings-progress {
    margin-top: 4px;
    font-size: 0.78rem;
}

.lm-earnings-progress-top {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
    color: var(--muted);
}

.lm-earnings-progress-bar {
    position: relative;
    height: 6px;
    border-radius: 999px;
    background: #020617;
    overflow: hidden;
}

.lm-earnings-progress-fill {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, #22c55e, #4ade80);
}

/* Perfil */

.lm-profile-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: var(--radius-md);
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(31, 41, 55, 0.9);
}

.lm-profile-avatar {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    background: radial-gradient(circle at top, #1f2937, #020617);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
}

.lm-profile-info span {
    font-size: 0.78rem;
    color: var(--muted);
}

.lm-profile-actions {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Ayuda */

.lm-help-text {
    font-size: 0.8rem;
    color: var(--muted);
    line-height: 1.5;
}

/* Espacio para que el contenido no quede debajo del nav inferior */
.lm-bottom-space {
    height: calc(var(--bottom-h) + 10px);
}

/* ===========================
   MAPA
=========================== */

.lm-map-section {
    margin-top: 18px;
}

.lm-map-wrapper {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid rgba(30, 64, 175, 0.6);
    box-shadow: 0 18px 35px rgba(15, 23, 42, 0.9);
}

/* overlay de carga */
.lm-map-loading {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top, #020617, #000 70%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--muted);
    z-index: 2;
    opacity: 1;
    transition: opacity var(--transition-med);
}

.lm-map-loading--hidden {
    opacity: 0;
    pointer-events: none;
}

.lm-map-loading-spinner {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    border: 3px solid rgba(148,163,184,0.3);
    border-top-color: var(--accent-strong);
    animation: lm-spin 0.9s linear infinite;
}

@keyframes lm-spin {
    to { transform: rotate(360deg); }
}

.lm-map {
    width: 100%;
    height: 260px;
}

.lm-map .leaflet-container,
.leaflet-container {
    background: #020617;
}

/* Overlay info */

.lm-map-overlay {
    position: absolute;
    inset: auto 10px 10px 10px;
    border-radius: var(--radius-md);
    background: rgba(15, 23, 42, 0.88);
    border: 1px solid rgba(148, 163, 184, 0.5);
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 3;
}

.lm-map-overlay-top {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
}

.lm-map-overlay-title {
    font-weight: 600;
}

.lm-map-overlay-count {
    color: var(--accent);
    font-weight: 500;
}

.lm-map-overlay-bottom {
    font-size: 0.75rem;
    color: var(--muted);
}

.lm-map-location-label {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* FABs del mapa */

.lm-map-fab {
    position: absolute;
    right: 10px;
    top: 10px;
    z-index: 4;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.6);
    background: rgba(15, 23, 42, 0.9);
    color: #e5e7eb;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
}

.lm-map-fab-secondary {
    top: 48px;
}

/* ===========================
   NAV INFERIOR TIPO APP
=========================== */

.lm-bottom-nav {
    position: fixed;
    left: 50%;
    bottom: 10px;
    transform: translateX(-50%);
    width: 100%;
    max-width: var(--app-max);
    padding: 4px 10px;
    z-index: 13000;
}

.lm-bottom-nav::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.96);
    border: 1px solid rgba(148, 163, 184, 0.4);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(18px);
}

.lm-bottom-nav {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
}

.lm-nav-item {
    position: relative;
    z-index: 1;
    background: transparent;
    border: none;
    border-radius: 999px;
    padding: 6px 4px;
    color: var(--muted);
    font-size: 0.7rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    cursor: pointer;
}

.lm-nav-item--active {
    background: rgba(22, 163, 74, 0.18);
    color: var(--accent);
}

.lm-nav-icon {
    font-size: 1rem;
}

.lm-nav-label {
    font-size: 0.7rem;
}

/* ===========================
   MODO MAPA (PANTALLA CASI COMPLETA)
=========================== */

.lm-app--map-mode .lm-main {
    padding: 0;
}

.lm-app--map-mode .lm-main > *:not(.lm-map-section) {
    display: none;
}

.lm-app--map-mode .lm-map-section {
    margin-top: 0;
}

.lm-app--map-mode .lm-map {
    height: calc(100vh - var(--header-h) - var(--bottom-h) - 18px);
}

/* ===========================
   MODAL MISIÓN
=========================== */

.lm-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.7);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-med);
    z-index: 14000;
}

.lm-modal-backdrop--visible {
    opacity: 1;
    pointer-events: auto;
}

.lm-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px) scale(0.98);
    transition: opacity var(--transition-med), transform var(--transition-med);
    z-index: 14001;
}

.lm-modal--visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.lm-modal-card {
    width: 100%;
    max-width: 420px;
    margin: 0 14px;
    border-radius: var(--radius-lg);
    background: radial-gradient(circle at top left, rgba(74,222,128,0.16), transparent 50%), #020617;
    border: 1px solid rgba(148, 163, 184, 0.6);
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.9);
    padding: 14px 14px 14px;
    position: relative;
}

.lm-modal-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.5);
    background: rgba(15, 23, 42, 0.9);
    color: #e5e7eb;
    cursor: pointer;
}

.lm-modal-status {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.7rem;
    margin-bottom: 6px;
    background: rgba(37, 99, 235, 0.18);
    color: #93c5fd;
}

.lm-modal-title {
    margin: 0 0 4px;
    font-size: 1rem;
}

.lm-modal-desc {
    margin: 0 0 10px;
    font-size: 0.85rem;
    color: var(--muted);
}

.lm-modal-meta {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 0.78rem;
}

.lm-modal-meta span {
    display: block;
    color: var(--muted);
}

.lm-modal-meta strong {
    display: block;
    margin-top: 2px;
}

.lm-modal-area {
    font-size: 0.78rem;
    color: var(--muted);
    margin-bottom: 10px;
}

.lm-modal-footer {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.lm-modal-primary--completed {
    background: rgba(22, 163, 74, 0.2);
    color: #bbf7d0;
    cursor: default;
}

/* ===========================
   DESKTOP AJUSTES
=========================== */

@media (min-width: 768px) {
    .lm-main {
        padding: 14px 16px 16px;
    }

    .lm-hero {
        margin-top: 14px;
    }

    .lm-map {
        height: 320px;
    }

    .lm-app--map-mode .lm-map {
        height: calc(100vh - var(--header-h) - var(--bottom-h) - 24px);
    }
}
