/* ===============================================================
    VARIABLES BASE
================================================================ */
:root {
    --accent: #007bff;
    --danger: #dc3545;
}


/* ===============================================================
    ESTILO MANTENIMIENTO
================================================================ */

#maintenance-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95); /* Fondo oscuro semitransparente */
    color: white;
    z-index: 10000; /* Asegura que esté encima de todo, incluyendo A-Frame (que usa z-index) */
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    transition: opacity 0.3s ease;
}

#maintenance-box {
    padding: 30px;
    max-width: 80%;
    background: #1a1a1a;
    border-radius: 10px;
    border: 2px solid var(--accent, #FFD700); /* Usa tu color de acento si lo tienes definido */
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
}

#maintenance-box .logo {
  background-color: #ffffff; /* Fondo blanco para contrastar el logo oscuro */
  padding: 12px;             /* Espaciado interno en los cuatro lados */
  border-radius: 8px;        /* Bordes suavemente redondeados (opcional, pero queda muy bien) */
  box-shadow: 0 4px 15px rgba(255, 255, 255, 0.2), /* Brillo claro hacia afuera */
              0 2px 5px rgba(0, 0, 0, 0.1);       /* Pequeña sombra para dar profundidad */
  
  /* Asegura que el logo mantenga una buena proporción */
  display: inline-block;
  max-width: 90%;
  height: auto; 
}

.maintenance-hide {
    display: none !important; /* Clase para ocultarlo cuando no está activo */
}


/* /* ===============================================================
    ESTILO BASE
================================================================ */
body {
    font-family: sans-serif;
    /* Mantener el centrado horizontal y la disposición en columna */
    display: flex; 
    justify-content: center; 
    flex-direction: column; 
    
    /* Nueva lógica de altura: */
    min-height: 100vh; /* Asegura que la altura mínima sea la ventana */
    margin: 0; 
    
    /* Permite que el contenido se alinee a la parte superior */
    align-items: center; 
    
    transition: 0.3s;
}

/* Aplicar la restricción de centrado vertical solo al .container */
.container {
    position: relative; /* 🛠️ ¡ESTA ES LA LÍNEA CLAVE! Convierte a la tarjeta en el límite estricto de la capa flotante */
    padding: 40px; border-radius: 10px; text-align: center;
    width: 90%; max-width: 400px; transition: 0.3s;
    /* Añadir margin-top y margin-bottom automáticos para el centrado */
    margin-top: auto;
    margin-bottom: auto;
}


.theme-selector {
    display: flex;       /* Alinea el label y theme-circles horizontalmente */
    align-items: center; /* Centra verticalmente el texto "Tema" con los círculos */
}

