/* css/gpx.css — Cititor de fișiere GPX */

#gpx-section .container { max-width: 980px; }

.gpx-intro {
    max-width: 46rem;
    margin: 0 auto 1.6rem;
    font-size: 0.98rem;
    line-height: 1.7;
    text-align: center;
}

/* ─── Locul unde se lasă fișierul ────────────────────────────────────────── */
.gpx-drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.45rem;
    max-width: 34rem;
    margin: 0 auto 1.1rem;
    padding: 1.9rem 1.2rem;
    text-align: center;
    background: var(--section-alt-bg);
    border: 2px dashed var(--card-border);
    border-radius: 0.8rem;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}
.gpx-drop:hover, .gpx-drop:focus-visible, .gpx-drop.is-over {
    background: rgba(22, 163, 74, 0.1);
    border-color: #16a34a;
    outline: none;
}
.gpx-drop i { font-size: 1.9rem; color: #16a34a; }
.gpx-drop strong { font-size: 1.02rem; }
.gpx-drop span { font-size: 0.84rem; color: var(--secondary-text-color); }

.gpx-status {
    max-width: 42rem;
    margin: 0 auto 1.1rem;
    padding: 0.65rem 0.9rem;
    font-size: 0.88rem;
    line-height: 1.55;
    text-align: center;
    background: rgba(22, 163, 74, 0.1);
    border: 1px solid rgba(22, 163, 74, 0.35);
    border-radius: 0.6rem;
}
.gpx-status.is-bad {
    background: rgba(220, 38, 38, 0.08);
    border-color: rgba(220, 38, 38, 0.4);
}

/* ─── Cifrele traseului ──────────────────────────────────────────────────── */
.gpx-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr));
    gap: 0.6rem;
    margin-bottom: 1.1rem;
}
.gpx-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    padding: 0.8rem 0.6rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 0.6rem;
}
.gpx-stat span { font-size: 1.2rem; font-weight: 700; color: #15803d; }
body.dark-theme .gpx-stat span { color: #4ade80; }
.gpx-stat label {
    margin: 0;
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--secondary-text-color);
}

/* ─── Harta ──────────────────────────────────────────────────────────────── */
.gpx-map {
    position: relative;            /* reper pentru perdeaua de „se lucrează" */
    height: min(58vh, 29rem);
    margin-bottom: 0.5rem;
    border: 1px solid var(--card-border);
    border-radius: 0.7rem;
    overflow: hidden;
    z-index: 0;                    /* sub bara de navigare, care e lipită sus */
}
.gpx-map-hint {
    margin: 0 0 1.4rem;
    font-size: 0.8rem;
    line-height: 1.7;
    color: var(--secondary-text-color);
    text-align: center;
}
.gpx-popup-desc { margin: 0.3rem 0 0; font-size: 0.82rem; }

/* Perdeaua de „se lucrează", peste hartă — ține firul între Pădure și traseul desenat. */
.gpx-map-busy {
    position: absolute;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(2px);
}
.gpx-map-busy[hidden] { display: none; }
.gpx-map-busy-box {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    max-width: 80%;
    padding: 0.8rem 1.1rem;
    font-size: 0.92rem;
    font-weight: 700;
    color: #0f172a;
    background: #fff;
    border-radius: 0.6rem;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}
.gpx-map-busy-box i { color: #15803d; font-size: 1.1rem; }

/* Butoanele din colțul hărții: alegerea capetelor, ștergerea și ecranul întreg. Sunt ÎN
   hartă, deci merg cu ea pe tot ecranul, unde pagina nu se mai vede deloc. */
.gpx-mapbtn a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    font-size: 0.9rem;
    color: #333;
    background: #fff;
    text-decoration: none;
}
.gpx-mapbtn a:hover { background: #f4f4f4; }
/* Aprins cât timp aștepți să apeși pe hartă — aceeași culoare ca în panoul de dedesubt. */
.gpx-mapbtn a.is-on { color: #fff; background: #b45309; }
.gpx-ctl-start a.is-on { background: #15803d; }
.gpx-ctl-stop a.is-on { background: #dc2626; }

/* Pe tot ecranul: harta ia tot, fără colțuri rotunjite și fără chenar. */
.gpx-map.is-fullscreen {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 0;
}

/* ─── Butoane ────────────────────────────────────────────────────────────── */
.gpx-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.45rem 0.9rem;
    font-size: 0.88rem;
    font-weight: 700;
    color: #fff;
    background: #15803d;
    border: 1px solid #15803d;
    border-radius: 0.5rem;
    cursor: pointer;
}
.gpx-btn:hover { background: #166534; }
.gpx-btn:disabled { opacity: 0.55; cursor: default; }
.gpx-btn-ghost { color: inherit; background: transparent; border-color: var(--card-border); }
.gpx-btn-ghost:hover { background: rgba(22, 163, 74, 0.12); border-color: #16a34a; }

/* ─── Pădurea pusă deoparte ──────────────────────────────────────────────── */
.gpx-handoff {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.7rem;
    max-width: 42rem;
    margin: 0 auto 1.1rem;
    padding: 0.8rem 1rem;
    background: rgba(22, 163, 74, 0.1);
    border: 1px solid rgba(22, 163, 74, 0.4);
    border-radius: 0.6rem;
}
.gpx-handoff > i { font-size: 1.3rem; color: #16a34a; }
.gpx-handoff div:first-of-type { flex: 1 1 12rem; }
.gpx-handoff strong { display: block; font-size: 0.95rem; }
.gpx-handoff span { font-size: 0.85rem; color: var(--secondary-text-color); }
.gpx-handoff-row { display: flex; gap: 0.4rem; }

/* ─── Unde sunt eu ───────────────────────────────────────────────────────── */
.gpx-me-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin: 0 0 0.6rem;
}
.gpx-me-info { font-size: 0.82rem; color: var(--secondary-text-color); }
.gpx-btn.is-on { color: #fff; background: #2563eb; border-color: #2563eb; }
/* Cercul care se învârte cât se caută sateliții. */
.pad-spin { animation: gpx-spin 1s linear infinite; }
@keyframes gpx-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
    .pad-spin { animation: gpx-fade 1.4s ease-in-out infinite; }
    @keyframes gpx-fade { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
}

/* ─── Croirea traseului ──────────────────────────────────────────────────── */
.gpx-route {
    margin-bottom: 1.4rem;
    padding: 1.1rem 1.2rem;
    background: var(--section-alt-bg);
    border: 1px solid var(--card-border);
    border-radius: 0.7rem;
}
.gpx-route h2 { font-size: 1.12rem; font-weight: 700; margin-bottom: 0.5rem; }
.gpx-route-hint { margin: 0 0 0.8rem; font-size: 0.88rem; line-height: 1.6; }
.gpx-route-row { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.gpx-route-info {
    margin: 0.7rem 0 0;
    font-size: 0.88rem;
    line-height: 1.6;
    font-weight: 700;
    color: #15803d;
}
body.dark-theme .gpx-route-info { color: #4ade80; }
.gpx-route-info.is-bad { color: #dc2626; font-weight: 400; }
body.dark-theme .gpx-route-info.is-bad { color: #f87171; }
/* Butonul rămâne aprins cât aștepți să apeși pe hartă. */
.gpx-btn.is-on { color: #fff; background: #b45309; border-color: #b45309; }

/* ─── De unde până unde ──────────────────────────────────────────────────── */
.gpx-cut {
    margin-bottom: 1.4rem;
    padding: 1.1rem 1.2rem;
    background: var(--section-alt-bg);
    border: 1px solid var(--card-border);
    border-radius: 0.7rem;
}
.gpx-cut h2 { font-size: 1.12rem; font-weight: 700; margin-bottom: 0.7rem; }
.gpx-cut-pick { display: flex; flex-direction: column; gap: 0.25rem; margin-bottom: 0.8rem; }
.gpx-cut-pick label { font-size: 0.8rem; font-weight: 700; color: var(--secondary-text-color); }
.gpx-cut-pick select { font-size: 1rem; }     /* ≥1rem: sub atât, iOS mărește pagina la focus */

.gpx-cut-slider { display: flex; align-items: center; gap: 0.7rem; margin-bottom: 0.55rem; }
.gpx-cut-slider label {
    flex: 0 0 5.4rem;
    margin: 0;
    font-size: 0.84rem;
    font-weight: 700;
}
/* Cursoare groase: se prind cu degetul, nu doar cu mouse-ul. */
.gpx-cut-slider input[type="range"] {
    flex: 1 1 auto;
    height: 1.6rem;
    accent-color: #15803d;
    cursor: pointer;
}
.gpx-cut-info {
    margin: 0.5rem 0 0.8rem;
    font-size: 0.86rem;
    line-height: 1.6;
    color: var(--secondary-text-color);
}
.gpx-cut-row { display: flex; flex-wrap: wrap; gap: 0.45rem; }

/* ─── Traseul în 3D ──────────────────────────────────────────────────────── */
.gpx-3d {
    margin-bottom: 1.4rem;
    padding: 1.1rem 1.2rem;
    background: var(--section-alt-bg);
    border: 1px solid var(--card-border);
    border-radius: 0.7rem;
}
.gpx-3d h2 { font-size: 1.12rem; font-weight: 700; margin-bottom: 0.5rem; }
.gpx-3d-hint { margin: 0 0 0.8rem; font-size: 0.88rem; line-height: 1.6; }
.gpx-3d-box { margin-top: 0.9rem; }
.gpx-3d-box canvas {
    display: block;
    width: 100%;
    height: min(55vh, 26rem);
    background: transparent;      /* ia culoarea paginii, și pe temă închisă, și pe deschisă */
    border: 1px solid var(--card-border);
    border-radius: 0.6rem;
    touch-action: none;           /* altfel degetul derulează pagina în loc să rotească */
}
.gpx-3d-status {
    margin: 0.5rem 0 0;
    font-size: 0.82rem;
    line-height: 1.55;
    color: var(--secondary-text-color);
}
.gpx-3d-controls {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    margin-top: 0.7rem;
    font-size: 0.84rem;
}
.gpx-3d-controls label { margin: 0; font-weight: 700; }
.gpx-3d-controls input[type="range"] { flex: 1 1 auto; height: 1.6rem; accent-color: #15803d; }
.gpx-3d-controls span { font-weight: 700; color: #15803d; }
body.dark-theme .gpx-3d-controls span { color: #4ade80; }

/* ─── Zborul peste traseu ────────────────────────────────────────────────── */
.gpx-fly { margin-top: 0.9rem; }
.gpx-fly-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.84rem;
}
.gpx-fly-row label { margin: 0; font-weight: 700; }
.gpx-fly-row input[type="range"] { flex: 0 1 8rem; height: 1.6rem; accent-color: #2563eb; }
.gpx-fly-row span { font-weight: 700; color: #2563eb; }
body.dark-theme .gpx-fly-row span { color: #93c5fd; }
/* Bara de „unde ești": lată cât tot, ca să poți sări unde vrei cu degetul. */
#gpx-fly-seek { width: 100%; height: 1.7rem; accent-color: #2563eb; cursor: pointer; }
.gpx-fly-info {
    margin: 0.4rem 0 0;
    font-size: 0.82rem;
    line-height: 1.6;
    color: var(--secondary-text-color);
}

/* ─── Profilul de altitudine ─────────────────────────────────────────────── */
.gpx-profile {
    margin-bottom: 1.4rem;
    padding: 1.1rem 1.2rem;
    background: var(--section-alt-bg);
    border: 1px solid var(--card-border);
    border-radius: 0.7rem;
}
.gpx-profile h2 { font-size: 1.12rem; font-weight: 700; margin-bottom: 0.7rem; }
.gpx-chart svg {
    display: block;
    width: 100%;
    height: 13rem;
}
.gpx-chart-hint {
    margin: 0.5rem 0 0;
    font-size: 0.82rem;
    line-height: 1.6;
    color: var(--secondary-text-color);
}

/* ─── Ce e în fișier ─────────────────────────────────────────────────────── */
.gpx-content { margin-bottom: 1.4rem; }
.gpx-content h2 { font-size: 1.12rem; font-weight: 700; margin-bottom: 0.7rem; }
.gpx-items { display: flex; flex-direction: column; gap: 0.7rem; }
.gpx-item {
    padding: 0.9rem 1.1rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-left: 4px solid #16a34a;
    border-radius: 0.7rem;
}
.gpx-item-head { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; }
.gpx-item-head h3 { margin: 0; font-size: 1.02rem; font-weight: 700; }
.gpx-remove {
    flex: 0 0 auto;
    padding: 0.2rem 0.5rem;
    font-size: 0.9rem;
    color: var(--secondary-text-color);
    background: transparent;
    border: 1px solid var(--card-border);
    border-radius: 0.4rem;
    cursor: pointer;
}
.gpx-remove:hover { color: #dc2626; border-color: #dc2626; }
.gpx-item-meta { margin: 0.25rem 0 0.5rem; font-size: 0.82rem; color: var(--secondary-text-color); }

/* „Du-mă la fișierul ăsta" — butonul stă lângă nume, unde se uită omul întâi. */
.gpx-go {
    flex: 0 0 auto;
    margin-left: auto;
    padding: 0.3rem 0.7rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
    background: #15803d;
    border: 1px solid #15803d;
    border-radius: 0.45rem;
    cursor: pointer;
    white-space: nowrap;
}
.gpx-go:hover { background: #166534; }

/* Fiecare urmă și fiecare punct sunt apăsabile: te duc exact acolo. Arată a rând de
   listă, nu a buton, fiindcă un perete de butoane verzi n-ar mai spune nimic. */
.gpx-line-row {
    display: block;
    width: 100%;
    margin: 0 0 0.2rem;
    padding: 0.28rem 0.45rem;
    font-size: 0.88rem;
    line-height: 1.55;
    color: inherit;
    text-align: left;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 0.4rem;
    cursor: pointer;
}
.gpx-line-row:hover, .gpx-line-row:focus-visible {
    background: rgba(22, 163, 74, 0.1);
    border-color: rgba(22, 163, 74, 0.45);
    outline: none;
}
.gpx-line-row i { color: #16a34a; }
.gpx-line-row.is-wpt i { color: #b45309; }
.gpx-line-more { margin: 0.1rem 0 0 0.45rem; font-size: 0.8rem; color: var(--secondary-text-color); }

/* Lista care se desface. Un fișier de pădure vine cu douăsprezece drumuri, iar înșirate
   toate împingeau harta și cifrele jos de tot. Închisă, lista ocupă un rând. */
.gpx-item-list { margin-top: 0.35rem; }
.gpx-item-list > summary {
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.5rem;
    border-radius: 0.4rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--secondary-text-color);
    background: rgba(127, 127, 127, 0.08);
    user-select: none;
}
.gpx-item-list > summary::-webkit-details-marker { display: none; }
/* Săgeata o desenăm noi, ca să arate la fel în toate browserele și să se întoarcă
   la deschidere — omul vede dintr-o privire dacă lista e strânsă sau desfăcută. */
.gpx-item-list > summary::before {
    content: "";
    flex: 0 0 auto;
    width: 0.42rem;
    height: 0.42rem;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(-45deg);
    transition: transform 0.15s ease;
}
.gpx-item-list[open] > summary::before { transform: rotate(45deg); }
.gpx-item-list > summary:hover { background: rgba(22, 163, 74, 0.14); color: var(--text-color); }
.gpx-item-list > summary:focus-visible { outline: 2px solid #16a34a; outline-offset: 2px; }
/* Deschisă, dar nu la nesfârșit: peste vreo opt rânduri derulează în ea, nu în pagină.
   Derularea stă pe cuprins, nu pe toată lista — altfel ar fugi de sub ochi și capul ei. */
.gpx-item-list-body { margin-top: 0.3rem; max-height: 20rem; overflow-y: auto; }

/* ─── Sfaturi ────────────────────────────────────────────────────────────── */
.gpx-tips {
    margin-top: 1.6rem;
    padding: 1.1rem 1.2rem;
    border: 1px solid var(--card-border);
    border-radius: 0.7rem;
}
.gpx-tips h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 0.6rem; }
.gpx-tips ul { padding-left: 1.2rem; margin-bottom: 0.9rem; }
.gpx-tips li { font-size: 0.9rem; line-height: 1.65; margin-bottom: 0.4rem; }
.gpx-note {
    margin: 0;
    padding: 0.75rem 0.95rem;
    font-size: 0.88rem;
    line-height: 1.6;
    background: rgba(22, 163, 74, 0.1);
    border: 1px solid rgba(22, 163, 74, 0.35);
    border-radius: 0.55rem;
}

@media (max-width: 575.98px) {
    .gpx-stats { grid-template-columns: repeat(2, 1fr); }
    .gpx-drop { padding: 1.4rem 1rem; }
    .gpx-chart svg { height: 10rem; }
}
