/* ============================================================
   SKYLAC — interface "radio COM avionique", vue cockpit nocturne
   Dominante ambre avionique sur noir, monospace technique, grain.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@500;700;900&family=Share+Tech+Mono&display=swap');

:root {
    --panel:    #0a0805;
    --panel-2:  #141009;
    --metal:    #1d1810;
    --edge:     #2e2614;
    --amber:    #ffae42;
    --amber-hi: #ffd089;
    --amber-dim:#7a5418;
    --green:    #5dff9b;   /* ATC live */
    --red:      #ff5e4d;
    --text:     #d8c9a8;
    --muted:    #6f6045;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.2rem;
    font-family: 'Share Tech Mono', monospace;
    color: var(--text);
    background:
        radial-gradient(120% 90% at 50% -10%, #1a140a 0%, var(--panel) 55%, #050402 100%);
    position: relative;
    overflow-x: hidden;
}

/* grain + scanlines overlay */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 50;
    background-image:
        repeating-linear-gradient(0deg, rgba(0,0,0,.22) 0 1px, transparent 1px 3px);
    mix-blend-mode: multiply;
    opacity: .5;
}
body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 51;
    opacity: .05;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---- panneau / boîtier ---- */
.card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
    background:
        linear-gradient(180deg, var(--metal), var(--panel-2));
    border: 1px solid var(--edge);
    border-radius: 10px;
    padding: 1.6rem 1.5rem 1.8rem;
    box-shadow:
        0 0 0 1px rgba(0,0,0,.6),
        0 22px 60px rgba(0,0,0,.7),
        inset 0 1px 0 rgba(255,174,66,.08);
}

/* rivets aux coins */
.card::before, .card::after {
    content: "";
    position: absolute;
    width: 7px; height: 7px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #4a3d1f, #0c0a05);
    box-shadow: 0 0 2px #000;
}
.card::before { top: 9px; left: 9px; box-shadow: 0 0 2px #000, 405px 0 0 #2a230f; }
.card::after  { bottom: 9px; left: 9px; box-shadow: 0 0 2px #000, 405px 0 0 #2a230f; }

/* ---- en-tête plaque gravée ---- */
.brand {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    border-bottom: 1px dashed var(--amber-dim);
    padding-bottom: .7rem;
    margin-bottom: 1.1rem;
}
h1 {
    font-family: 'Orbitron', sans-serif;
    font-weight: 900;
    font-size: 1.5rem;
    letter-spacing: .28em;
    margin: 0;
    color: var(--amber);
    text-shadow: 0 0 10px rgba(255,174,66,.45);
}
.tag {
    font-size: .62rem;
    letter-spacing: .18em;
    color: var(--muted);
    text-transform: uppercase;
}

.sub {
    font-size: .7rem;
    letter-spacing: .15em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0 0 1.2rem;
}

/* ---- afficheur fréquence COM ---- */
.com {
    background: #060904;
    border: 1px solid #20351f;
    border-radius: 6px;
    padding: .9rem 1rem .7rem;
    margin-bottom: 1.1rem;
    box-shadow: inset 0 0 18px rgba(0,0,0,.9);
}
.com-label {
    font-size: .58rem;
    letter-spacing: .3em;
    color: var(--amber-dim);
    text-transform: uppercase;
    display: flex;
    justify-content: space-between;
}
.com-freq {
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: 2.5rem;
    line-height: 1.1;
    text-align: center;
    color: var(--amber-hi);
    text-shadow: 0 0 14px rgba(255,174,66,.6), 0 0 3px rgba(255,174,66,.9);
    letter-spacing: .04em;
}
.com-freq .mhz {
    font-size: .9rem;
    letter-spacing: .2em;
    color: var(--amber-dim);
    vertical-align: super;
    margin-left: .35rem;
}

/* ---- statut ---- */
.status {
    display: flex;
    align-items: center;
    gap: .55rem;
    font-size: .78rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    margin: 1rem 0;
    color: var(--muted);
}
.status::before {
    content: "";
    width: 9px; height: 9px;
    border-radius: 50%;
    background: var(--muted);
    box-shadow: 0 0 6px currentColor;
    flex: none;
}
.status[data-state="playing"] { color: var(--green); }
.status[data-state="playing"]::before { background: var(--green); animation: pulse 1.3s infinite; }
.status[data-state="waiting"] { color: var(--amber); }
.status[data-state="waiting"]::before { background: var(--amber); animation: pulse .7s infinite; }
.status[data-state="error"]   { color: var(--red); }
.status[data-state="error"]::before   { background: var(--red); }
.status[data-state="idle"]    { color: var(--muted); }

@keyframes pulse {
    0%,100% { opacity: 1; }
    50%     { opacity: .25; }
}

/* ---- lecteur live custom ---- */
audio { display: none; }

.deck {
    display: flex;
    align-items: center;
    gap: 1.1rem;
    background: #060904;
    border: 1px solid var(--edge);
    border-radius: 6px;
    padding: 1rem;
    box-shadow: inset 0 0 18px rgba(0,0,0,.9);
}

.ptt {
    flex: none;
    width: 64px; height: 64px;
    border-radius: 50%;
    border: 2px solid var(--amber-dim);
    background:
        radial-gradient(circle at 38% 30%, #3a2a10, #120d06 70%);
    color: var(--amber);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .15s;
    box-shadow: 0 3px 0 #000, inset 0 0 8px rgba(0,0,0,.8);
}
.ptt:hover {
    border-color: var(--amber);
    color: var(--amber-hi);
    box-shadow: 0 3px 0 #000, 0 0 16px rgba(255,174,66,.35), inset 0 0 8px rgba(0,0,0,.8);
}
.ptt:active { transform: translateY(2px); box-shadow: 0 1px 0 #000, inset 0 0 8px rgba(0,0,0,.8); }
.ptt.active {
    border-color: var(--green);
    color: var(--green);
    box-shadow: 0 3px 0 #000, 0 0 18px rgba(93,255,155,.4), inset 0 0 8px rgba(0,0,0,.8);
}
.ptt-icon { transform: translateX(1px); }

.deck-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: .7rem;
}

.live {
    align-self: flex-start;
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: .72rem;
    letter-spacing: .22em;
    padding: .25rem .6rem;
    border: 1px solid var(--edge);
    border-radius: 3px;
    color: var(--muted);
    background: #0a0a0a;
}
.live.on {
    color: #0a0a0a;
    background: var(--red);
    border-color: var(--red);
    box-shadow: 0 0 14px rgba(255,94,77,.6);
    animation: blink 1.4s infinite;
}
@keyframes blink { 0%,100% { opacity: 1; } 55% { opacity: .55; } }

.vol {
    display: flex;
    align-items: center;
    gap: .5rem;
}
.vol-ico { font-size: .85rem; filter: grayscale(1) brightness(1.4); opacity: .6; }

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--amber-dim), var(--edge));
    outline: none;
    margin: 0;
    box-shadow: none;
    padding: 0;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px; height: 16px;
    border-radius: 50%;
    background: var(--amber);
    border: 1px solid #000;
    cursor: pointer;
    box-shadow: 0 0 8px rgba(255,174,66,.5);
}
input[type="range"]::-moz-range-thumb {
    width: 16px; height: 16px;
    border-radius: 50%;
    background: var(--amber);
    border: 1px solid #000;
    cursor: pointer;
    box-shadow: 0 0 8px rgba(255,174,66,.5);
}

