/* Reset et Variables */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #3498db;
    --success: #27ae60;
    --warning: #f39c12;
    --danger: #e74c3c;
    --dark: #2c3e50;
    --light: #ecf0f1;
    --gray: #95a5a6;
    
    /* Thème sombre (défaut) */
    --bg: #1a1a2e;
    --bg-card: #16213e;
    --text: #ecf0f1;
    --text-secondary: #95a5a6;
    --border: #34495e;
    --shadow: rgba(0,0,0,0.3);
}

/* Thème clair */
body.light-theme {
    --bg: #f5f7fa;
    --bg-card: #ffffff;
    --text: #2c3e50;
    --text-secondary: #7f8c8d;
    --border: #dfe6e9;
    --shadow: rgba(0,0,0,0.1);
    --dark: #34495e;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background: var(--dark);
    padding: 20px 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

header h1 {
    font-size: 1.8rem;
    color: var(--primary);
}

.status-indicators {
    display: flex;
    gap: 20px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-label {
    font-weight: 600;
    color: var(--text-secondary);
}

.status-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-badge.connected {
    background: var(--success);
    color: white;
}

.status-badge.disconnected {
    background: var(--danger);
    color: white;
}

/* Bouton Thème */
.theme-toggle {
    background: rgba(52, 152, 219, 0.2);
    border: 2px solid var(--primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    background: var(--primary);
    transform: rotate(20deg) scale(1.1);
}

.theme-toggle:active {
    transform: rotate(20deg) scale(0.95);
}

/* Navigation Tabs */
.tabs {
    background: var(--bg-card);
    padding: 0;
    margin-top: 20px;
    border-radius: 8px;
    overflow: hidden;
}

.tabs .container {
    display: flex;
    gap: 0;
    padding: 0;
}

.tab-button {
    flex: 1;
    padding: 15px 20px;
    background: transparent;
    border: none;
    color: var(--gray);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
}

.tab-button:hover {
    background: rgba(52, 152, 219, 0.1);
    color: var(--primary);
}

.tab-button.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

/* Main Content */
main {
    padding: 30px 20px;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Grid System */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: 0 4px 6px var(--shadow);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
}

.card-header {
    padding: 15px 20px;
    background: rgba(52, 152, 219, 0.1);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h2 {
    font-size: 1.3rem;
    color: var(--primary);
}

.card-body {
    padding: 20px;
}

/* Metric Cards */
.metric-card {
    text-align: center;
    padding: 30px 20px;
}

.metric-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.metric-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 5px;
}

.metric-label {
    font-size: 0.9rem;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Compass */
.compass-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.compass {
    width: 100%;
    max-width: 300px;
    height: auto;
}

.compass-label {
    fill: var(--text);
    font-size: 18px;
    font-weight: bold;
    transition: fill 0.3s ease;
}

/* Animation fluide de l'aiguille — rotation via attribut SVG uniquement */
#compass-needle {
    transition: none;
}

/* Mode mouvement rapide */
#compass-needle.fast-rotation {
    transition: none;
}

.angle-display {
    text-align: center;
}

.angle-value {
    font-size: 3rem;
    font-weight: bold;
    color: var(--primary);
}

.angle-label {
    font-size: 0.9rem;
    color: var(--gray);
    text-transform: uppercase;
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: rgba(255,255,255,0.03);
    border-radius: 6px;
}

.info-label {
    color: var(--gray);
    font-weight: 500;
}

.highlight {
    color: var(--primary);
    font-weight: bold;
    font-size: 1.1rem;
}

/* Badges */
.badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge.status-ok {
    background: var(--success);
    color: white;
}

.badge.status-error {
    background: var(--danger);
    color: white;
}

/* Separator */
.separator {
    height: 1px;
    background: var(--border);
    margin: 20px 0;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.85rem;
}

/* Controls */
.control-group {
    margin-bottom: 20px;
}

.control-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--gray);
    font-weight: 500;
}

.control-group input[type="number"],
.control-group select {
    width: 100%;
    padding: 10px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    font-size: 1rem;
}

.control-group input[type="range"] {
    width: calc(100% - 60px);
    margin-right: 10px;
}

