/* =============================================================
   MeteoFace — ortak arayüz | assets/mf-ui.css
   Tüm sayfaların paylaştığı tasarım dili: renkler, cam yüzeyler,
   modül menüsü (masaüstünde sağ ray, mobilde alt sekme çubuğu),
   ayarlar paneli, bildirimler, yükleyici ve Mapbox kontrolleri.
   Sayfaya özel stiller kendi CSS dosyalarında kalır; bu dosya
   yalnızca "mf-" önekli sınıflar ve ortak değişkenler tanımlar.
============================================================= */

:root {
    --base:     #060f18;
    --base-2:   #0a1825;
    --glass:    rgba(7, 18, 29, 0.74);
    --glass-hi: rgba(12, 28, 43, 0.94);
    --surface:  rgba(255, 255, 255, 0.04);
    --surface-2:rgba(255, 255, 255, 0.07);
    --line:     rgba(150, 195, 225, 0.14);
    --line-hi:  rgba(150, 195, 225, 0.32);
    --ink:      #eaf3fa;
    --ink-2:    #c4d4e1;
    --muted:    #8ea6b9;
    --amber:    #ffb54a;
    --amber-bg: rgba(255, 181, 74, 0.13);
    --cyan:     #57d3ea;
    --cyan-bg:  rgba(87, 211, 234, 0.12);
    --bolt:     #ffe45c;

    /* durum renkleri — uçuş kategorisi ve uyarılar ortak */
    --ok:     #3ecf6e;
    --info:   #4aa3ff;
    --warn:   #ffb54a;
    --danger: #ff5a4f;
    --crit:   #d65bff;

    --r-sm: 8px;
    --r-md: 14px;
    --r-lg: 20px;
    --gap:  12px;

    --safe-t: env(safe-area-inset-top, 0px);
    --safe-b: env(safe-area-inset-bottom, 0px);
    --safe-l: env(safe-area-inset-left, 0px);
    --safe-r: env(safe-area-inset-right, 0px);

    /* sayfaların yerleşimde hesaba kattığı kabuk ölçüleri */
    --nav-b: 0px;                 /* mobil alt menü yüksekliği (masaüstünde 0) */
    --side-w: 48px;               /* sağ sütun genişliği (masaüstü) */
    --font: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --mono: ui-monospace, 'SFMono-Regular', Menlo, Consolas, 'Liberation Mono', monospace;
    --ease: cubic-bezier(.2, .8, .2, 1);
    --shadow: 0 12px 34px rgba(0, 6, 14, 0.45);
}

