/* =========================================
   RESET & VARIABILI
   ========================================= */
:root {
    --card-bg: rgba(10, 10, 15, 0.30); 
    --text-main: #e0e0e0;
    --text-muted: #a0a0a0;
    --border: rgba(255, 255, 255, 0.15);
    --input-bg: rgba(0, 0, 0, 0.4);
    --danger: #ff4444;
    --accent: #29b6f6;
}

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

body { 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #000;
    color: var(--text-main); 
    line-height: 1.6; 
    padding: 20px;
    min-height: 100vh;
    overflow-x: hidden;
}

/* =========================================
   SFONDO
   ========================================= */
.space-bg { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -10; background: radial-gradient(circle at bottom center, #1b2735 0%, #000000 100%); pointer-events: none; }
#star-canvas { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -5; pointer-events: none; }
.nebula-layer { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: -8; filter: blur(80px); opacity: 0.6; pointer-events: none; }
.nebula-blob { position: absolute; border-radius: 50%; animation: nebulaFloat 20s infinite alternate ease-in-out; }
.blob-1 { top: 20%; left: 20%; width: 40vw; height: 40vw; background: rgba(100, 50, 255, 0.2); }
.blob-2 { bottom: 10%; right: 10%; width: 50vw; height: 50vw; background: rgba(41, 182, 246, 0.15); animation-delay: -5s; }
@keyframes nebulaFloat { 0% { transform: translate(0, 0) scale(1); } 100% { transform: translate(-20px, 20px) scale(1.1); } }

/* =========================================
   CONTAINER CARD
   ========================================= */
.container { 
    max-width: 800px; margin: 80px auto 40px; background: var(--card-bg); border: 1px solid var(--border); border-radius: 20px; 
    box-shadow: 0 20px 50px rgba(0,0,0,0.5); overflow: hidden; position: relative; z-index: 10; 
    backdrop-filter: blur(2px) saturate(150%); -webkit-backdrop-filter: blur(2px) saturate(150%);
}

.header { background: rgba(255,255,255,0.02); padding: 20px; border-bottom: 1px solid var(--border); }
.header-content { display: flex; align-items: center; justify-content: space-between; gap: 15px; }

.logo-link:hover { opacity: 0.8; transition: opacity 0.2s; }
.logo-box { background-color: rgba(255,255,255,0.9); border-radius: 10px; padding: 6px 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.header-logo { max-width: 130px; height: auto; display: block; }

.title-box { flex-grow: 1; text-align: center; }
.title-box h2 { font-weight: 300; text-transform: uppercase; color: #29b6f6; margin: 0; font-size: 1.4rem; letter-spacing: 2px; text-shadow: 0 0 15px rgba(41, 182, 246, 0.6); }

.logout-box { flex-shrink: 0; }

/* =========================================
   FORM ELEMENTS
   ========================================= */
.search-box { padding: 40px 30px; border-bottom: 1px solid var(--border); }

.input-group {
    display: flex;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    border-radius: 12px;
}

input[type="text"], input[type="password"] { 
    width: 100%; padding: 18px; font-size: 18px; color: #fff; border-radius: 12px; margin-bottom: 20px; 
    background: var(--input-bg); border: 1px solid rgba(255,255,255,0.2); transition: all 0.3s ease; -webkit-appearance: none; 
}

.input-group input[type="text"] {
    margin-bottom: 0;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-right: none;
    flex: 1;
}

.input-group select {
    width: auto;
    min-width: 110px;
    padding: 18px;
    font-size: 18px;
    font-weight: bold;
    color: #fff;
    background: rgba(40, 40, 50, 0.8);
    border: 1px solid rgba(255,255,255,0.2);
    border-left: 1px solid rgba(255,255,255,0.1);
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    text-align: center;
    transition: all 0.3s ease;
}

/* FIX PER DESKTOP: Colore sfondo menu a tendina */
.input-group select option {
    background-color: #1a1a1a;
    color: #fff;
}

input:focus, .input-group select:focus { 
    border-color: #fff; background: rgba(255, 255, 255, 0.1); box-shadow: 0 0 15px rgba(255, 255, 255, 0.2); outline: none; z-index: 2;
}

.extensions-list { font-size: 0.9rem; color: var(--text-muted); text-align: center; margin-bottom: 30px; letter-spacing: 0.5px; }

/* BUTTONS */
.btn-row { display: flex; gap: 15px; }

input[type="submit"], .btn-reset, .btn-logout, .btn-modal { 
    font-family: inherit; font-size: 18px; font-weight: 700; text-transform: uppercase; text-align: center; text-decoration: none; cursor: pointer; display: inline-block; transition: all 0.3s ease; -webkit-appearance: none;
    background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.2); color: #e0e0e0; backdrop-filter: blur(4px); border-radius: 12px;
}
input[type="submit"], .btn-reset { padding: 18px; }
input[type="submit"] { flex: 2; } 
.btn-reset { flex: 1; }
.btn-logout { padding: 8px 14px; font-size: 0.8rem; border-radius: 8px; }

input[type="submit"]:hover, .btn-reset:hover, .btn-logout:hover, .btn-modal:hover { 
    background: rgba(255, 255, 255, 0.15); border-color: #fff; color: #fff; transform: translateY(-2px); box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}
input[type="submit"]:active, .btn-reset:active, .btn-logout:active { transform: scale(0.98); }

#btn-confirm { width: auto; min-width: 200px; display: block; margin: 0 auto; }

/* =========================================
   MODAL
   ========================================= */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(5px); z-index: 1000;
    display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity 0.3s ease;
}
.modal-overlay.active { opacity: 1; pointer-events: all; }

.modal-box {
    background: rgba(20, 20, 25, 0.9); border: 1px solid rgba(255, 255, 255, 0.2); padding: 30px; border-radius: 16px;
    text-align: center; max-width: 400px; width: 90%; transform: scale(0.9); transition: transform 0.3s ease;
    box-shadow: 0 20px 60px rgba(0,0,0,0.8);
}
.modal-overlay.active .modal-box { transform: scale(1); }

.modal-title { font-size: 1.2rem; color: #fff; margin-bottom: 10px; font-weight: 300; }
.modal-text { color: #aaa; margin-bottom: 25px; font-size: 0.9rem; }
.btn-modal { padding: 10px 30px; font-size: 1rem; width: 100%; }

/* =========================================
   OUTPUT
   ========================================= */
.result-area { animation: fadeIn 0.5s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
pre { white-space: pre-wrap; font-family: "SF Mono", monospace; font-size: 13px; padding: 25px; overflow-x: auto; margin: 0; }
.human-output { background: transparent; color: var(--text-main); border-bottom: 2px solid #29b6f6; }
.raw-section { background: rgba(0,0,0,0.8); color: #0f0; border-top: 1px solid #333; }
.raw-section h3 { padding: 12px 25px; background: rgba(255,255,255,0.05); color: #888; font-size: 0.75rem; text-transform: uppercase; }
.raw-output { background: transparent; color: #00e676; font-size: 11px; border: none; }
.error-box { background: rgba(183, 28, 28, 0.4); color: #ff8a80; padding: 20px; text-align: center; margin-bottom: 20px; border-radius: 12px; border: 1px solid rgba(255, 82, 82, 0.3); }
.success-box { background: rgba(27, 94, 32, 0.4); color: #69f0ae; padding: 20px; text-align: center; font-size: 1.2rem; border: 1px solid rgba(105, 240, 174, 0.3); }
.lockdown-box { background: #000; color: #ff0000; padding: 30px; text-align: center; font-size: 1.5rem; border: 2px solid #ff0000; margin-bottom: 20px; text-transform: uppercase; border-radius: 12px; animation: blink 1.5s infinite; }
@keyframes blink { 50% { opacity: 0.5; } }

@media (min-width: 600px) { 
    .btn-row { max-width: 500px; margin: 0 auto; } 
    .header-logo { max-width: 160px; } 
}

@media (max-width: 599px) { 
    .search-box { padding: 25px 20px; } 

    .header-content { flex-wrap: wrap; gap: 15px; }
    .logo-link { width: 100%; display: flex; justify-content: center; }
    .header-logo { max-width: 110px; } 

    .title-box { flex: 1; text-align: left; display: flex; align-items: center; }
    .title-box h2 { font-size: 1rem; margin: 0; white-space: nowrap; }

    .logout-box { flex-shrink: 0; margin-left: auto; }
}
