/* ══════════════════════════════════════════════
   Bel-Up — Settings styles
   ══════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;600&display=swap');

*, *::before, *::after { margin:0; padding:0; box-sizing:border-box; }

/* ══ VARIABLES ══ */
:root {
    --bg:        #181e2c;
    --bg-card:   #1f2638;
    --bg-input:  #151b28;
    --bg-hover:  #252d42;
    --border:    rgba(255,255,255,0.07);
    --border-hi: rgba(255,255,255,0.15);
    --solar:     #f59e0b;
    --battery:   #10b981;
    --grid:      #3b82f6;
    --warning:   #f97316;
    --purple:    #a78bfa;
    --text:      #f1f5f9;
    --text-2:    #8896b0;
    --text-3:    #4a5568;
    --shadow:    0 24px 48px rgba(0,0,0,0.5);
}

/* ══ BASE ══ */
html { scroll-behavior: smooth; }

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    font-size: 16px;
    background-image:
        radial-gradient(ellipse 80% 50% at 0% 0%, rgba(59,130,246,0.06) 0%, transparent 60%),
        radial-gradient(ellipse 60% 40% at 100% 100%, rgba(16,185,129,0.05) 0%, transparent 60%);
}

/* ══ NAV ══ */
nav {
    position: sticky; top: 0; z-index: 200;
    height: 64px;
    background: rgba(24,30,44,0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center;
    padding: 0;
}
.nav-inner-settings {
    width: 100%; max-width: 900px;
    margin: 0 auto; padding: 0 3rem;
    display: flex; align-items: center; height: 100%;
}
.nav-brand {
    display: flex; align-items: center;
    text-decoration: none; margin-right: 2rem;
}
.nav-brand img { height: 44px; width: auto; }
.nav-tabs { display: flex; align-items: stretch; height: 100%; }
.nav-tab {
    display: flex; align-items: center; gap: .5rem;
    padding: 0 1.2rem; text-decoration: none;
    color: var(--text-2); font-size: .95rem; font-weight: 500;
    border-bottom: 2px solid transparent; transition: color .2s;
}
.nav-tab:hover { color: var(--text); }
.nav-tab.active { color: var(--grid); border-bottom-color: var(--grid); }

/* ══ TABS SETTINGS ══ */
.settings-tabs-bar {
    position: sticky; top: 64px; z-index: 100;
    background: rgba(24,30,44,0.97);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    scrollbar-width: none;
    display: flex; align-items: stretch;
}
.settings-tabs-bar::-webkit-scrollbar { display: none; }
.settings-tabs-inner {
    width: 100%; max-width: 900px;
    margin: 0 auto; padding: 0 3rem;
    display: flex; align-items: stretch; gap: 0;
}

.stab {
    display: flex; align-items: center; gap: .5rem;
    padding: 0 1.2rem; height: 52px;
    background: none; border: none;
    color: var(--text-2); font-family: 'Outfit', sans-serif;
    font-size: .9rem; font-weight: 500; cursor: pointer;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: color .2s, border-color .2s;
}
.stab:hover { color: var(--text); }
.stab.active { color: var(--text); border-bottom-color: var(--grid); }
.stab-dot {
    width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
    opacity: .6;
}
.stab.active .stab-dot { opacity: 1; }

/* ══ TAB CONTENT ══ */
.tab-content { padding: 2.5rem 3rem 7rem; max-width: 900px; margin: 0 auto; }

.tab-panel { display: none; animation: fadeUp .3s ease-out both; }
.tab-panel.active { display: block; }

/* ══ SECTION ══ */
.section { margin-bottom: 3rem; scroll-margin-top: 84px; }
.section-head { display: flex; align-items: center; gap: .85rem; margin-bottom: 1.1rem; }
.section-icon {
    width: 40px; height: 40px; border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.15rem; flex-shrink: 0;
}
.section-head h2 { font-size: 1.15rem; font-weight: 600; }
.section-head p  { font-size: .85rem; color: var(--text-2); margin-top: .15rem; }

/* ══ CARD ══ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px; overflow: hidden;
}

.row {
    display: flex; align-items: center; justify-content: space-between;
    gap: 2rem; padding: 1.3rem 1.6rem;
    border-bottom: 1px solid var(--border);
    transition: background .15s;
}
.row:last-child { border-bottom: none; }
.row:hover { background: rgba(255,255,255,.018); }

.row-info { flex: 1; min-width: 0; }
.row-label {
    font-size: .98rem; font-weight: 500; color: var(--text);
    display: flex; align-items: center; gap: .55rem;
}
.row-desc {
    font-size: .83rem; color: var(--text-2); font-weight: 300;
    margin-top: .25rem; line-height: 1.45;
}
.row-ctrl { flex-shrink: 0; display: flex; align-items: center; gap: .7rem; }

/* ══ CHIPS ══ */
.chip {
    font-size: .7rem; font-weight: 600; padding: .2rem .6rem;
    border-radius: 999px; letter-spacing: .02em;
}
.chip-warn   { background: rgba(249,115,22,.15);  color: var(--warning); }
.chip-info   { background: rgba(59,130,246,.15);  color: var(--grid); }
.chip-ok     { background: rgba(16,185,129,.15);  color: var(--battery); }
.chip-purple { background: rgba(167,139,250,.15); color: var(--purple); }

/* ══ SLIDER ══ */
.sl-wrap { display: flex; flex-direction: column; align-items: flex-end; gap: .4rem; min-width: 210px; }
.sl-top  { display: flex; align-items: baseline; gap: .3rem; }
.sl-val  {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.25rem; font-weight: 600; min-width: 3.5rem; text-align: right;
}
.sl-unit { font-size: .8rem; color: var(--text-2); font-family: 'JetBrains Mono', monospace; }
input[type="range"] {
    -webkit-appearance: none; width: 200px; height: 5px;
    border-radius: 3px; background: var(--bg-input); outline: none; cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none; width: 19px; height: 19px; border-radius: 50%;
    background: var(--tc, var(--grid));
    border: 2px solid rgba(255,255,255,.12);
    box-shadow: 0 2px 8px rgba(0,0,0,.5);
    transition: transform .15s, box-shadow .15s;
}
input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.25);
    box-shadow: 0 0 0 6px rgba(59,130,246,.15), 0 2px 8px rgba(0,0,0,.5);
}

