:root {
    --bg-dark: #0b0f19;
    --card-bg: #161e2e;
    --toolbar-bg: #111827;
    --border-color: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --accent: #0284c7;
    --accent-hover: #0369a1;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-primary);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.connect-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.connect-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    width: 100%;
    max-width: 480px;
    padding: 2.2rem;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
}

.header {
    text-align: center;
    margin-bottom: 2rem;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.logo-icon {
    font-size: 2rem;
}

.header h2 {
    font-size: 1.5rem;
    color: #38bdf8;
    font-weight: 700;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.88rem;
}

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

label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #cbd5e1;
    margin-bottom: 0.4rem;
}

.mode-selector {
    display: flex;
    background: #0f172a;
    border-radius: 8px;
    padding: 0.25rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
}

.tab-btn {
    flex: 1;
    padding: 0.5rem 0.75rem;
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn.active {
    background: var(--accent);
    color: white;
}

.label-with-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
}

.btn-link {
    background: none;
    border: none;
    color: #38bdf8;
    font-size: 0.75rem;
    cursor: pointer;
    text-decoration: underline;
    padding: 0;
}

.ticket-input {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: #0f172a;
    color: var(--text-primary);
    font-size: 0.8rem;
    font-family: monospace;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s;
}

.ticket-input:focus {
    border-color: var(--accent);
}

input[type="text"] {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: #0f172a;
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

input[type="text"]:focus {
    border-color: var(--accent);
}

.code-input {
    font-family: monospace;
    font-size: 1.4rem !important;
    letter-spacing: 3px;
    text-align: center;
    font-weight: 700;
    color: #38bdf8 !important;
}

.helper-text {
    display: block;
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-top: 0.35rem;
}

.btn {
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-large {
    width: 100%;
    padding: 0.85rem 1.5rem;
    font-size: 1rem;
}

.btn-sm {
    padding: 0.45rem 0.85rem;
    font-size: 0.82rem;
}

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

.btn-secondary { background: #334155; color: var(--text-primary); border: 1px solid #475569; }
.btn-secondary:hover { background: #475569; }

.btn-warning { background: var(--warning); color: #1e293b; }
.btn-warning:hover { background: #d97706; }

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

.status-msg {
    padding: 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    margin-bottom: 1.25rem;
    text-align: center;
}

.status-msg.info { background: #075985; color: #bae6fd; }
.status-msg.error { background: #7f1d1d; color: #fecaca; }

.footer-note {
    margin-top: 1.5rem;
    font-size: 0.75rem;
    color: #64748b;
    text-align: center;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

/* Workspace del Técnico */
.workspace {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    background: #000;
}

.workspace-toolbar {
    background: var(--toolbar-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 0.6rem 1.2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 10;
}

.toolbar-left, .toolbar-center, .toolbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-mini {
    font-weight: 700;
    color: #38bdf8;
    font-size: 0.95rem;
}

.divider {
    color: #334155;
}

.session-target {
    font-size: 0.85rem;
    color: #cbd5e1;
}

.stat-item {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.stat-item strong {
    color: #f1f5f9;
}

.badge {
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 700;
}

.badge-success { background: #065f46; color: #6ee7b7; }
.badge-warning { background: #92400e; color: #fde68a; }
.badge-info { background: #075985; color: #bae6fd; }
.badge-relay { background: #854d0e; color: #fef08a; border: 1px solid #ca8a04; }
.badge-direct { background: #065f46; color: #a7f3d0; border: 1px solid #10b981; }

.diagnostic-options {
    margin-bottom: 1.25rem;
    padding: 0.75rem;
    background: #0f172a;
    border: 1px dashed #334155;
    border-radius: 8px;
    text-align: left;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    color: #94a3b8;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    cursor: pointer;
    accent-color: var(--accent);
}

.viewport-container {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    overflow: hidden;
}

#remoteVideo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.connecting-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(11, 15, 25, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    z-index: 5;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(56, 189, 248, 0.2);
    border-top-color: #38bdf8;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.control-indicator {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(245, 158, 11, 0.9);
    color: #000;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    pointer-events: none;
}

.hidden {
    display: none !important;
}
