/* ==========================================================================
   MOTO INTERCOM WEB - COCKPIT DESIGN SYSTEM
   Paleta: Dark Carbon, Racing Orange, Neon Telemetry Green & Cyan
   ========================================================================== */

:root {
    --bg-dark: #0a0c10;
    --bg-card: rgba(18, 22, 29, 0.85);
    --bg-card-hover: rgba(25, 31, 41, 0.95);
    --bg-input: #12161e;
    
    --orange-primary: #ff5722;
    --orange-hover: #ff7043;
    --orange-glow: rgba(255, 87, 34, 0.4);
    
    --green-live: #00e676;
    --green-glow: rgba(0, 230, 118, 0.35);
    
    --cyan-telemetry: #00e5ff;
    --red-alert: #ff1744;
    --yellow-warn: #ffd600;
    --text-muted: #8b949e;
    --text-light: #f0f6fc;
    
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-focus: rgba(255, 87, 34, 0.6);
    
    --font-ui: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-telemetry: 'Orbitron', monospace;
    
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    
    --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

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

body {
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(circle at 15% 15%, rgba(255, 87, 34, 0.08) 0%, transparent 45%),
        radial-gradient(circle at 85% 85%, rgba(0, 229, 255, 0.05) 0%, transparent 45%),
        linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
    background-size: 100% 100%, 100% 100%, 30px 30px, 30px 30px;
    color: var(--text-light);
    font-family: var(--font-ui);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* ==========================================================================
   HEADER & NAVBAR
   ========================================================================== */

.cockpit-header {
    background: rgba(12, 15, 21, 0.85);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-subtle);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand-wrapper {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-icon {
    font-size: 2rem;
    filter: drop-shadow(0 0 10px var(--orange-glow));
}

.brand-title {
    font-family: var(--font-telemetry);
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 2px;
    background: linear-gradient(135deg, #fff 40%, var(--orange-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.header-telemetry {
    display: flex;
    align-items: center;
    gap: 16px;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-family: var(--font-telemetry);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 1px;
    transition: all 0.3s ease;
}

.status-offline {
    background: rgba(139, 148, 158, 0.15);
    color: var(--text-muted);
    border: 1px solid rgba(139, 148, 158, 0.3);
}

.status-connecting {
    background: rgba(255, 214, 0, 0.15);
    color: var(--yellow-warn);
    border: 1px solid rgba(255, 214, 0, 0.4);
    animation: pulse 1.5s infinite;
}

.status-live {
    background: rgba(0, 230, 118, 0.15);
    color: var(--green-live);
    border: 1px solid var(--green-live);
    box-shadow: 0 0 15px var(--green-glow);
}

.status-error {
    background: rgba(255, 23, 68, 0.15);
    color: var(--red-alert);
    border: 1px solid var(--red-alert);
}

.signal-badge {
    font-family: var(--font-telemetry);
    font-size: 0.75rem;
    color: var(--cyan-telemetry);
    background: rgba(0, 229, 255, 0.08);
    border: 1px solid rgba(0, 229, 255, 0.2);
    padding: 6px 12px;
    border-radius: var(--radius-full);
}

/* ==========================================================================
   MAIN DASHBOARD GRID
   ========================================================================== */

.cockpit-main {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 1.5rem;
    flex: 1;
    width: 100%;
}

.cockpit-grid {
    display: grid;
    grid-template-columns: 340px 1fr 340px;
    gap: 24px;
    align-items: start;
}

/* CARDS */
.cockpit-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
}

.card-title {
    font-family: var(--font-telemetry);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 14px;
    background: var(--orange-primary);
    border-radius: 2px;
}

.card-body {
    padding: 1.5rem;
}

/* ==========================================================================
   FORM CONTROLS & INPUTS
   ========================================================================== */

.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.form-input, .form-select {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    color: var(--text-light);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-family: var(--font-ui);
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: var(--orange-primary);
    box-shadow: 0 0 0 3px var(--orange-glow);
}

.form-input:disabled, .form-select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ACCORDION / DETAILS */
.crypto-details {
    margin-top: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
}

.crypto-details summary {
    padding: 10px 14px;
    font-size: 0.8rem;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}

.crypto-details-body {
    padding: 12px 14px 4px 14px;
    border-top: 1px solid var(--border-subtle);
}

/* BUTTONS */
.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, var(--orange-primary), #e64a19);
    color: #fff;
    border: none;
    padding: 14px;
    border-radius: var(--radius-md);
    font-family: var(--font-telemetry);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 15px var(--orange-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--orange-hover), var(--orange-primary));
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 87, 34, 0.6);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    box-shadow: none;
}