.control-group button {
    margin-top: 10px;
}

/* Signal Indicator */
.signal-indicator {
    text-align: center;
    padding: 20px;
}

.signal-bars {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 8px;
    height: 80px;
    margin-bottom: 15px;
}

.signal-bar {
    width: 20px;
    background: var(--gray);
    border-radius: 4px 4px 0 0;
    transition: all 0.3s;
}

.signal-bar:nth-child(1) { height: 20%; }
.signal-bar:nth-child(2) { height: 40%; }
.signal-bar:nth-child(3) { height: 60%; }
.signal-bar:nth-child(4) { height: 80%; }
.signal-bar:nth-child(5) { height: 100%; }

.signal-bars.good .signal-bar {
    background: var(--success);
}

.signal-bars.medium .signal-bar:nth-child(-n+3) {
    background: var(--warning);
}

.signal-bars.poor .signal-bar:nth-child(1) {
    background: var(--danger);
}

.signal-label {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--gray);
}

/* Activity Log */
.activity-log {
    max-height: 300px;
    overflow-y: auto;
    background: rgba(0,0,0,0.2);
    padding: 15px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.log-entry {
    margin-bottom: 8px;
    padding: 5px;
    border-left: 3px solid var(--primary);
    padding-left: 10px;
}

.log-entry.success {
    border-left-color: var(--success);
}

.log-entry.error {
    border-left-color: var(--danger);
}

.log-time {
    color: var(--gray);
    margin-right: 10px;
}

/* Footer */
footer {
    background: var(--dark);
    padding: 20px 0;
    margin-top: 40px;
    text-align: center;
    color: var(--gray);
}

footer p {
    margin: 5px 0;
}

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        text-align: center;
    }
    
    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
    }
    
    .tabs .container {
        flex-wrap: wrap;
    }
    
    .tab-button {
        flex: 1 1 45%;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-card);
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: #2980b9;
}

/* ===== v3.0 additions to style.css ===== */

/* GPS locator display */
.gps-locator-display {
    text-align: center;
    padding: 1rem 0;
}
.locator-value {
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    color: var(--primary);
    font-family: 'Courier New', monospace;
}
.locator-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Signal bars */
.signal-bars { display: flex; align-items: flex-end; gap: 4px; height: 40px; margin: 0 auto 0.5rem; width: fit-content; }
.signal-bar { width: 12px; background: var(--border); border-radius: 2px; transition: background 0.3s; }
.signal-bar:nth-child(1) { height: 8px; }
.signal-bar:nth-child(2) { height: 16px; }
.signal-bar:nth-child(3) { height: 24px; }
.signal-bar:nth-child(4) { height: 32px; }
.signal-bar:nth-child(5) { height: 40px; }
.signal-bar.active { background: var(--success); }
.signal-indicator { display: flex; flex-direction: column; align-items: center; padding: 1rem 0; }
.signal-label { font-size: 0.9rem; color: var(--text-muted); }

