:root {
    --primary: #00d2ff;
    --primary-dim: rgba(0, 210, 255, 0.1);
    --secondary: #3a7bd5;
    --bg-dark: #0b0e14;
    --panel-bg: rgba(22, 27, 34, 0.95);
    --text-main: #e6edf3;
    --text-muted: #8b949e;
    --success: #4ade80;
    --danger: #f87171;
    --warning: #facc15;
    
    --font-tech: 'Rajdhani', sans-serif;
    --font-body: 'Inter', sans-serif;
}

* { box-sizing: border-box; }
body {
    background-color: var(--bg-dark);
    background-image: radial-gradient(circle at 50% 0%, #1c2333 0%, #0b0e14 70%);
    color: var(--text-main);
    font-family: var(--font-body);
    margin: 0; padding: 20px; min-height: 100vh;
}
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; }

.background-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle at 20% 20%, rgba(0, 210, 255, 0.05) 0%, transparent 20%);
    z-index: -1; pointer-events: none;
}

.container { max-width: 1400px; margin: 0 auto; position: relative; z-index: 2; }

/* HEADER */
.header-section { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 10px; flex-wrap: wrap; gap: 15px;}
.main-title { font-family: var(--font-tech); font-weight: 700; font-size: 2.2rem; margin: 0; background: linear-gradient(to bottom, #ffffff, #a5b4fc); -webkit-background-clip: text; -webkit-text-fill-color: transparent; letter-spacing: 1px; }
.highlight { color: var(--primary); -webkit-text-fill-color: var(--primary); }
.v-tag { font-size: 0.5em; background: var(--primary-dim); border: 1px solid var(--primary); color: var(--primary); -webkit-text-fill-color: var(--primary); padding: 2px 6px; border-radius: 4px; vertical-align: middle; margin-left: 10px; font-weight: 600; }
.home-btn { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; background: rgba(0, 212, 255, 0.1); border: 1px solid var(--primary); color: var(--primary); border-radius: 8px; font-size: 1.2rem; transition: 0.3s; box-shadow: 0 0 10px var(--primary-dim); text-decoration: none; }
.home-btn:hover { background: var(--primary); color: #000; box-shadow: 0 0 20px var(--primary); transform: translateY(-2px); }
.back-link { color: var(--text-muted); text-decoration: none; font-size: 0.9rem; transition: 0.3s; display: inline-block; margin-bottom: 15px; }
.back-link:hover { color: var(--primary); }

.lang-bar { display: flex; gap: 5px; flex-wrap: wrap; }
.lang-btn { background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); color: var(--text-muted); padding: 4px 8px; font-weight: bold; cursor: pointer; border-radius: 4px; font-size: 0.8rem; font-family: var(--font-tech);}
.lang-btn.active { background: var(--primary); color: #000; border-color: var(--primary); }

/* API PANEL */
.glass-panel { background: var(--panel-bg); border: 1px solid rgba(255, 255, 255, 0.1); backdrop-filter: blur(10px); border-radius: 12px; padding: 15px; margin-bottom: 20px; box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3); }
.api-panel { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 15px; }
.api-controls { display: flex; gap: 10px; align-items: flex-end; flex: 1; }
.input-box { display: flex; flex-direction: column; }
.big-box { flex-grow: 1; }
.input-box label { font-size: 0.7rem; color: var(--text-muted); margin-bottom: 4px; font-weight: 600; text-transform: uppercase; font-family: var(--font-body); letter-spacing: 0.5px; }
.input-cyber { background: rgba(0, 0, 0, 0.5); border: 1px solid var(--primary); color: var(--primary); padding: 8px; font-family: 'Rajdhani', sans-serif; font-weight: 600; border-radius: 5px; width: 100%; transition: 0.3s; font-size: 1rem; letter-spacing: 0.5px; }
.input-cyber:focus { box-shadow: 0 0 10px var(--primary-dim); outline: none; }
select.input-cyber option { background-color: #0a0b10; color: white; font-family: var(--font-body); }

.btn-main, .btn-cyber { padding: 8px 20px; background: linear-gradient(90deg, var(--secondary) 0%, var(--primary) 100%); border: none; border-radius: 6px; color: #000; font-family: var(--font-tech); font-weight: 700; font-size: 0.9rem; cursor: pointer; text-transform: uppercase; transition: 0.3s; letter-spacing: 1px; }
.btn-main:hover, .btn-cyber:hover { transform: translateY(-2px); box-shadow: 0 0 20px rgba(0, 210, 255, 0.5); }
.small-btn { height: 35px; padding: 0 20px; }
.btn-reset-small { background: transparent; border: 1px solid var(--danger); color: var(--danger); padding: 5px 10px; border-radius: 4px; cursor: pointer; font-size: 0.7rem; font-weight: 600; font-family: var(--font-tech); }

/* SPY PANEL */
.spy-panel { margin-bottom: 20px; }
.spy-panel h3 { margin: 0 0 10px 0; font-size: 1rem; color: var(--primary); text-transform: uppercase; display: flex; align-items: center; gap: 8px; font-family: var(--font-tech); font-weight: 600; letter-spacing: 1px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.area-cyber { height: 60px; font-family: 'Consolas', 'Monaco', monospace; font-size: 0.85rem; resize: none; color: #ccc; line-height: 1.4; }

.speed-indicators { display: flex; gap: 10px; }
.speed-box { display: flex; flex-direction: column; align-items: center; background: rgba(0,0,0,0.3); padding: 5px 12px; border-radius: 4px; border: 1px solid #444; }
.speed-box span { font-size: 0.7rem; font-weight: 700; margin-bottom: 2px; font-family: var(--font-tech); letter-spacing: 1px; }
.input-speed { width: 40px; background: transparent; border: none; text-align: center; color: white; font-family: var(--font-tech); font-weight: 700; font-size: 1.1rem; }
.war { border-color: var(--danger); color: var(--danger); }
.peace { border-color: var(--success); color: var(--success); }
.hold { border-color: var(--secondary); color: var(--secondary); }

/* MAIN LAYOUT */
.main-layout { display: grid; grid-template-columns: 280px 1fr; gap: 20px; align-items: start; }
@media (max-width: 1024px) { .main-layout { grid-template-columns: 1fr; } }

/* FLEET LIST COMPACT */
.fleet-panel { padding: 10px; height: 100%; max-height: 800px; display: flex; flex-direction: column; }
.compact-head { margin-bottom: 8px; }
.badge { background: rgba(255,255,255,0.1); padding: 1px 6px; border-radius: 10px; font-size: 0.75rem; color: white; font-weight: 600; }
.fleet-list { overflow-y: auto; flex: 1; padding-right: 2px; display: flex; flex-direction: column; gap: 1px; }

.ship-item { display: flex; align-items: center; gap: 6px; padding: 3px 6px; background: rgba(255,255,255,0.02); border-radius: 4px; border: 1px solid transparent; transition: 0.1s; height: 32px; }
.ship-item:hover { background: rgba(255,255,255,0.05); }
.ship-item.active { background: rgba(0, 212, 255, 0.15); border-color: var(--primary-dim); }
.ship-icon { width: 22px; height: 22px; background: rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: center; border-radius: 3px; font-size: 0.6rem; color: #777; font-weight: 700; border: 1px solid rgba(255,255,255,0.1); font-family: var(--font-tech); }
.ship-item.active .ship-icon { color: var(--primary); border-color: var(--primary); }
.ship-info { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.ship-name { display: block; font-size: 0.7rem; font-weight: 600; color: #ccc; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1; font-family: var(--font-body); }
.ship-engine { display: none; }
.ship-input { width: 60px; height: 24px; background: transparent; border: none; border-bottom: 1px solid rgba(255,255,255,0.1); text-align: right; color: #999; font-family: var(--font-tech); font-size: 0.85rem; font-weight: 600; padding: 0; }
.ship-input:focus { outline: none; border-color: var(--primary); color: white; }
.ship-item.active .ship-input { color: white; border-color: var(--primary); }

/* CONFIG WRAPPER */
.config-wrapper { display: grid; grid-template-columns: 2fr 1fr; gap: 15px; margin-bottom: 15px; }
@media (max-width: 1024px) { .config-wrapper { grid-template-columns: 1fr; } }
.config-box { height: 100%; } 
.config-box h3, .lf-box h3 { font-size: 1rem; color: var(--primary); border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 8px; margin-bottom: 15px; font-family: var(--font-tech); text-transform: uppercase; font-weight: 600; letter-spacing: 1px; }

.config-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; }
@media (max-width: 1300px) { .config-grid { grid-template-columns: repeat(2, 1fr); } }

.span-2 { grid-column: span 2; }
.span-4 { grid-column: span 4; }
@media (max-width: 1300px) { .span-2 { grid-column: span 1; } .span-4 { grid-column: span 2; } }

.config-group label { display: block; font-size: 0.7rem; color: var(--text-muted); margin-bottom: 5px; font-weight: 600; font-family: var(--font-body); letter-spacing: 0.5px; text-transform: uppercase; }
.coords-row { display: flex; gap: 5px; }
.coords-row input { text-align: center; font-size: 1rem; font-family: var(--font-tech); font-weight: 600; }
.coords-row.dest input { border-color: var(--secondary); color: var(--secondary); }
.text-accent { color: var(--secondary); } 

.tech-grid.vertical { display: flex; flex-direction: column; gap: 8px; }
.tech-item { display: grid; grid-template-columns: 24px 1fr 60px; align-items: center; background: rgba(255,255,255,0.03); padding: 6px 10px; border-radius: 4px; border: 1px solid rgba(255,255,255,0.05); }
.tech-item i { width: 100%; text-align: center; color: var(--primary); font-size: 0.9rem; }
.tech-label { font-size: 0.8rem; color: #aaa; font-weight: 600; text-transform: uppercase; font-family: var(--font-body); letter-spacing: 0.5px; }

/* INPUT TECH HIGHLIGHT - SFONDO SCURO */
.input-tech-level { 
    background: rgba(0,0,0,0.6) !important; 
    border: 1px solid rgba(255,255,255,0.2) !important; 
    color: white !important; 
    width: 100%; text-align: right; font-weight: 700; 
    font-family: var(--font-tech); font-size: 1.1rem; padding: 2px 8px; border-radius: 4px; 
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.5);
}
.input-tech-level:focus { border-color: var(--primary) !important; box-shadow: 0 0 5px var(--primary-dim); }

.class-input-row { display: flex; gap: 10px; align-items: center; }
.lf-class-bonus-box { flex-shrink: 0; display: flex; flex-direction: column; align-items: center; background: rgba(255,255,255,0.05); padding: 2px 8px; border-radius: 4px; border: 1px solid rgba(255,255,255,0.1); }
.lf-class-bonus-box label { font-size: 0.6rem; margin-bottom: 0; color: #666; }
.lf-class-bonus-box input { width: 50px; text-align: center; background: transparent; border: none; color: var(--success); font-weight: 700; font-family: var(--font-tech); font-size: 0.9rem; padding: 0; }

.lf-list { display: flex; flex-direction: column; gap: 1px; overflow-y: auto; height: 100%; max-height: 450px; padding-right: 2px; }
.lf-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 3px 6px; background: rgba(255,255,255,0.02); border-radius: 4px; height: 32px; border: 1px solid transparent; }
.lf-item:hover { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.1); }
.lf-name { font-size: 0.7rem; color: #ccc; font-weight: 600; font-family: var(--font-body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.lf-inputs { display: flex; gap: 3px; }
.lf-inp { width: 45px; background: transparent; border: none; border-bottom: 1px solid rgba(255,255,255,0.1); text-align: right; color: white; font-size: 0.8rem; padding: 0; font-family: var(--font-tech); font-weight: 600; }
.lf-inp.spd { color: var(--success); } .lf-inp.fuel { color: var(--warning); }
.lf-inp:focus { outline: none; border-color: var(--primary); }

.section-title-box { margin-bottom: 10px; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 5px; }
.section-title-box h3 { font-family: var(--font-tech); font-size: 1.2rem; color: var(--primary); font-weight: 700; margin: 0; letter-spacing: 2px; }

/* FLIGHT TABLE */
.empty-state { padding: 40px; text-align: center; color: var(--text-muted); opacity: 0.6; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.table-responsive { overflow-x: auto; }
.flight-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; font-family: var(--font-body); }
.flight-table th { text-align: left; padding: 10px; color: var(--text-muted); font-size: 0.75rem; text-transform: uppercase; border-bottom: 1px solid rgba(255,255,255,0.1); font-weight: 600; letter-spacing: 0.5px; }
.flight-table td { padding: 8px 10px; border-bottom: 1px solid rgba(255,255,255,0.05); color: white; }
.flight-table tr:hover { background: rgba(255,255,255,0.03); }
.flight-table .pct { font-family: var(--font-tech); color: var(--primary); font-weight: 700; width: 60px; font-size: 1.1rem; }
.flight-table .fuel { color: var(--warning); font-family: var(--font-tech); font-weight: 600; letter-spacing: 0.5px; }
.flight-table .return-col { color: var(--secondary); }
.progress-bar { height: 4px; background: #333; margin-top: 5px; border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary); }
.expand-btn { background: transparent; border: none; color: #666; cursor: pointer; transition: 0.2s; }
.expand-btn:hover { color: white; }

/* RECALL PANEL & TOOLTIP */
.recall-row td { background: rgba(0,0,0,0.2); padding: 0; }
.recall-panel { padding: 15px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.recall-inputs { display: flex; gap: 10px; align-items: center; }
.btn-toggle { background: #333; border: none; color: #aaa; padding: 5px 10px; border-radius: 4px; cursor: pointer; font-size: 0.75rem; }
.btn-toggle.active { background: var(--primary); color: black; }
.recall-result { font-family: var(--font-tech); font-size: 1.3rem; color: var(--danger); font-weight: 700; letter-spacing: 1px; }

/* TOOLTIP CSS */
.tooltip-container { position: relative; display: inline-flex; justify-content: center; cursor: help; margin-right: 5px; }
.tooltip-container i { color: var(--text-muted); font-size: 0.9rem; transition: 0.3s; }
.tooltip-container:hover i { color: var(--primary); }

.tooltip-text { 
    visibility: hidden; width: 220px; background-color: rgba(15, 20, 30, 0.95); color: #fff; text-align: center; 
    border-radius: 6px; padding: 8px 12px; position: absolute; z-index: 100; bottom: 130%; left: 50%; 
    transform: translateX(-50%); opacity: 0; transition: opacity 0.2s; 
    border: 1px solid var(--primary-dim); font-size: 0.75rem; box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    font-family: var(--font-body); line-height: 1.4; pointer-events: none;
}
.tooltip-text::after {
    content: ""; position: absolute; top: 100%; left: 50%; margin-left: -5px;
    border-width: 5px; border-style: solid; border-color: rgba(15, 20, 30, 0.95) transparent transparent transparent;
}
.tooltip-container:hover .tooltip-text { visibility: visible; opacity: 1; }

.tabs-buttons { display: none; } /* Hide old tabs */
.tab-content { display: block; }