/* TeslaAA Bridge — tema propio (no TaaDa) */
:root {
    --bg: #0a0e14;
    --bg-card: #141b26;
    --bg-card-border: #243044;
    --text: #e8eef7;
    --text-muted: #8b9cb3;
    --accent: #5eb8ff;
    --accent-2: #8b6cff;
    --success: #22d3a5;
    --warn: #f5b942;
    --danger: #ff6b6b;
    --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--font);
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: absolute;
    background: var(--bg);
    color: var(--text);
    overscroll-behavior-x: none;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(94, 184, 255, 0.12), transparent),
        radial-gradient(ellipse 60% 40% at 100% 100%, rgba(139, 108, 255, 0.08), transparent);
    pointer-events: none;
    z-index: 0;
}

canvas, video {
    margin: 0 auto;
}

/* —— Pantalla de carga / conexión —— */
.overlay-panel {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 14, 20, 0.92);
    z-index: 10;
}

.overlay-card {
    text-align: center;
    max-width: 560px;
    padding: 24px;
}

.overlay-title {
    font-size: 1.6em;
    font-weight: 600;
    margin-bottom: 24px;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.progress-steps {
    display: flex;
    justify-content: center;
    gap: 28px;
    margin: 24px 0;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    opacity: 0.35;
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.step-number {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.2em;
    border: 2px solid var(--bg-card-border);
    background: var(--bg-card);
    color: var(--text-muted);
}

.step-label {
    font-size: 0.85em;
    color: var(--text-muted);
}

.step.active {
    opacity: 1;
    transform: scale(1.05);
}

.step.active .step-number {
    border-color: var(--accent);
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: #fff;
    box-shadow: 0 0 24px rgba(94, 184, 255, 0.45);
}

.step.active .step-label {
    color: var(--accent);
    font-weight: 600;
}

.step.completed .step-number {
    border-color: var(--success);
    background: rgba(34, 211, 165, 0.2);
    color: var(--success);
}

.step.completed .step-label {
    color: var(--success);
}

.loading-indicator {
    width: 44px;
    height: 44px;
    margin: 16px auto 0;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* —— Errores —— */
.error-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 14, 20, 0.94);
    z-index: 9999;
    pointer-events: none;
}

.error-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    border-radius: 50%;
    border: 3px solid var(--danger);
    color: var(--danger);
    font-size: 2em;
    font-weight: 800;
    line-height: 50px;
}

.error-content p {
    font-size: 1.4em;
    font-weight: 600;
    line-height: 1.4;
}

.error-subtitle {
    font-size: 1em;
    color: var(--text-muted);
    margin-top: 12px;
}

/* —— Ayuda AA —— */
.troubleshoot-message {
    margin-top: 20px;
    padding: 18px 20px;
    text-align: left;
    background: rgba(245, 185, 66, 0.08);
    border: 1px solid rgba(245, 185, 66, 0.35);
    border-radius: 12px;
    animation: fadeIn 0.4s ease;
}

.troubleshoot-title {
    color: var(--warn) !important;
    font-weight: 600;
    margin-bottom: 10px !important;
}

.troubleshoot-message p {
    font-size: 0.92em !important;
    color: var(--text-muted) !important;
    line-height: 1.55;
    margin-bottom: 8px;
}

.troubleshoot-divider {
    border-top: 1px solid rgba(245, 185, 66, 0.25);
    margin: 14px 0;
}

.troubleshoot-reset-btn {
    background: rgba(94, 184, 255, 0.15);
    border: 1px solid var(--accent);
    color: var(--accent);
    border-radius: 8px;
    padding: 10px 18px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.95em;
}

.troubleshoot-reset-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.reset-aa-confirm {
    margin-top: 12px;
    padding: 12px;
    background: rgba(34, 211, 165, 0.1);
    border: 1px solid rgba(34, 211, 165, 0.35);
    border-radius: 8px;
}

.reset-aa-confirm-text {
    color: var(--success) !important;
    font-weight: 600;
}

.troubleshoot-steps {
    list-style: none;
    padding-left: 0;
    counter-reset: ts;
}

.troubleshoot-steps li {
    counter-increment: ts;
    padding-left: 28px;
    position: relative;
    margin-bottom: 8px;
    font-size: 0.92em;
    color: var(--text-muted);
}

.troubleshoot-steps li::before {
    content: counter(ts) ".";
    position: absolute;
    left: 0;
    color: var(--warn);
    font-weight: 700;
}

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

/* —— Pantalla inicio (sin stream) —— */
.bridge-shell {
    position: relative;
    z-index: 2;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    padding: 28px 24px 20px;
}

.bridge-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 32px;
}

.bridge-logo {
    flex-shrink: 0;
    filter: drop-shadow(0 4px 12px rgba(94, 184, 255, 0.25));
}

.bridge-brand h1 {
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.bridge-tagline {
    color: var(--text-muted);
    font-size: 1.05em;
    margin-top: 4px;
}

.bridge-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-width: 640px;
    margin: 0 auto;
    width: 100%;
}

.status-card {
    display: flex;
    gap: 18px;
    align-items: flex-start;
    padding: 22px 24px;
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.status-pulse {
    width: 12px;
    height: 12px;
    margin-top: 6px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 0 rgba(94, 184, 255, 0.6);
    animation: pulse 2s infinite;
    flex-shrink: 0;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(94, 184, 255, 0.55); }
    70% { box-shadow: 0 0 0 12px rgba(94, 184, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(94, 184, 255, 0); }
}

.status-body h2 {
    font-size: 1.25em;
    margin-bottom: 10px;
}

.status-body p {
    color: var(--text-muted);
    line-height: 1.55;
    font-size: 1.02em;
}

.status-url {
    margin-top: 12px !important;
}

.status-url code {
    color: var(--accent);
    background: rgba(94, 184, 255, 0.12);
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.95em;
}

.steps-card {
    padding: 22px 24px;
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    border-radius: 16px;
}

.steps-card h3 {
    font-size: 1.1em;
    margin-bottom: 16px;
    color: var(--text);
}

.setup-steps {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.setup-steps li {
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--text-muted);
    font-size: 1em;
}

.setup-steps li span {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(94, 184, 255, 0.2), rgba(139, 108, 255, 0.2));
    color: var(--accent);
    font-weight: 700;
    font-size: 0.85em;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.bridge-footnote {
    text-align: center;
    font-size: 0.88em;
    color: var(--text-muted);
    opacity: 0.85;
}

.bridge-footer {
    margin-top: auto;
    padding-top: 16px;
}

#log {
    position: fixed;
    bottom: 8px;
    right: 12px;
    font-size: 0.85em;
    color: var(--warn);
    opacity: 0.8;
}

#warning {
    position: fixed;
    bottom: 8px;
    left: 12px;
    font-size: 0.85em;
    color: var(--danger);
    max-width: 70%;
}

@media (max-width: 768px) {
    .bridge-header {
        flex-direction: column;
        text-align: center;
    }
    .progress-steps {
        gap: 16px;
    }
    .step-number {
        width: 40px;
        height: 40px;
        font-size: 1em;
    }
}