/* ══ NUMBER INPUT ══ */
.num-wrap {
    display: flex; align-items: center;
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: 10px; overflow: hidden; transition: border-color .2s;
}
.num-wrap:focus-within { border-color: var(--border-hi); }
.num-btn {
    width: 36px; height: 38px; background: none; border: none;
    color: var(--text-2); font-size: 1.2rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: color .15s, background .15s;
}
.num-btn:hover { color: var(--text); background: rgba(255,255,255,.06); }
input[type="number"] {
    width: 80px; height: 38px; background: none; border: none;
    color: var(--text); font-family: 'JetBrains Mono', monospace;
    font-size: 1rem; font-weight: 600; text-align: center; outline: none;
    -moz-appearance: textfield;
}
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; }

/* ══ TOGGLE ══ */
.toggle { position: relative; width: 48px; height: 26px; flex-shrink: 0; }
.toggle input { display: none; }
.ttrack {
    position: absolute; inset: 0;
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: 999px; cursor: pointer;
    transition: background .25s, border-color .25s;
}
.ttrack::after {
    content: ''; position: absolute; top: 3px; left: 3px;
    width: 18px; height: 18px; border-radius: 50%;
    background: var(--text-3);
    transition: transform .25s cubic-bezier(.34,1.56,.64,1), background .25s;
}
.toggle input:checked + .ttrack { background: rgba(16,185,129,.18); border-color: var(--battery); }
.toggle input:checked + .ttrack::after { transform: translateX(22px); background: var(--battery); }

