/* ===== Fixeame – Asistencia Remota CSS ===== */

.assist-section {
    min-height: calc(100vh - 80px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

/* ---- Lobby ---- */
.lobby-card {
    max-width: 520px;
    width: 100%;
    padding: 48px 36px;
    text-align: center;
}

.lobby-header { margin-bottom: 36px; }

.lobby-icon-wrap {
    width: 80px; height: 80px;
    margin: 0 auto 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: flex; align-items: center; justify-content: center;
    font-size: 32px; color: #000;
    box-shadow: 0 10px 30px rgba(251,191,36,0.25);
}

.lobby-header h1 {
    font-size: 2rem;
    margin-bottom: 10px;
}

.lobby-header p {
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.5;
}

.lobby-options {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.lobby-option {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.03);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
}

.lobby-option:hover {
    background: rgba(255,255,255,0.07);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.option-icon {
    flex-shrink: 0;
    width: 52px; height: 52px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
}

.option-text h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.option-text p {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.option-arrow {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ---- Join Panel ---- */
.join-panel {
    margin-top: 32px;
    animation: fadeIn 0.3s ease;
}

.join-panel h3 {
    margin-bottom: 16px;
    font-size: 1.1rem;
}

#pin-input {
    width: 100%;
    padding: 18px;
    font-size: 2rem;
    text-align: center;
    letter-spacing: 12px;
    font-weight: 800;
    border: 2px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    background: rgba(255,255,255,0.05);
    color: #fff;
    outline: none;
    transition: border 0.3s;
    font-family: 'Outfit', sans-serif;
}

#pin-input:focus {
    border-color: var(--primary);
}

.join-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.join-actions button {
    flex: 1;
    padding: 14px;
    border-radius: 14px;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    border: none;
    font-family: 'Outfit', sans-serif;
}

.btn-secondary {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

.btn-secondary:hover {
    background: rgba(255,255,255,0.14);
}

/* ---- Video Room ---- */
.video-container {
    position: relative;
    /* width/height se setean por JS (adjustVideoContainer) según las
       dimensiones reales del vídeo entrante + viewport. Así nunca hay
       franjas negras: el container coincide con la forma del vídeo. */
    width: 100%;
    max-width: 960px;
    aspect-ratio: 16 / 9;  /* fallback antes de que llegue el primer frame */
    margin: 0 auto;
    border-radius: 20px;
    overflow: hidden;
    background: #000;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    transition: width 0.25s ease, height 0.25s ease;
}

.video-container.fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    aspect-ratio: auto !important;
    border-radius: 0 !important;
    z-index: 9999;
    transition: none;
}

#remote-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* En fullscreen, queremos que el vídeo llene la pantalla con cover
   (acepta cropping mínimo si la forma del vídeo no coincide con la del
   viewport — total, el usuario ya pidió pantalla completa). */
.video-container.fullscreen #remote-video {
    object-fit: contain;
    background: #000;
}

#local-video {
    position: absolute;
    bottom: 80px;
    right: 16px;
    width: 140px;
    aspect-ratio: 4/3;
    border-radius: 12px;
    border: 2px solid rgba(255,255,255,0.2);
    object-fit: cover;
    z-index: 5;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

#draw-canvas {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 4;
    pointer-events: none;
}

#draw-canvas.active {
    pointer-events: auto;
    cursor: crosshair;
}

.room-info-badge {
    position: absolute;
    top: 12px; left: 12px;
    z-index: 10;
    padding: 8px 16px;
    border-radius: 10px;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
    font-size: 0.8rem;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.5px;
}

/* ---- Waiting Overlay ---- */
.waiting-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
}

.waiting-card {
    text-align: center;
    padding: 40px;
    max-width: 360px;
}

.waiting-card h2 {
    font-size: 3rem;
    letter-spacing: 10px;
    color: var(--primary);
    margin: 20px 0 12px;
}

.waiting-card p {
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* Pasos de progreso */
.progress-step {
    font-size: 0.9rem;
    color: #fff;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
}
.progress-step i {
    width: 20px;
    text-align: center;
    font-size: 1rem;
}
.progress-step.active {
    color: var(--primary);
    font-weight: 700;
    opacity: 1 !important;
}
.progress-step.done {
    color: #10b981;
    opacity: 1 !important;
}
.progress-step.done i {
    color: #10b981;
}

.btn-share {
    padding: 12px 24px;
    background: var(--primary);
    color: #000;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    font-size: 0.95rem;
    font-family: 'Outfit', sans-serif;
    transition: 0.3s;
}

.btn-share:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(251,191,36,0.3);
}

/* ---- Reconnect Overlay ---- */
.reconnect-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 25;
}

.reconnect-overlay p {
    color: #fb923c;
    font-weight: 700;
    font-size: 1.1rem;
    margin-top: 16px;
}