/* ===============================================================
    TEMA CLARO
================================================================ */
.light-theme { background: #f4f4f4; color: #333; }
.light-theme .container { 
    background: white; 
    box-shadow: 0 4px 8px rgba(0,0,0,0.1); 
}
.light-theme button { 
    background: var(--accent); 
    color: white; 
    border: none; /* Consistencia: Aseguramos que el botón general no tenga borde */
}
.light-theme #access-button,
.light-theme .access-btn { 
    background: var(--accent); 
    border: none; 
}
.light-theme .delete-btn { background: var(--danger); border: none; }
.light-theme input { 
    background: white; 
    color: #333; 
    border: 1px solid #ccc; /* Consistencia: Aseguramos borde estándar */
}
.light-theme .logo { 
    /* Consistencia: Valores neutros */
    background: transparent; 
    padding: 15px;
	border-radius: 15px;
    filter: none; 
}
.light-theme .usuarioG { background: #6c757d; color: white; border: none; }
.light-theme .usuarioN { background: #5a7b7a; color: white; border: none; }

.light-theme #qr-open-btn { background: transparent; border: 1px solid #ccc; color: #333;}
.light-theme #qr-open-btn:hover { background: #e6e6e6; }
.light-theme #qr-scanner-container { background-color: rgba(255, 255, 255, 0.95); }
.light-theme #qr-close-btn { background: var(--danger); color: white; border: none; }


/* ===============================================================
    TEMA OSCURO (Se mantiene como estaba)
================================================================ */
.dark-theme { background: #1a1a1a; color: #f4f4f4; }
.dark-theme .container { background: #2c2c2c; box-shadow: 0 4px 8px rgba(0,0,0,0.5); }
.dark-theme button { color: white; border: 1px solid #666; background: #3c3c3c; }
.dark-theme #access-button, 
.dark-theme .access-btn { background: var(--accent); border: none; }
.dark-theme .delete-btn { background: var(--danger); border: none; }
.dark-theme input { background: #3c3c3c; color: white; border: 1px solid #4a4a4a; }
.dark-theme .logo { background: white; padding: 15px; border-radius: 15px; filter: drop-shadow(0 0 5px white); }
.dark-theme .usuarioG { background: #6c757d; border: none; }
.dark-theme .usuarioN { background: #5a7b7a; border: none; }
.dark-theme #qr-open-btn { background: #3c3c3c; border: 1px solid #4a4a4a; color: white; }
.dark-theme #qr-open-btn:hover { background: #4a4a4a; }
.dark-theme #qr-scanner-container { background-color: rgba(44, 44, 44, 0.95); }
.dark-theme #qr-close-btn { background: var(--danger); color: white; border: none; }


/* ===============================================================
    🔵 PALLETAS PERSONALIZADAS (ACTIVADAS)
================================================================ */

/* ---------- PALETA 1 ---------- */
.palette1-theme { background: #f6b51d; color: #333333; }
.palette1-theme .container { background: white; box-shadow: 0 4px 10px rgba(0,0,0,0.2); }
.palette1-theme button { color: #333333; border: none; background: #e6e6e6; }
.palette1-theme #access-button, 
.palette1-theme .access-btn { background: #333333; color: #f6b51d; border: none; }
.palette1-theme .delete-btn { background: var(--danger); color: white; border: none; }
.palette1-theme input { background: white; color: #333333; border: 1px solid #9c6644; }
.palette1-theme .logo { background: transparent; padding: 15px; border-radius: 15px; filter: none; }
.palette1-theme .usuarioG { background: #9c6644; color: white; border: none; }
.palette1-theme .usuarioN { background: #7a7a7a; color: white; border: none; }
.palette1-theme #qr-open-btn { background: #e6e6e6; border: 1px solid #9c6644; color: #333333; }
.palette1-theme #qr-open-btn:hover { background: #d4d4d4; }
.palette1-theme #qr-scanner-container { background-color: rgba(255, 255, 255, 0.95); }
.palette1-theme #qr-close-btn { background: var(--danger); color: white; border: none; }


/* ---------- PALETA 2 ---------- */
.palette2-theme { background: #252626; color: #f0f0f0; }
.palette2-theme .container { background: #333333; box-shadow: 0 4px 8px rgba(0,0,0,0.5); }
.palette2-theme button { color: #f0f0f0; border: 1px solid #4a4a4a; background: #3c3c3c; }
.palette2-theme #access-button, 
.palette2-theme .access-btn { background: #f6b51d; color: #040404; border: none; }
.palette2-theme .delete-btn {  background: var(--danger); border: none; }
.palette2-theme input { background: #3c3c3c; color: #f0f0f0; border: 1px solid #4a4a4a; }
.palette2-theme .logo { background: white; padding: 15px; border-radius: 15px; filter: drop-shadow(0 0 5px white); }
.palette2-theme .usuarioG { background: #4a4a4a; border: none; }
.palette2-theme .usuarioN { background: #594c34; border: none; }
.palette2-theme #qr-open-btn { background: #3c3c3c; border: 1px solid #4a4a4a; color: #f0f0f0; }
.palette2-theme #qr-open-btn:hover { background: #4a4a4a; }
.palette2-theme #qr-scanner-container { background-color: rgba(51, 51, 51, 0.95); }
.palette2-theme #qr-close-btn { background: var(--danger); color: white; border: none; }


/* ---------- PALETA 3 ---------- */
.palette3-theme { background: #1a1a1a; color: #f0f0f0; }
.palette3-theme .container { background: #333333; box-shadow: 0 4px 8px rgba(0,0,0,0.5); }
.palette3-theme button { color: #f0f0f0; border: 1px solid #666666; background: #4a4a4a; }
.palette3-theme #access-button, .palette3-theme .access-btn { background: #286820; color: white; border: none; }
.palette3-theme .delete-btn { background: #007f5f; color: white; border: none; }
.palette3-theme input { background: #3c3c3c; color: #f0f0f0; border: 1px solid #e71d36; }
.palette3-theme .logo { background: white; padding: 15px; border-radius: 15px; filter: drop-shadow(0 0 5px #e71d36); }
.palette3-theme .usuarioG { background: #007f5f; color: white; border: none; }
.palette3-theme .usuarioN { background: #f6b51d; color: #000000; border: none; }
.palette3-theme #qr-open-btn { background: #4a4a4a; border: 1px solid #e71d36; color: #f0f0f0; }
.palette3-theme #qr-open-btn:hover { background: #5a5a5a; }
.palette3-theme #qr-scanner-container { background-color: rgba(51, 51, 51, 0.95); }
.palette3-theme #qr-close-btn { background: #007f5f; color: white; border: none; }


/* ---------- PALETA 4 ---------- */
.palette4-theme { background: #3e3025; color: #f8f4e3; }
.palette4-theme .container { background: #4e3b2e; box-shadow: 0 4px 12px rgba(0,0,0,0.7); }
.palette4-theme button { color: #f8f4e3; border: none; background: #604e42; }
.palette4-theme #access-button, .palette4-theme .access-btn { background: #48cae4; color: #1a1a1a; border: none; }
.palette4-theme .delete-btn { background: var(--danger); color: white; border: none; }
.palette4-theme input { background: #604e42; color: #f8f4e3; border: 1px solid #48cae4; }
.palette4-theme .logo { background: white; padding: 15px; border-radius: 15px; filter: drop-shadow(0 0 8px #48cae4); }
.palette4-theme .usuarioG { background: #604e42; color: #f8f4e3; border: none; }
.palette4-theme .usuarioN { background: #48cae4; color: #1a1a1a; border: none; }
.palette4-theme #qr-open-btn { background: #604e42; border: 1px solid #48cae4; color: #f8f4e3; }
.palette4-theme #qr-open-btn:hover { background: #735f51; }
.palette4-theme #qr-scanner-container { background-color: rgba(78, 59, 46, 0.95); }
.palette4-theme #qr-close-btn { background: var(--danger); color: white; border: none; }


/* ---------- PALETA 5 ---------- */
.palette5-theme { background: #ffe6e6; color: #663333; }
.palette5-theme .container { background: white; box-shadow: 0 0 10px rgba(0,0,0,0.1); }
.palette5-theme button { background: #ff9999; color: #663333; border: none; }
.palette5-theme #access-button,
.palette5-theme .access-btn { background: #ff9999; border: none; }
.palette5-theme .delete-btn { background: var(--danger); color: white; border: none; }
.palette5-theme input { background: white; color: #663333; border: 1px solid #ccc; }
.palette5-theme .logo { background: transparent; padding: 15px; border-radius: 15px; filter: none; }
.palette5-theme .usuarioG { background: #6c757d; color: white; border: none; }
.palette5-theme .usuarioN { background: #ff7777; color: white; border: none; } /* Color independiente adaptado */
.palette5-theme #qr-open-btn { background: white; border: 1px solid #ccc; color: #663333; }
.palette5-theme #qr-open-btn:hover { background: #ffe6e6; }
.palette5-theme #qr-scanner-container { background-color: rgba(255, 255, 255, 0.95); }
.palette5-theme #qr-close-btn { background: var(--danger); color: white; border: none; }



/* ---------- PALETA 6 ---------- */
.palette6-theme { background: #e8f5e9; color: #1b5e20; } /* Tonos menta y verde hoja */
.palette6-theme .container { background: #ffffff; box-shadow: 0 4px 10px rgba(0,0,0,0.05); }
.palette6-theme button { background: #c8e6c9; color: #1b5e20; border: none; }
.palette6-theme #access-button, 
.palette6-theme .access-btn { background: #4caf50; color: white; border: none; }
.palette6-theme .delete-btn { background: #e53935; color: white; border: none; }
.palette6-theme input { background: #ffffff; color: #1b5e20; border: 1px solid #a5d6a7; }
.palette6-theme .logo { background: transparent; padding: 15px; filter: none; }
.palette6-theme .usuarioG { background: #81c784; color: white; border: none; }
.palette6-theme .usuarioN { background: #a5d6a7; color: #1b5e20; border: none; }
.palette6-theme #qr-open-btn { background: white; border: 1px solid #a5d6a7; color: #1b5e20; }
.palette6-theme #qr-open-btn:hover { background: #c8e6c9; }
.palette6-theme #qr-scanner-container { background-color: rgba(232, 245, 233, 0.95); }
.palette6-theme #qr-close-btn { background: #e53935; color: white; border: none; }



/* ===============================================================
    ELEMENTOS COMUNES
================================================================ */
label { display: block; text-align: left; margin-top: 10px; font-weight: bold; }
input { padding: 10px; margin: 5px 0 15px; border-radius: 5px; width: calc(100% - 20px); font-size: 16px; border: 1px solid #ccc; }
button { padding: 10px 20px; border: none; border-radius: 5px; cursor: pointer; font-size: 16px; margin-top: 5px; }
#error-message { color: red; margin-top: 10px; display: none; }
.logo { margin-bottom: 20px; max-width: 150px; }

/* ===============================================================
    SELECTOR DE TEMA
================================================================ */
.theme-selector { position: fixed; bottom: 15px; right: 15px; text-align: center; }
.theme-selector select { display: none; }
.theme-circles { display: flex; gap: 12px; margin-top: 8px; }
.circle { width: 22px; height: 22px; border-radius: 50%; cursor: pointer; transition: 0.2s; border: 1px solid #aaa; }
.circle:hover, .circle.active { transform: scale(1.3); box-shadow: 0 0 8px white; }

/* Círculos visibles */
.circle[data-value="auto"] { background: linear-gradient(135deg, #000 50%, #fff 50%); }
.circle[data-value="light"] { background: #fff; }
.circle[data-value="dark"] { background: #000; }

/* PARA ACTIVAR PALETAS, DESCOMENTA ESTOS: */

.circle[data-value="palette1"] { background: linear-gradient(135deg, #ffffff 50%, #f6b51d 50%); }
.circle[data-value="palette2"] { background: linear-gradient(135deg, #333333 50%, #f6b51d 50%); }
.circle[data-value="palette3"] { background: linear-gradient(135deg, #286820 50%, #e71d36 50%); }
.circle[data-value="palette4"] { background: #3e3025; }
.circle[data-value="palette5"] { background: #ff9999; }
.circle[data-value="palette6"] { background: linear-gradient(135deg, #e8f5e9 50%, #1b5e20 50%); }



/* ===============================================================
    USUARIOS GUARDADOS — ESTILO ORIGINAL RESTAURADO
================================================================ */
.project-selection-item {
    border: 1px solid #ccc;
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 5px;
    text-align: left;
    /*background: white;
    color: black;*/
}

.selection-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

/* Botón "Usuarios Guardados" (Se mantiene independiente) */
.usuarioG {
    background: #6c757d;
    color: white;
    border: none;
}

/* Botón "Nuevo Usuario" (Se mantiene independiente) */
.usuarioN {
    background: #5a7b7a; 
    color: white;
    margin-top: 20px !important;
    border: none;
}



/* ===============================================================
    TOOLTIP MODERNO EN LOS CÍRCULOS DE TEMA
================================================================ */

.circle::after {
    content: attr(data-title);
    position: absolute;
    top: -32px;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 9px;
    font-size: 11px;
    background: rgba(0, 0, 0, 0.75);
    color: white;
    border-radius: 6px;
    opacity: 0;
    pointer-events: none;
    white-space: nowrap;
    transition: opacity 0.25s ease;
}

.circle.show-tooltip::after {
    opacity: 1;
}

/* ===============================================================
    INTEGRACIÓN DEL LECTOR QR INTERFAZ FLOTANTE (OVERLAY)
================================================================ */

/* Contenedor flex para alinear input y botón QR */
.input-qr-group {
    display: flex;
    gap: 8px;
    align-items: center;
    margin: 5px 0 15px;
}
.input-qr-group input {
    margin: 0;
    width: 100%;
}

/* Botón del icono QR */
#qr-open-btn {
    margin: 0;
    padding: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    width: 45px;
    border-radius: 5px;
    cursor: pointer;
    transition: transform 0.2s, background-color 0.3s, color 0.3s, border-color 0.3s;
	overflow: hidden; /* Corta el exceso vertical de la animación */
    /*-webkit-tap-highlight-color: transparent;*/
}
#qr-open-btn:hover {
    transform: scale(1.05);
	padding: 5px;
}


/* 🔵 Capa Superpuesta: Cubre todo el .container de forma exacta */
#qr-scanner-container {
    position: absolute;
    /* Al definir los 4 lados en 0, forzamos al contenedor a cubrir el 100% exacto */
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;    
    border-radius: 10px; /* Clona el radio de tu tarjeta */
    z-index: 100;        /* Se posiciona por encima de los inputs y botones */
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px); /* Efecto moderno de desenfoque de fondo */
}

/* Caja de contenido interno del escáner */
.qr-overlay-content {
    width: 90%;
    max-width: 300px;
    text-align: center;
}
.qr-overlay-content h3 {
    margin: 0 0 5px 0;
}
.qr-overlay-content p {
    font-size: 13px;
    margin: 0 0 20px 0;
    opacity: 0.8;
}

/* Ventana de enfoque del QR */
.qr-window {
    position: relative;
    width: 240px;
    height: 240px;
    margin: 0 auto 20px;
    border-radius: 12px;
    overflow: hidden;
    border: 3px solid var(--accent, #007bff);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
    background: #000;
}

/* Renderizado del video */
#qr-video-target {
    width: 100% !important;
    height: 100% !important;
}
#qr-video-target video {
    object-fit: cover;
    width: 100% !important;
    height: 100% !important;
}

/* Animación Láser */
.qr-laser-line {
    position: absolute;
    top: 0;
    left: 5%;
    width: 90%;
    height: 3px;
    background: var(--accent, #007bff);
    box-shadow: 0 0 8px var(--accent, #007bff);
    z-index: 10;
    animation: scanAnimation 2s linear infinite;
    pointer-events: none;
}
@keyframes scanAnimation {
    0% { top: 0%; }
    50% { top: 100%; }
    100% { top: 0%; }
}

/* Botón de regreso */
#qr-close-btn {
    background: var(--danger);
    color: white;
    font-size: 14px;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    width: 100%;
}

/* Estilo base para las 4 esquinas decorativas */
.qr-corner {
    position: absolute;
    width: 20px;   /* Largo de la línea de la esquina */
    height: 20px;  /* Alto de la línea de la esquina */
    border-color: var(--accent, #007bff); /* Color dinámico de tus paletas */
    border-style: solid;
    border-width: 0; /* Inicializamos en 0 para activar solo los lados necesarios */
    z-index: 20;     /* Por encima del video y del láser */
    pointer-events: none; /* Evita interferencias con el video */
}

/* Posicionamiento y activación de bordes específicos para cada esquina */
.qr-corner.top-left {
    top: 15px;
    left: 15px;
    border-top-width: 4px;
    border-left-width: 4px;
    border-top-left-radius: 6px;
}

.qr-corner.top-right {
    top: 15px;
    right: 15px;
    border-top-width: 4px;
    border-right-width: 4px;
    border-top-right-radius: 6px;
}

.qr-corner.bottom-left {
    bottom: 15px;
    left: 15px;
    border-bottom-width: 4px;
    border-left-width: 4px;
    border-bottom-left-radius: 6px;
}

.qr-corner.bottom-right {
    bottom: 15px;
    right: 15px;
    border-bottom-width: 4px;
    border-right-width: 4px;
    border-bottom-right-radius: 6px;
}