.btn-danger {
    width: 100%;
    margin-top: 10px;
    background: rgba(255, 23, 68, 0.1);
    color: var(--red-alert);
    border: 1px solid rgba(255, 23, 68, 0.3);
    padding: 12px;
    border-radius: var(--radius-md);
    font-family: var(--font-telemetry);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-danger:hover:not(:disabled) {
    background: rgba(255, 23, 68, 0.25);
    border-color: var(--red-alert);
}

.btn-danger:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* ==========================================================================
   CENTER TRANSMISSION CONSOLE & PTT
   ========================================================================== */

.telemetry-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.telemetry-box {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 14px 16px;
}

.telemetry-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.telemetry-value {
    font-family: var(--font-telemetry);
    font-size: 1.1rem;
    font-weight: 700;
}

.speaker-active {
    color: var(--green-live);
    text-shadow: 0 0 10px var(--green-glow);
    animation: pulse 1s infinite alternate;
}

.speaker-idle {
    color: var(--text-muted);
}

/* AUDIO SPECTRUM CANVAS */
.visualizer-container {
    background: #080a0e;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: 24px;
    position: relative;
}

.visualizer-canvas {
    width: 100%;
    height: 110px;
    display: block;
}

.visualizer-overlay {
    position: absolute;
    top: 10px;
    right: 14px;
    font-family: var(--font-telemetry);
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.4);
    letter-spacing: 1px;
}

/* PTT ACTION BUTTON */
.ptt-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin: 1.5rem 0;
}

.btn-ptt {
    width: 100%;
    height: 140px;
    background: linear-gradient(180deg, #222936 0%, #151a23 100%);
    border: 3px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    color: #fff;
    font-family: var(--font-telemetry);
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 2px;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), inset 0 2px 0 rgba(255, 255, 255, 0.1);
    transition: all 0.15s ease;
    user-select: none;
    position: relative;
    overflow: hidden;
}

.btn-ptt::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle at center, rgba(255, 87, 34, 0.15), transparent 70%);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.btn-ptt:hover:not(:disabled) {
    border-color: var(--orange-primary);
}

.btn-ptt:hover:not(:disabled)::before {
    opacity: 1;
}

/* PTT ACTIVO (TRANSMITIENDO) */
.btn-ptt.transmitting {
    background: linear-gradient(180deg, #d32f2f 0%, #b71c1c 100%);
    border-color: #ff5252;
    color: #fff;
    box-shadow: 0 0 30px rgba(244, 67, 54, 0.8), inset 0 3px 6px rgba(0, 0, 0, 0.4);
    transform: scale(0.98);
}

.btn-ptt:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    border-color: var(--border-subtle);
    box-shadow: none;
}

.ptt-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
}

.kbd-shortcut {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.75rem;
    color: #fff;
}

/* TOGGLE SWITCH */
.toggle-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin-top: 1rem;
}

.toggle-label-text {
    font-size: 0.85rem;
    font-weight: 600;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #2b3342;
    border-radius: 34px;
    transition: 0.3s;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    border-radius: 50%;
    transition: 0.3s;
}

input:checked + .toggle-slider {
    background-color: var(--green-live);
}

input:checked + .toggle-slider:before {
    transform: translateX(22px);
}

/* ==========================================================================
   PARTICIPANT ROSTER LIST
   ========================================================================== */

.participant-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 480px;
    overflow-y: auto;
    padding-right: 4px;
}

.participant-list::-webkit-scrollbar {
    width: 6px;
}

.participant-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.participant-card {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
}

.participant-card:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.15);
}

.participant-card.local {
    border-left: 3px solid var(--orange-primary);
}

.participant-card.speaking {
    border-color: var(--green-live);
    background: rgba(0, 230, 118, 0.08);
    box-shadow: 0 0 15px rgba(0, 230, 118, 0.2);
}

.participant-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #1c222e;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    position: relative;
    border: 2px solid transparent;
}

.participant-avatar.pulse-green {
    border-color: var(--green-live);
    box-shadow: 0 0 10px var(--green-glow);
}

.participant-info {
    flex: 1;
    min-width: 0;
}

.participant-title {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}

.rider-name {
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.badge-you {
    font-size: 0.65rem;
    font-family: var(--font-telemetry);
    background: var(--orange-primary);
    color: #fff;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 700;
}

.participant-status {
    font-size: 0.75rem;
}

.status-speaking {
    color: var(--green-live);
    font-weight: 600;
}

.status-muted {
    color: var(--text-muted);
}

.status-listening {
    color: var(--cyan-telemetry);
}

.signal-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #333d4e;
    transition: all 0.2s ease;
}

.signal-dot.active {
    background: var(--green-live);
    box-shadow: 0 0 8px var(--green-live);
}

.empty-roster {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 10px;
    opacity: 0.5;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */

.cockpit-footer {
    text-align: center;
    padding: 1.5rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border-subtle);
    margin-top: auto;
}

/* KEYFRAMES */
@keyframes pulse {
    0% { opacity: 0.6; }
    100% { opacity: 1; }
}

/* RESPONSIVE DESIGN */
@media (max-width: 1100px) {
    .cockpit-grid {
        grid-template-columns: 1fr;
    }
}