.btn-exit-call {
    margin-top: 24px;
    padding: 12px 28px;
    border-radius: 30px;
    border: 1px solid rgba(255,255,255,0.25);
    background: rgba(255,255,255,0.08);
    color: #fff;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}
.btn-exit-call:hover {
    background: rgba(255,255,255,0.16);
    border-color: rgba(255,255,255,0.4);
}

/* ---- Ended Overlay (cuando la llamada termina) ---- */
.ended-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 30;
}
.ended-card {
    text-align: center;
    padding: 32px 28px;
    border-radius: 20px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.1);
    max-width: 320px;
    margin: 0 16px;
}
.ended-icon {
    width: 72px; height: 72px;
    margin: 0 auto 20px;
    border-radius: 50%;
    background: rgba(239,68,68,0.15);
    color: #ef4444;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}
.ended-card h2 {
    color: #fff;
    font-size: 1.4rem;
    margin: 0 0 8px;
    font-weight: 700;
}
.ended-card p {
    color: rgba(255,255,255,0.7);
    margin: 0 0 24px;
    font-size: 0.95rem;
    line-height: 1.4;
}

/* ---- Spinner ---- */
.spinner {
    width: 48px; height: 48px;
    border: 4px solid rgba(255,255,255,0.15);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ---- Video Controls ---- */
.video-controls {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 15;
    display: flex;
    flex-wrap: wrap;            /* envuelve si no caben todos en una fila */
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 28px;
    /* Glass real con doble capa + borde sutil para legibilidad sobre
       cualquier fondo de vídeo (claro u oscuro). */
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(16px) saturate(150%);
    -webkit-backdrop-filter: blur(16px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    max-width: calc(100% - 24px); /* nunca más ancho que el container */
    box-sizing: border-box;
}

/* Si el navegador está en modo claro, mantenemos contraste subiendo
   ligeramente la opacidad del fondo para que los iconos blancos se vean. */
@media (prefers-color-scheme: light) {
    .video-controls {
        background: rgba(15, 23, 42, 0.65);
        border-color: rgba(255, 255, 255, 0.18);
    }
}

/* Cuando el container es estrecho (portrait screen-share), reduce el tamaño
   de los botones para que quepan en una sola línea sin comerse ninguno. */
.video-container[style*="width: 4"] .ctrl-btn,
.video-container[style*="width: 3"] .ctrl-btn,
.video-container[style*="width: 2"] .ctrl-btn {
    width: 38px;
    height: 38px;
    font-size: 0.9rem;
}

.ctrl-btn {
    width: 46px; height: 46px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.12);
    color: #fff;
    font-size: 1.05rem;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ctrl-btn:hover {
    background: rgba(255,255,255,0.25);
    transform: scale(1.1);
}

.ctrl-btn.active {
    background: var(--primary);
    color: #1a1a1a;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.25) inset;
}

.ctrl-hangup {
    background: #ef4444 !important;
}

.ctrl-hangup:hover {
    background: #dc2626 !important;
}

/* ---- Source Picker ---- */
.source-options {
    display: flex;
    gap: 12px;
}

.source-opt {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px;
    border-radius: 14px;
    border: 2px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.03);
    cursor: pointer;
    transition: all 0.25s ease;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.source-opt i {
    font-size: 1.4rem;
}

.source-opt:hover {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.15);
}

.source-opt.selected {
    border-color: var(--primary);
    background: rgba(251,191,36,0.08);
    color: var(--primary);
}

/* ---- Chat Panel ---- */
.chat-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: 320px;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    z-index: 30;
    display: flex;
    flex-direction: column;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.chat-header {
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
    transition: color 0.2s;
}

.close-btn:hover {
    color: #fff;
}

.chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-msg {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.9rem;
    line-height: 1.4;
    word-break: break-word;
}

.chat-msg.sent {
    background: var(--primary);
    color: #000;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chat-msg.received {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.chat-input-area {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 10px;
}

#chat-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 10px 14px;
    color: #fff;
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

#chat-input:focus {
    border-color: var(--primary);
}

#btn-send-chat {
    background: var(--primary);
    color: #000;
    border: none;
    border-radius: 10px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
}

#btn-send-chat:hover {
    transform: scale(1.05);
}

/* ---- Responsive ---- */
@media(max-width: 768px) {
    .lobby-card { padding: 32px 20px; }
    .video-container { border-radius: 0; aspect-ratio: auto; height: calc(100vh - 80px); max-width: 100%; }
    #local-video { width: 100px; bottom: 90px; }
    .video-controls { gap: 8px; padding: 8px 14px; }
    .ctrl-btn { width: 44px; height: 44px; font-size: 1rem; }
}