/* ══ SELECT ══ */
.sel {
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: 10px; color: var(--text);
    font-family: 'Outfit', sans-serif; font-size: .95rem;
    padding: .5rem 2.2rem .5rem .95rem; appearance: none; cursor: pointer; outline: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%238896b0'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right .7rem center;
    transition: border-color .2s;
}
.sel:focus { border-color: var(--border-hi); }
.sel option { background: #1f2638; }

/* ══ MODE SELECTOR ══ */
.mode-group { display: flex; gap: .45rem; flex-wrap: wrap; }
.mode-btn {
    padding: .45rem .95rem; border-radius: 9px; font-size: .85rem; font-weight: 500;
    background: var(--bg-input); border: 1px solid var(--border);
    color: var(--text-2); cursor: pointer; transition: all .2s; font-family: 'Outfit', sans-serif;
}
.mode-btn:hover { border-color: var(--border-hi); color: var(--text); }
.mode-btn.sel-green  { background: rgba(16,185,129,.15); border-color: var(--battery); color: var(--battery); font-weight: 600; }
.mode-btn.sel-blue   { background: rgba(59,130,246,.15);  border-color: var(--grid);    color: var(--grid);    font-weight: 600; }

/* ══ IP DISPLAY ══ */
.ip-display {
    display: flex; align-items: center; gap: .6rem;
}
.ip-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: .95rem; font-weight: 600;
    color: var(--text);
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: 10px; padding: .5rem 1rem;
    min-width: 160px; text-align: center;
}
.ip-status {
    width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.ip-status.up   { background: var(--battery); box-shadow: 0 0 6px var(--battery); }
.ip-status.down { background: var(--text-3); }

/* ══ SENSOR ROW ══ */
.sensor-row {
    display: grid; grid-template-columns: 36px 1fr auto;
    align-items: center; gap: 1.2rem;
    padding: 1rem 1.6rem; border-bottom: 1px solid var(--border);
}
.sensor-row:last-child { border-bottom: none; }
.sensor-num {
    width: 32px; height: 32px; border-radius: 8px;
    background: var(--bg-input); border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    font-family: 'JetBrains Mono', monospace; font-size: .85rem;
    color: var(--text-2); font-weight: 600;
}

/* ══ CARD LABEL ══ */
.card-label {
    padding: .8rem 1.6rem;
    font-size: .73rem; font-weight: 600; letter-spacing: .1em;
    text-transform: uppercase; color: var(--text-3);
    background: rgba(255,255,255,.02);
    border-bottom: 1px solid var(--border);
}

/* ══ LED ══ */
.led-preview { display: flex; gap: .55rem; align-items: center; }
.led {
    width: 13px; height: 13px; border-radius: 50%;
    box-shadow: 0 0 7px currentColor;
}
.led.on  { animation: glow 2s ease-in-out infinite; }
.led.off { box-shadow: none; opacity: .3; }

/* ══ TOAST ══ */
.toast {
    position: fixed; top: 76px; right: 1.5rem; z-index: 400;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 13px; padding: .9rem 1.2rem;
    display: flex; align-items: center; gap: .8rem;
    box-shadow: var(--shadow);
    transform: translateX(calc(100% + 2rem));
    transition: transform .4s cubic-bezier(.34,1.56,.64,1);
    max-width: 310px;
}
.toast.show { transform: translateX(0); }
.toast-ico  { font-size: 1.2rem; flex-shrink: 0; }
.toast-body .t1 { font-size: .925rem; font-weight: 600; }
.toast-body .t2 { font-size: .78rem; color: var(--text-2); margin-top: .1rem; }

/* ══ FLASH AUTO-SAVE ══ */
.saved-flash {
    position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 300;
    background: rgba(16,185,129,.15); border: 1px solid var(--battery);
    border-radius: 10px; padding: .5rem 1.1rem;
    display: flex; align-items: center; gap: .5rem;
    font-size: .875rem; font-weight: 600; color: var(--battery);
    opacity: 0; pointer-events: none;
    transition: opacity .25s ease;
}
.saved-flash.show { opacity: 1; }

/* ══ ANIMATIONS ══ */
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.3} }
@keyframes glow  { 0%,100%{opacity:1} 50%{opacity:.45} }
@keyframes fadeUp { from{opacity:0;transform:translateY(18px)} to{opacity:1;transform:translateY(0)} }

.section { animation: fadeUp .4s ease-out both; }
.section:nth-child(1){animation-delay:.04s}
.section:nth-child(2){animation-delay:.09s}
.section:nth-child(3){animation-delay:.14s}
.section:nth-child(4){animation-delay:.19s}
.section:nth-child(5){animation-delay:.24s}
.section:nth-child(6){animation-delay:.29s}

/* ══ RESPONSIVE ══ */
@media(max-width:820px){
    .tab-content { padding: 1.5rem 1.2rem 7rem; }
    .stab { padding: 0 .85rem; font-size: .82rem; }
    .settings-tabs-bar { padding: 0 .5rem; }
}

/* Séparateur dans les cards */
.sep {
    border: none;
    border-top: 1px solid rgba(255,255,255,0.06);
    margin: 0.25rem 0;
}

/* ── Section Référence avant batteries ── */
.preinstall-info-banner {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    background: rgba(245, 158, 11, 0.07);
    border: 1px solid rgba(245, 158, 11, 0.18);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    color: #fbbf24;
    margin-bottom: 0.25rem;
    line-height: 1.5;
}

.preinstall-info-banner svg {
    flex-shrink: 0;
    margin-top: 1px;
    color: #f59e0b;
}

.preinstall-result {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
    padding-top: 1.2rem;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.preinstall-result-item {
    flex: 1;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 12px;
    padding: 1rem 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.preinstall-result-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.preinstall-result-value {
    font-size: 2rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    color: #ffffff;
}

.preinstall-result-formula {
    font-size: 0.7rem;
    color: var(--text-2);
    opacity: 0.5;
    font-style: italic;
}