/* ---- formulaire login ---- */
form.login label {
    display: block;
    font-size: .6rem;
    letter-spacing: .22em;
    text-transform: uppercase;
    color: var(--amber-dim);
    margin-bottom: .9rem;
}
input {
    width: 100%;
    margin-top: .4rem;
    padding: .7rem .8rem;
    border: 1px solid var(--edge);
    border-radius: 4px;
    background: #060904;
    color: var(--amber-hi);
    font-family: 'Share Tech Mono', monospace;
    font-size: 1rem;
    letter-spacing: .08em;
    box-shadow: inset 0 0 10px rgba(0,0,0,.8);
}
input:focus {
    outline: none;
    border-color: var(--amber);
    box-shadow: inset 0 0 10px rgba(0,0,0,.8), 0 0 8px rgba(255,174,66,.35);
}

button {
    width: 100%;
    padding: .8rem;
    border: 1px solid var(--amber-dim);
    border-radius: 4px;
    background: linear-gradient(180deg, #2a1f0c, #14100a);
    color: var(--amber);
    font-family: 'Orbitron', sans-serif;
    font-weight: 700;
    font-size: .85rem;
    letter-spacing: .2em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all .15s;
}
button:hover {
    color: var(--amber-hi);
    border-color: var(--amber);
    box-shadow: 0 0 14px rgba(255,174,66,.3);
}
button:active { transform: translateY(1px); }

.error {
    color: var(--red);
    font-size: .72rem;
    letter-spacing: .08em;
    margin: 0 0 1rem;
    padding: .5rem .7rem;
    border-left: 2px solid var(--red);
    background: rgba(255,94,77,.08);
}

.hint {
    color: var(--muted);
    font-size: .62rem;
    letter-spacing: .1em;
    text-align: center;
    margin: 1.1rem 0 0;
}

/* ---- déconnexion ---- */
.logout {
    margin-top: 1.4rem;
    border-top: 1px dashed var(--amber-dim);
    padding-top: 1rem;
}
.logout button {
    background: transparent;
    border: 1px solid var(--edge);
    color: var(--muted);
    font-size: .68rem;
}
.logout button:hover {
    color: var(--red);
    border-color: var(--red);
    box-shadow: none;
}