.mf-glass {
    background: var(--glass);
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

/* =============================================
   SAĞ SÜTUN — modül menüsü + sayfa araçları
============================================= */
.mf-side {
    position: fixed;
    top: calc(var(--gap) + var(--safe-t));
    right: calc(var(--gap) + var(--safe-r));
    z-index: 1200;
    display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
    pointer-events: none;
}
.mf-side > * { pointer-events: auto; }

.mf-nav {
    display: flex; flex-direction: column; gap: 3px;
    padding: 5px; border-radius: 16px;
}
.mf-group {
    position: relative;
    display: flex; flex-direction: column; gap: 3px;
    padding: 5px; border-radius: 16px;
}
.mf-nav-btn, .mf-tool {
    position: relative;
    width: 36px; height: 36px;
    display: grid; place-items: center;
    border: 0; border-radius: 11px;
    background: transparent;
    color: var(--muted); font: inherit; font-size: 14px;
    text-decoration: none; cursor: pointer;
    transition: background .2s, color .2s;
}
.mf-nav-btn:hover, .mf-tool:hover { background: rgba(255,255,255,.08); color: var(--ink); }
.mf-nav-btn.active { background: var(--amber-bg); color: var(--amber); }
.mf-tool[aria-pressed="true"], .mf-tool[aria-expanded="true"] { background: var(--cyan-bg); color: var(--cyan); }
.mf-nav-btn:focus-visible, .mf-tool:focus-visible { outline: 2px solid var(--cyan); outline-offset: 1px; }
.mf-nav-sep { height: 1px; margin: 3px 6px; background: var(--line); }

/* masaüstü: etiket ipucu olarak solda */
.mf-nav-btn span, .mf-tool .mf-tip {
    position: absolute; right: calc(100% + 10px); top: 50%;
    padding: 5px 9px; border-radius: 8px;
    background: var(--glass-hi); border: 1px solid var(--line);
    color: var(--ink); font-size: 12px; font-weight: 600; white-space: nowrap;
    opacity: 0; transform: translate(4px, -50%); pointer-events: none;
    transition: opacity .15s, transform .15s var(--ease);
}
@media (hover: hover) {
    .mf-nav-btn:hover span, .mf-tool:hover .mf-tip { opacity: 1; transform: translate(0, -50%); }
}

/* =============================================
   MOBİL — alt sekme çubuğu
============================================= */
@media (max-width: 760px) {
    :root { --gap: 8px; --nav-b: calc(58px + var(--safe-b)); --side-w: 44px; }

    .mf-nav {
        position: fixed; left: 0; right: 0; bottom: 0;
        z-index: 1250;
        flex-direction: row; justify-content: space-around; gap: 0;
        height: var(--nav-b);
        padding: 4px calc(6px + var(--safe-r)) calc(4px + var(--safe-b)) calc(6px + var(--safe-l));
        border-radius: 18px 18px 0 0;
        border-width: 1px 0 0;
        background: rgba(6, 15, 24, 0.9);
    }
    .mf-nav-btn {
        flex: 1; width: auto; height: 50px; max-width: 92px;
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
        border-radius: 12px; font-size: 17px;
    }
    .mf-nav-btn span {
        position: static; opacity: 1; transform: none;
        padding: 0; border: 0; background: none;
        font-size: 10.5px; font-weight: 600; letter-spacing: .01em; color: inherit;
    }
    .mf-nav-btn.active { background: transparent; }
    .mf-nav .mf-nav-sep, .mf-nav .mf-nav-about { display: none; }
    .mf-nav-btn.active i { filter: drop-shadow(0 0 8px rgba(255,181,74,.55)); }

    .mf-group { padding: 4px; border-radius: 14px; }
    .mf-tool { width: 34px; height: 34px; font-size: 13px; }
    .mf-tool .mf-tip { display: none; }
}

/* =============================================
   AYARLAR — masaüstünde sağdan çekmece,
   mobilde alttan açılan sayfa
============================================= */
.mf-backdrop {
    position: fixed; inset: 0; z-index: 3000;
    background: rgba(2, 8, 14, 0.5);
    backdrop-filter: blur(2px);
    opacity: 0; transition: opacity .25s;
}
.mf-backdrop.show { opacity: 1; }

.mf-settings {
    position: fixed; z-index: 3010;
    top: calc(var(--gap) + var(--safe-t));
    right: calc(var(--gap) + var(--safe-r));
    bottom: calc(var(--gap) + var(--safe-b));
    width: min(392px, calc(100vw - 2 * var(--gap)));
    display: flex; flex-direction: column;
    border-radius: var(--r-lg);
    background: var(--glass-hi);
    backdrop-filter: blur(22px) saturate(160%);
    -webkit-backdrop-filter: blur(22px) saturate(160%);
    border: 1px solid var(--line);
    box-shadow: 0 24px 60px rgba(0, 4, 10, 0.6);
    color: var(--ink); font-family: var(--font); font-size: 14px;
    transform: translateX(calc(100% + 24px));
    transition: transform .34s var(--ease);
    overflow: hidden;
}
.mf-settings.show { transform: none; }
.mf-settings * { box-sizing: border-box; }

.mf-set-head {
    display: flex; align-items: center; gap: 12px;
    padding: 16px 16px 12px 18px;
}
.mf-set-icon {
    width: 38px; height: 38px; flex: none; border-radius: 12px;
    display: grid; place-items: center;
    background: linear-gradient(135deg, rgba(255,181,74,.25), rgba(87,211,234,.18));
    color: var(--amber); font-size: 16px;
}
.mf-set-title { flex: 1; min-width: 0; }
.mf-set-title b { display: block; font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.mf-set-title small { display: block; margin-top: 1px; font-size: 12px; color: var(--muted); }
.mf-x {
    width: 34px; height: 34px; flex: none;
    display: grid; place-items: center;
    border: 0; border-radius: 10px; background: var(--surface);
    color: var(--muted); font-size: 15px; cursor: pointer;
    transition: background .2s, color .2s;
}
.mf-x:hover { background: var(--surface-2); color: var(--ink); }
.mf-handle { display: none; }

/* canlı önizleme şeridi */
@keyframes mf-pulse-bg { from { background: rgba(255,181,74,.35); } to { background: rgba(0,0,0,.22); } }

.mf-set-body { flex: 1; overflow-y: auto; padding: 4px 16px 16px; overscroll-behavior: contain; scrollbar-width: thin; }
.mf-sec { margin-top: 16px; }
.mf-sec-title {
    margin: 0 2px 8px;
    font-size: 11px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--muted);
}
.mf-card { border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); }
.mf-row {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 11px 12px;
}
.mf-row + .mf-row { border-top: 1px solid var(--line); }
.mf-row-label { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mf-row-label > i { width: 18px; text-align: center; color: var(--muted); font-size: 13px; flex: none; }
.mf-row-label b { display: block; font-size: 13.5px; font-weight: 600; }
.mf-row-label small { display: block; font-size: 11.5px; color: var(--muted); line-height: 1.35; }

.mf-seg {
    display: inline-flex; flex: none; padding: 3px; gap: 2px;
    border-radius: 10px; background: rgba(0,0,0,.25);
}
.mf-seg button {
    min-width: 40px; height: 28px; padding: 0 9px;
    border: 0; border-radius: 8px; background: transparent;
    color: var(--muted); font: inherit; font-size: 12px; font-weight: 600;
    font-variant-numeric: tabular-nums; cursor: pointer; white-space: nowrap;
    transition: background .2s, color .2s;
}
.mf-seg button:hover { color: var(--ink); }
.mf-seg button[aria-checked="true"] { background: var(--amber); color: #1a1204; }

.mf-switch {
    appearance: none; -webkit-appearance: none; flex: none;
    width: 40px; height: 22px; border-radius: 999px; margin: 0;
    background: rgba(255,255,255,.16); position: relative; cursor: pointer;
    transition: background .2s;
}
.mf-switch::after {
    content: ''; position: absolute; top: 3px; left: 3px;
    width: 16px; height: 16px; border-radius: 50%; background: #fff;
    transition: transform .22s var(--ease);
}
.mf-switch:checked { background: var(--amber); }
.mf-switch:checked::after { transform: translateX(18px); }
.mf-switch:focus-visible, .mf-seg button:focus-visible, .mf-tile:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

.mf-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mf-tile {
    display: flex; flex-direction: column; gap: 7px;
    padding: 0 0 8px; border: 1px solid var(--line); border-radius: 12px;
    background: var(--surface); color: var(--muted);
    font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; overflow: hidden;
    transition: border-color .2s, color .2s, transform .15s;
}
.mf-tile:active { transform: scale(.97); }
.mf-tile[aria-checked="true"] { border-color: var(--amber); color: var(--ink); box-shadow: 0 0 0 1px var(--amber) inset; }
.mf-swatch { display: block; height: 52px; }
.mf-sw-dark  { background: radial-gradient(circle at 70% 30%, #39424d 0 3%, transparent 4%), linear-gradient(135deg, #1b1f24, #2a3038 50%, #15181c); }
.mf-sw-light { background: radial-gradient(circle at 30% 60%, #fff 0 3%, transparent 4%), linear-gradient(135deg, #e9edf0, #cfd8de 55%, #b9c7d1); }
.mf-sw-sat   { background: radial-gradient(circle at 30% 40%, #c9d6b0 0 8%, transparent 9%), linear-gradient(135deg, #2b5876 0%, #4e7d5b 45%, #b9a77b 70%, #1f4f74 100%); }

.mf-set-foot {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 12px 16px calc(12px + var(--safe-b));
    border-top: 1px solid var(--line);
    font-size: 11.5px; color: var(--muted);
}
.mf-set-foot a { color: var(--ink-2); text-decoration: none; }
.mf-set-foot a:hover { color: var(--amber); }
.mf-link-btn {
    border: 0; background: none; padding: 6px 8px; margin: -6px -8px;
    color: var(--muted); font: inherit; font-size: 12px; cursor: pointer; border-radius: 8px;
}
.mf-link-btn:hover { color: var(--ink); background: var(--surface); }

@media (max-width: 760px) {
    .mf-settings {
        top: auto; left: 0; right: 0; bottom: 0;
        width: 100%; max-height: 88vh; max-height: 88dvh;
        border-radius: 22px 22px 0 0; border-width: 1px 0 0;
        transform: translateY(105%);
    }
    .mf-handle { display: block; width: 40px; height: 4px; margin: 8px auto 0; border-radius: 4px; background: rgba(255,255,255,.22); }
    .mf-set-head { padding-top: 10px; }
    .mf-row { padding: 12px 12px; }
}

/* =============================================
   BİLDİRİMLER
============================================= */
.mf-toasts {
    position: fixed; left: 50%; z-index: 3500;
    bottom: calc(var(--nav-b) + var(--gap) + var(--mf-toast-b, 150px));
    transform: translateX(-50%);
    display: flex; flex-direction: column; align-items: center; gap: 8px;
    width: max-content; max-width: calc(100vw - 24px);
    pointer-events: none;
}
.mf-toast {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px 10px 14px; border-radius: 14px;
    background: var(--glass-hi); border: 1px solid var(--line);
    box-shadow: var(--shadow);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    color: var(--ink); font-family: var(--font); font-size: 13px; line-height: 1.4;
    opacity: 0; transform: translateY(8px);
    transition: opacity .25s, transform .25s var(--ease);
    pointer-events: auto;
}
.mf-toast.show { opacity: 1; transform: none; }
.mf-toast > i { font-size: 15px; color: var(--cyan); }
.mf-toast.warn > i { color: var(--amber); }
.mf-toast.error > i { color: var(--danger); }
.mf-toast.success > i { color: var(--ok); }
.mf-toast button {
    border: 0; background: none; color: var(--muted); cursor: pointer;
    width: 24px; height: 24px; border-radius: 6px; font-size: 13px;
}
.mf-toast button:hover { color: var(--ink); background: var(--surface); }

/* =============================================
   YÜKLEYİCİ (yörüngede uydu)
============================================= */
.mf-loader {
    position: fixed; inset: 0; z-index: 4000;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
    background: radial-gradient(circle at 50% 45%, #0f2638 0%, var(--base) 62%);
    color: var(--muted); font-family: var(--font); font-size: 13px; letter-spacing: .02em;
    transition: opacity .6s ease, visibility .6s;
}
.mf-loader.hidden { opacity: 0; visibility: hidden; }
.mf-copy { position: absolute; right: 20px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); font-size: 12px; letter-spacing: .03em; color: var(--muted); opacity: .85; }
.mf-orbit { position: relative; width: 120px; height: 120px; }
.mf-orbit img { position: absolute; inset: 20px; width: 80px; height: 80px; border-radius: 50%; box-shadow: 0 0 50px rgba(87,211,234,.25); }
.mf-orbit::before, .mf-orbit::after {
    content: ''; position: absolute; inset: 0; border-radius: 50%;
    border: 1px solid var(--line-hi); border-top-color: var(--amber);
    animation: mf-orbit 5s linear infinite;
}
.mf-orbit::after { inset: 9px; border-top-color: var(--cyan); animation-duration: 3.4s; animation-direction: reverse; opacity: .7; }
@keyframes mf-orbit { to { transform: rotate(360deg); } }
/* sayfa geçişi: bağlantıya tıklanınca yükleyici yumuşakça örter */
.mf-loader.mf-leave { opacity: 0; visibility: visible; animation: mf-leave .22s ease forwards; }
@keyframes mf-leave { to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .mf-orbit::before, .mf-orbit::after { animation-duration: 20s; } .mf-loader.mf-leave { animation: none; opacity: 1; } }

/* ince üst yükleme çizgisi (veri yenilenirken) */
.mf-busy {
    position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 3600;
    background: linear-gradient(90deg, transparent, var(--cyan), var(--amber), transparent);
    background-size: 50% 100%; background-repeat: no-repeat;
    opacity: 0; transition: opacity .3s; pointer-events: none;
    animation: mf-busy 1.1s linear infinite;
}
.mf-busy.on { opacity: 1; }
@keyframes mf-busy { from { background-position: -50% 0; } to { background-position: 150% 0; } }

/* =============================================
   ORTAK KÜÇÜK BİLEŞENLER
============================================= */
.mf-pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 3px 9px; border-radius: 999px;
    font-size: 11.5px; font-weight: 600; letter-spacing: .01em;
    background: var(--surface-2); color: var(--ink-2);
}
.mf-live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); animation: mf-pulse 1.8s infinite; }
@keyframes mf-pulse { 0% { box-shadow: 0 0 0 0 rgba(87,211,234,.6); } 70%,100% { box-shadow: 0 0 0 7px rgba(87,211,234,0); } }

.mf-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 38px; padding: 0 16px; border: 0; border-radius: 12px;
    background: var(--amber); color: #1a1204;
    font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
    transition: transform .15s, box-shadow .2s;
}
.mf-btn:hover { box-shadow: 0 0 0 5px rgba(255,181,74,.16); }
.mf-btn:active { transform: scale(.96); }
.mf-btn.ghost { background: var(--surface-2); color: var(--ink); }

/* =============================================
   MAPBOX KONTROLLERİ — cam görünüm
============================================= */
.mapboxgl-ctrl-group {
    background: var(--glass) !important;
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--line); border-radius: 12px !important;
    box-shadow: none !important; overflow: hidden;
}
.mapboxgl-ctrl-group button { width: 34px; height: 34px; }
.mapboxgl-ctrl-group button + button { border-top: 1px solid var(--line) !important; }
.mapboxgl-ctrl-group button .mapboxgl-ctrl-icon { filter: invert(1) brightness(.85); }
.mapboxgl-ctrl-attrib.mapboxgl-compact { background: rgba(8,21,33,.7); color: var(--muted); }
.mapboxgl-ctrl-attrib a { color: var(--muted); }
.mapboxgl-ctrl-bottom-left, .mapboxgl-ctrl-bottom-right { bottom: calc(var(--nav-b) + var(--mf-map-b, 0px)); }

/* =============================================
   HAREKETİ AZALT (ayar veya sistem tercihi)
============================================= */
body.mf-reduce-motion *, body.mf-reduce-motion *::before, body.mf-reduce-motion *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
}
@media (prefers-reduced-motion: reduce) {
    .mf-settings, .mf-toast, .mf-backdrop { transition: none; }
}

/* ── Bakım arası / yeni sürüm / çerez onayı ── */
.mf-btn { font: inherit; font-weight: 600; font-size: 13px; border: 0; border-radius: 99px; padding: 8px 16px; cursor: pointer; background: var(--accent, #ffb23e); color: #07131f; }
.mf-btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line, rgba(255,255,255,.2)); }
.mf-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.mf-maint { position: fixed; inset: 0; z-index: 10000; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 50% 40%, #0f2b44, #06101a 70%); color: #dff3ff; }
.mf-maint-box { max-width: 420px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.mf-maint-box h2 { margin: 6px 0 0; font-size: 24px; }
.mf-maint-box p { margin: 0; line-height: 1.55; color: #b6cfe0; font-size: 14.5px; }
.mf-maint-box small { margin-top: 18px; color: #7f9db3; font-size: 12px; }
.mf-update, .mf-consent { position: fixed; z-index: 9000; left: 50%; transform: translate(-50%, 20px); opacity: 0; transition: opacity .25s, transform .25s;
  background: var(--panel, rgba(10,24,38,.96)); color: var(--ink); border: 1px solid var(--line, rgba(255,255,255,.14)); border-radius: 16px; box-shadow: 0 10px 30px rgba(0,0,0,.35); backdrop-filter: blur(10px); font-size: 13.5px; }
.mf-update.show, .mf-consent.show { opacity: 1; transform: translate(-50%, 0); }
.mf-update { top: calc(14px + env(safe-area-inset-top, 0px)); transform: translate(-50%, -20px); display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; white-space: nowrap; }
.mf-update-x { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 6px; }
.mf-consent { left: 16px; top: calc(74px + env(safe-area-inset-top, 0px)); transform: translateY(-12px); width: 360px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.mf-consent.show { transform: none; }
.mf-consent p { margin: 0; flex: 1; line-height: 1.45; }
.mf-consent a { color: var(--accent, #ffb23e); }
.mf-consent div { display: flex; gap: 8px; flex: none; justify-content: flex-end; }
@media (max-width: 760px) {
  .mf-consent { top: auto; left: 50%; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); width: calc(100vw - 24px); transform: translate(-50%, 20px); align-items: stretch; }
  .mf-consent.show { transform: translate(-50%, 0); }
  .mf-consent div { justify-content: flex-end; }
  .mf-update { white-space: normal; width: calc(100vw - 24px); }
}
