/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg:       #0d0d1a;
    --bg2:      #141428;
    --bg3:      #1c1c38;
    --border:   #2a2a4a;
    --accent:   #4fc3f7;
    --accent2:  #7c4dff;
    --accent3:  #00e5ff;
    --text:     #e0e0f0;
    --text-dim: #7a7a9a;
    --green:    #00e676;
    --red:      #ff4444;
    --orange:   #ffab40;
    --magenta:  #ff4dff;
    --tab-h:    44px;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', system-ui, sans-serif;
    font-size: 14px;
    min-height: 100vh;
}

/* ===== HEADER ===== */
.site-header {
    background: linear-gradient(135deg, #0d0d2b 0%, #1a0a3a 100%);
    border-bottom: 1px solid var(--border);
    padding: 18px 30px;
    display: flex;
    align-items: center;
    gap: 14px;
}
.site-header .logo { font-size: 28px; }
.site-header h1 {
    font-size: 22px;
    font-weight: 700;
    background: linear-gradient(90deg, var(--accent3), var(--accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.site-header .sub {
    font-size: 12px;
    color: var(--text-dim);
    margin-left: auto;
}

/* ===== MAIN LAYOUT ===== */
.container { max-width: 1400px; margin: 0 auto; padding: 30px 20px; }

/* ===== UPLOAD FORM ===== */
.upload-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 40px;
    max-width: 560px;
    margin: 60px auto;
    text-align: center;
}
.upload-card .icon { font-size: 56px; margin-bottom: 16px; }
.upload-card h2 { font-size: 20px; margin-bottom: 8px; color: var(--accent3); }
.upload-card p  { color: var(--text-dim); font-size: 13px; margin-bottom: 24px; }

.drop-zone {
    border: 2px dashed var(--border);
    border-radius: 10px;
    padding: 30px 20px;
    cursor: pointer;
    transition: border-color .2s, background .2s;
    position: relative;
    margin-bottom: 20px;
}
.drop-zone:hover, .drop-zone.drag-over {
    border-color: var(--accent);
    background: rgba(79,195,247,.05);
}
.drop-zone input[type=file] {
    position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}
.drop-zone .dz-label { font-size: 15px; color: var(--text-dim); pointer-events: none; }
.drop-zone .dz-label span { color: var(--accent); font-weight: 600; }
.drop-zone .dz-file-name { font-size: 13px; color: var(--green); margin-top: 8px; }

.btn {
    display: inline-flex; align-items: center; gap: 8px;
    background: linear-gradient(135deg, var(--accent2), var(--accent));
    color: #fff; border: none; border-radius: 8px;
    padding: 12px 28px; font-size: 15px; font-weight: 600;
    cursor: pointer; transition: opacity .2s, transform .1s;
}
.btn:hover { opacity: .9; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-sm { padding: 7px 16px; font-size: 13px; }

.error-msg {
    background: rgba(255,68,68,.1); border: 1px solid var(--red);
    color: var(--red); border-radius: 8px; padding: 12px 16px;
    margin-bottom: 20px; font-size: 13px;
}

/* ===== DISK INFO BANNER ===== */
.disk-banner {
    background: linear-gradient(135deg, var(--bg3), var(--bg2));
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px 22px;
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}
.disk-banner .disk-icon { font-size: 36px; }
.disk-banner .disk-title { font-size: 16px; font-weight: 700; color: var(--accent3); }
.disk-banner .disk-meta  { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.disk-banner .disk-stats { margin-left: auto; display: flex; gap: 20px; flex-wrap: wrap; }
.stat-badge {
    text-align: center;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 14px;
    min-width: 70px;
}
.stat-badge .val { font-size: 20px; font-weight: 700; color: var(--accent); }
.stat-badge .lbl { font-size: 10px; color: var(--text-dim); text-transform: uppercase; }

.new-upload-btn { margin-left: auto; }

/* ===== TABS ===== */
.tabs-wrapper { margin-bottom: 0; }
.tabs-nav {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0;
    flex-wrap: wrap;
}
.tab-btn {
    background: var(--bg2);
    color: var(--text-dim);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .2s, color .2s;
    letter-spacing: .5px;
    text-transform: uppercase;
    display: flex; align-items: center; gap: 6px;
}
.tab-btn:hover { background: var(--bg3); color: var(--text); }
.tab-btn.active {
    background: var(--bg3);
    color: var(--accent3);
    border-color: var(--border);
    border-bottom: 2px solid var(--bg3);
    margin-bottom: -2px;
}
.tab-panel {
    display: none;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 10px 10px;
    padding: 24px;
}
.tab-panel.active { display: block; }

/* ===== TABLES ===== */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.data-table th {
    background: var(--bg);
    color: var(--accent);
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid var(--border);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: .5px;
}
.data-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.data-table tr:nth-child(even) td { background: rgba(255,255,255,.02); }
.data-table tr:hover td { background: rgba(79,195,247,.05); }
.data-table td.center { text-align: center; }
.data-table td.mono { font-family: monospace; font-size: 12px; }

/* ===== BADGES ===== */
.badge {
    display: inline-block;
    padding: 2px 8px; border-radius: 4px;
    font-size: 11px; font-weight: 600;
}
.badge-yes    { background: rgba(0,230,118,.15); color: var(--green); border: 1px solid var(--green); }
.badge-no     { background: rgba(122,122,154,.1); color: var(--text-dim); }
.badge-ro     { background: rgba(255,171,64,.15); color: var(--orange); border: 1px solid var(--orange); }
.badge-hidden { background: rgba(124,77,255,.15); color: var(--accent2); border: 1px solid var(--accent2); }
.badge-weak   { background: rgba(255,68,68,.15); color: var(--red); border: 1px solid var(--red); }
.badge-erased { background: rgba(79,195,247,.15); color: var(--accent); border: 1px solid var(--accent); }

/* ===== SPEC GRID (tab DISK) ===== */
.spec-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
@media (max-width: 700px) { .spec-grid { grid-template-columns: 1fr; } }
.spec-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}
.spec-card caption, .spec-card .card-title {
    display: block;
    background: var(--bg3);
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 700;
    color: var(--accent3);
    text-transform: uppercase;
    letter-spacing: .5px;
    border-bottom: 1px solid var(--border);
}
.spec-card table { width: 100%; border-collapse: collapse; }
.spec-card td {
    padding: 8px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
.spec-card tr:last-child td { border-bottom: none; }
.spec-card td:first-child { color: var(--text-dim); width: 55%; }
.spec-card td:last-child  { color: var(--text); font-weight: 500; text-align: right; }

/* ===== MAP ===== */
.map-legend {
    display: flex; gap: 16px; flex-wrap: wrap;
    margin-bottom: 20px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
}
.legend-item {
    display: flex; align-items: center; gap: 6px;
    font-size: 12px; color: var(--text-dim);
}
.legend-swatch {
    width: 14px; height: 14px; border-radius: 3px;
    border: 1px solid rgba(255,255,255,.1);
}

.map-container { overflow-x: auto; }
.map-track-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}
.map-track-label {
    font-family: monospace;
    font-size: 11px;
    color: var(--text-dim);
    min-width: 50px;
    text-align: right;
}
.map-sectors { display: flex; gap: 3px; flex-wrap: wrap; }
.sector-block {
    width: 28px; height: 28px;
    border-radius: 4px;
    border: 1px solid rgba(255,255,255,.08);
    display: flex; align-items: center; justify-content: center;
    font-size: 9px; font-family: monospace;
    cursor: pointer;
    transition: transform .1s;
    position: relative;
}
.sector-block:hover { transform: scale(1.2); z-index: 10; }
.sector-block.normal-used   { background: #FFFFFF; color: #000; border-color: #000; }
.sector-block.normal-empty  { background: #A0A0A0; color: #333; border-color: #555; }
.sector-block.erased-used   { background: #84CFEF; color: #003; border-color: #000; }
.sector-block.erased-empty  { background: #0073DF; color: #fff; border-color: #000; }
.sector-block.weak          { background: #FF0000; color: #fff; border-color: #000; }
.sector-block.weak-empty    { background: #A00000; color: #fff; border-color: #000; }
.sector-block.weak-erased   { background: #FF00FF; color: #fff; border-color: #000; }
.sector-block.weak-erased-empty { background: #BA00BA; color: #fff; border-color: #000; }
.sector-block.incomplete    { background: #fff; color: #333; border: 2px dashed #0a0; }

/* ===== INFOS TAB ===== */
.info-section {
    background: var(--bg);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent2);
    border-radius: 0 8px 8px 0;
    padding: 16px 20px;
    margin-bottom: 16px;
}
.info-section h3 {
    font-size: 14px; color: var(--accent3);
    margin-bottom: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .5px;
}
.info-section p, .info-section li {
    font-size: 13px; color: var(--text-dim); line-height: 1.6;
}
.info-section ul { padding-left: 18px; margin-top: 6px; }
.info-section .color-demo {
    display: inline-block; width: 12px; height: 12px;
    border-radius: 2px; vertical-align: middle; margin-right: 4px;
}

/* ===== SCROLLABLE TABLE ===== */
.table-scroll { overflow-x: auto; }

/* ===== TOOLTIP ===== */
.tooltip { position: relative; }
.tooltip:hover::after {
    content: attr(data-tip);
    position: absolute; bottom: 110%; left: 50%;
    transform: translateX(-50%);
    background: #000; color: #fff;
    padding: 4px 8px; border-radius: 4px;
    font-size: 11px; white-space: nowrap;
    pointer-events: none; z-index: 100;
}

/* ===== MAP STATS BAR ===== */
.map-stats-bar {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 14px;
    overflow: hidden;
}
.map-stats-header {
    background: var(--bg3);
    color: var(--accent3);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    padding: 6px 14px;
    border-bottom: 1px solid var(--border);
    text-align: center;
}
.map-stats-row {
    display: flex;
    flex-wrap: wrap;
}
.map-stat-cell {
    flex: 1;
    min-width: 60px;
    text-align: center;
    padding: 8px 4px;
    border-right: 1px solid var(--border);
}
.map-stat-cell:last-child { border-right: none; }
.msc-label {
    font-size: 10px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: .3px;
    margin-bottom: 4px;
}
.msc-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}
.map-stat-cell.has-value .msc-value { color: var(--accent); }
.map-stat-cell.erased-cell.has-value     { background: rgba(132,207,239,.08); }
.map-stat-cell.erased-cell.has-value .msc-value { color: #84cfef; }
.map-stat-cell.weak-cell.has-value       { background: rgba(255,68,68,.1); }
.map-stat-cell.weak-cell.has-value .msc-value   { color: var(--red); }
.map-stat-cell.incomplete-cell.has-value { background: repeating-linear-gradient(45deg, rgba(0,180,0,.05), rgba(0,180,0,.05) 3px, transparent 3px, transparent 8px); }
.map-stat-cell.total-weak-cell.has-value { background: rgba(255,68,68,.06); }
.map-stat-cell.gaps-cell.has-value .msc-value   { color: var(--orange); }

/* ===== MAP TABLE ===== */
.map-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.map-table th {
    background: var(--bg);
    color: var(--accent);
    padding: 8px 12px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    border-bottom: 2px solid var(--border);
}
.map-th-track   { width: 60px; text-align: center; }
.map-th-nb      { width: 50px; text-align: center; }

.map-row td { border-bottom: 1px solid var(--border); }
.map-row:nth-child(even) td { background: rgba(255,255,255,.015); }
.map-td-track {
    text-align: center;
    font-family: monospace;
    font-size: 13px;
    color: var(--text-dim);
    vertical-align: middle;
    padding: 4px 8px;
}
.map-td-sectors { padding: 4px 8px; vertical-align: middle; }
.map-td-nb {
    text-align: center;
    font-weight: 700;
    color: var(--text-dim);
    font-size: 13px;
    vertical-align: middle;
    padding: 4px 8px;
}

/* ===== INFOS TAB — compléments ===== */
.info-swatch {
    display: inline-block; width: 14px; height: 14px;
    border-radius: 3px; vertical-align: middle; margin-right: 6px;
    border: 1px solid rgba(255,255,255,.2);
}
.info-color-row {
    display: flex; gap: 8px; flex-wrap: wrap;
    margin: 8px 0 10px;
}
.info-swatch-block {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid rgba(0,0,0,.3);
}
.info-section code {
    background: var(--bg3);
    color: var(--accent3);
    padding: 1px 6px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 12px;
}

/* FDC grid */
.fdc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 10px; }
@media (max-width: 800px) { .fdc-grid { grid-template-columns: 1fr; } }
.fdc-title {
    font-size: 12px; font-weight: 700; color: var(--accent3);
    margin-bottom: 6px; text-transform: uppercase; letter-spacing: .4px;
}
.fdc-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.fdc-table td {
    padding: 4px 8px;
    border-bottom: 1px solid var(--border);
    color: var(--text-dim);
    vertical-align: top;
}
.fdc-table td:first-child { color: var(--accent2); font-family: monospace; white-space: nowrap; }
.fdc-table td:nth-child(2) { color: var(--text); font-weight: 700; white-space: nowrap; }
.fdc-table tr:last-child td { border-bottom: none; }

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center; padding: 40px;
    color: var(--text-dim); font-size: 13px;
}
.empty-state .es-icon { font-size: 40px; margin-bottom: 10px; }