/* Compass cardinal labels */
.compass-label.cardinal { font-size: 11px; font-weight: bold; fill: var(--text-primary, #ecf0f1); }

/* Slider */
.slider { width: 100%; margin-top: 0.5rem; }

/* Select input */
.select-input { background: var(--card-bg); color: var(--text); border: 1px solid var(--border); padding: 0.5rem; border-radius: 6px; width: 100%; }

/* Number input */
.number-input { background: var(--card-bg); color: var(--text); border: 1px solid var(--border); padding: 0.5rem; border-radius: 6px; width: 80px; text-align: center; }
.input-row { display: flex; gap: 0.5rem; align-items: center; }

/* Status badges extras */
.status-ok { background: rgba(46,213,115,0.2); color: #2ed573; border: 1px solid #2ed573; }
.status-warn { background: rgba(255,165,2,0.2); color: #ffa502; border: 1px solid #ffa502; }
.status-err { background: rgba(255,71,87,0.2); color: #ff4757; border: 1px solid #ff4757; }

/* btn-outline */
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--card-bg); }
.btn-full { width: 100%; }

/* ===== Calculateur QSO ===== */
#card-qso { margin-top: 1rem; }

.qso-layout { display: flex; flex-direction: column; gap: 1.25rem; }

.qso-label {
    display: block;
    font-size: 0.82rem;
    color: #7f8c8d;
    margin-bottom: 0.5rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.qso-input-row {
    display: flex;
    gap: 0.6rem;
    align-items: center;
    flex-wrap: wrap;
}

.qso-input {
    font-size: 1.2rem;
    font-family: 'Courier New', monospace;
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    padding: 0.55rem 1rem;
    border-radius: 8px;
    border: 2px solid rgba(255,255,255,0.15);
    background: rgba(255,255,255,0.07);
    color: #ecf0f1;
    width: 160px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.qso-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52,152,219,0.2);
}
.qso-input::placeholder { color: #636e72; font-size: 0.9rem; font-weight: 400; letter-spacing: 0.05em; }

.qso-btn { padding: 0.55rem 1.1rem; font-size: 0.88rem; }

.qso-error {
    margin-top: 0.5rem;
    font-size: 0.82rem;
    color: #ff4757;
    padding: 0.35rem 0.75rem;
    background: rgba(255,71,87,0.1);
    border: 1px solid rgba(255,71,87,0.3);
    border-radius: 6px;
    display: inline-block;
}

/* Grille de résultats */
.qso-result-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}
@media(max-width: 700px) { .qso-result-grid { grid-template-columns: 1fr 1fr; } }
@media(max-width: 400px) { .qso-result-grid { grid-template-columns: 1fr; } }

.qso-result-card {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    padding: 0.9rem 0.75rem;
    text-align: center;
    transition: border-color 0.2s;
}
.qso-result-card.highlight-card {
    border-color: rgba(52,152,219,0.35);
    background: rgba(52,152,219,0.07);
}

.qso-result-icon { font-size: 1.4rem; margin-bottom: 0.3rem; }

.qso-result-value {
    font-size: 1.35rem;
    font-weight: 700;
    color: #ecf0f1;
    font-family: 'Courier New', monospace;
    line-height: 1.1;
}

.qso-result-label {
    font-size: 0.72rem;
    color: #7f8c8d;
    margin-top: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.qso-result-sub {
    font-size: 0.78rem;
    color: #3498db;
    margin-top: 0.2rem;
    font-style: italic;
}

/* Barre d'alignement */
.qso-align-wrap {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 10px;
    padding: 0.9rem 1rem;
}

.qso-align-title {
    font-size: 0.75rem;
    color: #7f8c8d;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.6rem;
}

.qso-align-track {
    position: relative;
    height: 22px;
    background: rgba(255,255,255,0.05);
    border-radius: 11px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.08);
}

.qso-align-current {
    position: absolute;
    top: 0; bottom: 0;
    width: 4px;
    background: #3498db;
    border-radius: 2px;
    transform: translateX(-50%);
    transition: left 0.6s ease;
    box-shadow: 0 0 6px rgba(52,152,219,0.8);
}

.qso-align-target {
    position: absolute;
    top: 0; bottom: 0;
    width: 4px;
    background: #2ed573;
    border-radius: 2px;
    transform: translateX(-50%);
    transition: left 0.6s ease;
    box-shadow: 0 0 6px rgba(46,213,115,0.8);
}

.qso-align-scale {
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    color: #636e72;
    margin-top: 0.3rem;
}

.qso-align-legend {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.6rem;
    font-size: 0.75rem;
    color: #7f8c8d;
}

.dot {
    display: inline-block;
    width: 10px; height: 10px;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
}
.dot-blue  { background: #3498db; box-shadow: 0 0 4px rgba(52,152,219,0.8); }
.dot-green { background: #2ed573; box-shadow: 0 0 4px rgba(46,213,115,0.8); }

/* Light theme adaptations */
.light-theme .qso-input { background: rgba(0,0,0,0.05); color: #2c3e50; border-color: rgba(0,0,0,0.2); }
.light-theme .qso-input::placeholder { color: #95a5a6; }
.light-theme .qso-result-card { background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.08); }
.light-theme .qso-result-value { color: #2c3e50; }
