/*
 * CmgA — Login "Apagador Inteligente"
 * Todo lo que hay en esta hoja pertenece EXCLUSIVAMENTE al index.php de la
 * carpeta raíz (carpeta /index/: css, js, fonts). No lo reutilices en otros
 * subproyectos del servidor.
 */

@import url('../fonts/fonts.css');

:root {
    --gold: #e6c27a;
    --gold-soft: #f6d68a;
    --gold-glow: rgba(230, 194, 122, 0.5);
    --bg-color: #030305;
    --glass-bg: rgba(15, 15, 20, 0.45);
    --glass-border: rgba(230, 194, 122, 0.15);
    --panel-dark: #1b1c20;
    --panel-darker: #0e0e11;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    min-height: 100dvh;
}

body {
    background-color: var(--bg-color);
    background-image:
        radial-gradient(circle at 50% 0%, #15120a 0%, var(--bg-color) 60%),
        linear-gradient(0deg, rgba(230,194,122,0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(230,194,122,0.03) 1px, transparent 1px);
    background-size: 100% 100%, 40px 40px, 40px 40px;
    font-family: 'Rajdhani', sans-serif;
    color: #ffffff;
    overflow-x: hidden;
}

/* ============ ESCENA (apagador + tarjeta) ============ */

.scene {
    position: relative;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(24px, 8vw, 110px);
    flex-wrap: wrap;
    padding: 60px 20px;
}

/* ============ APAGADOR INTELIGENTE ============ */

.switch-wrap {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    flex-shrink: 0;
}

/* Halo de luz ambiental que se expande al encender, anclado al apagador */
.switch-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: min(820px, 130vw);
    height: min(820px, 130vw);
    transform: translate(-50%, -50%) scale(0.4);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 246, 224, 0.85) 0%, rgba(255, 214, 130, 0.28) 30%, rgba(255, 214, 130, 0.08) 52%, transparent 70%);
    opacity: 0;
    filter: blur(2px);
    transition: opacity 1.1s ease, transform 1.3s ease;
    pointer-events: none;
    z-index: 0;
}

.scene.is-on .switch-glow {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* placa exterior tipo panel de vidrio/metal */
.power-switch {
    position: relative;
    z-index: 2;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.07);
    background:
        radial-gradient(circle at 32% 26%, rgba(255,255,255,0.06), transparent 45%),
        radial-gradient(circle at 50% 50%, var(--panel-dark) 0%, var(--panel-darker) 78%);
    box-shadow:
        0 20px 45px rgba(0, 0, 0, 0.55),
        inset 0 1px 1px rgba(255, 255, 255, 0.08),
        inset 0 -8px 16px rgba(0, 0, 0, 0.55);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: box-shadow 0.9s ease, transform 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.power-switch:active {
    transform: scale(0.96);
}

.power-switch:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 6px;
}

/* anillo de brillo que aparece encendido */
.power-ring {
    position: absolute;
    inset: -7px;
    border-radius: 50%;
    border: 1px solid rgba(230, 194, 122, 0.5);
    box-shadow: 0 0 0 rgba(230, 194, 122, 0);
    opacity: 0;
    transition: opacity 0.8s ease;
    pointer-events: none;
}

.scene.is-on .power-ring {
    opacity: 1;
    animation: ring-breathe 3.2s ease-in-out infinite;
}

@keyframes ring-breathe {
    0%, 100% { box-shadow: 0 0 18px 2px rgba(230, 194, 122, 0.55); }
    50%      { box-shadow: 0 0 32px 8px rgba(230, 194, 122, 0.85); }
}

/* núcleo circular con el icono de encendido */
.power-core {
    position: relative;
    width: 96px;
    height: 96px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #2a2b30 0%, #17181b 100%);
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.06), inset 0 -4px 10px rgba(0, 0, 0, 0.6);
    transition: background 0.9s ease, box-shadow 0.9s ease;
}

.scene.is-on .power-core {
    background: linear-gradient(180deg, #fffaec 0%, #ffedbb 55%, #f3ce85 100%);
    box-shadow:
        inset 0 2px 4px rgba(255, 255, 255, 0.6),
        inset 0 -4px 10px rgba(180, 130, 40, 0.35),
        0 0 40px 6px rgba(255, 214, 130, 0.75);
}

.power-icon {
    width: 38px;
    height: 38px;
    color: rgba(255, 255, 255, 0.4);
    transition: color 0.9s ease, filter 0.9s ease;
}

.scene.is-on .power-icon {
    color: #4a3512;
    filter: drop-shadow(0 0 6px rgba(255, 244, 214, 0.8));
}

/* led de estado en la base de la placa */
.status-dot {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #5a2a2a;
    box-shadow: 0 0 6px rgba(200, 60, 60, 0.6);
    transition: background 0.6s ease, box-shadow 0.6s ease;
}

.scene.is-on .status-dot {
    background: #b7ff9a;
    box-shadow: 0 0 10px 2px rgba(150, 255, 120, 0.85);
}

/* onda expansiva al tocar el apagador */
.power-pulse {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    pointer-events: none;
}

.power-switch.pulsing .power-pulse::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid var(--gold-soft);
    animation: pulse-ripple 0.7s ease-out;
}

@keyframes pulse-ripple {
    0%   { transform: scale(0.85); opacity: 0.8; }
    100% { transform: scale(1.5); opacity: 0; }
}

.switch-hint {
    font-size: 0.75rem;
    letter-spacing: 1.5px;
    color: rgba(255, 255, 255, 0.35);
    text-transform: uppercase;
    transition: opacity 0.6s ease;
    pointer-events: none;
}

.switch-hint.hidden {
    opacity: 0;
}

/* ============ TARJETA DE LOGIN ============ */
/* Totalmente invisible y fuera de alcance mientras el apagador está apagado;
   solo se revela (fade-in) cuando se enciende. */

.login-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 400px;
    padding: 1px;
    background: linear-gradient(135deg, rgba(230,194,122,0.6) 0%, transparent 30%, transparent 70%, rgba(230,194,122,0.6) 100%);
    border-radius: 20px;
    box-shadow: 0 0 0 rgba(0,0,0,0);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.9s ease, box-shadow 0.9s ease, visibility 0s linear 0.9s, max-width 0.4s ease;
}

.scene.is-on .login-container {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    box-shadow: 0 0 55px rgba(0,0,0,0.75), 0 0 35px var(--gold-glow);
    transition: opacity 0.9s ease, box-shadow 0.9s ease, visibility 0s linear 0s, max-width 0.4s ease;
}

/* Panel de carpetas (post-login): mismo estilo de tarjeta pero más ancho
   para acomodar la cuadrícula de directorios. */
.login-container.is-panel {
    max-width: 880px;
}

.login-box {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 19px;
    padding: 38px 34px;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

h2 {
    font-family: 'Orbitron', sans-serif;
    margin: 0;
    font-size: 1.6rem;
    text-align: center;
    color: var(--gold);
    text-shadow: 0 0 15px var(--gold-glow);
    letter-spacing: 3px;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 0.78rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
}

.input-group input {
    width: 100%;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(230, 194, 122, 0.2);
    border-radius: 14px;
    color: #ffffff;
    font-size: 1.05rem;
    font-family: 'Rajdhani', sans-serif;
    outline: none;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.35);
    transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.input-group input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.input-group input:focus {
    border-color: var(--gold);
    background: rgba(230, 194, 122, 0.08);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.35), 0 0 18px rgba(230, 194, 122, 0.25);
}

/* Evita el fondo blanco/amarillo del autocompletado del navegador sin
   desactivar el autoguardado: el dato sigue ahí, solo se re-pinta con nuestro
   propio color oscuro. */
.input-group input:-webkit-autofill,
.input-group input:-webkit-autofill:hover,
.input-group input:-webkit-autofill:focus,
.input-group input:-webkit-autofill:active,
.input-group input:autofill {
    -webkit-text-fill-color: #ffffff;
    caret-color: #ffffff;
    border-color: rgba(230, 194, 122, 0.35);
    -webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.35), 0 0 0 1000px rgba(22, 20, 15, 0.95) inset;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.35), 0 0 0 1000px rgba(22, 20, 15, 0.95) inset;
    transition: background-color 9999s ease-in-out 0s, color 9999s ease-in-out 0s;
}

button, .btn-link {
    padding: 14px;
    background: linear-gradient(135deg, #f3d999, var(--gold) 55%, #c89a4d);
    border: none;
    border-radius: 10px;
    color: #241c0c;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    text-decoration: none;
    display: block;
    box-sizing: border-box;
}

button:hover, .btn-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px var(--gold-glow);
}

.error-message {
    color: #ff3366;
    text-align: center;
    font-size: 1rem;
    font-weight: 600;
    text-shadow: 0 0 10px rgba(255, 51, 102, 0.5);
}

/* ============ PANEL DE CARPETAS (post-login) ============ */

.panel-status {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 0.8rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.45);
    margin-top: -10px;
}

.status-pulse-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #8fffa0;
    box-shadow: 0 0 8px 2px rgba(140, 255, 150, 0.7);
    animation: ring-breathe-dot 2.4s ease-in-out infinite;
}

@keyframes ring-breathe-dot {
    0%, 100% { opacity: 0.55; transform: scale(0.85); }
    50%      { opacity: 1; transform: scale(1.15); }
}

/* Sin caja de scroll interno: el listado crece con la página y, si hace
   falta, el scroll lo maneja el navegador, no este contenedor. */
.folder-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
}

.folder-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding: 20px 18px;
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.01));
    border: 1px solid rgba(230, 194, 122, 0.18);
    border-radius: 14px;
    color: #ffffff;
    text-decoration: none;
    overflow: hidden;
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

/* esquinas estilo HUD que se marcan al pasar el cursor */
.folder-item::before,
.folder-item::after {
    content: "";
    position: absolute;
    width: 14px;
    height: 14px;
    border: 2px solid var(--gold);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.folder-item::before { top: 7px; left: 7px; border-right: none; border-bottom: none; }
.folder-item::after  { bottom: 7px; right: 7px; border-left: none; border-top: none; }

.folder-item:hover::before,
.folder-item:hover::after {
    opacity: 1;
}

/* destello que recorre la tarjeta al pasar el cursor */
.folder-shine {
    position: absolute;
    top: 0;
    left: -60%;
    width: 40%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.10), transparent);
    transform: skewX(-20deg);
    transition: left 0.6s ease;
    pointer-events: none;
}

.folder-item:hover .folder-shine {
    left: 130%;
}

.folder-item:hover {
    transform: translateY(-4px);
    border-color: var(--gold);
    background: linear-gradient(160deg, rgba(230, 194, 122, 0.09), rgba(230, 194, 122, 0.02));
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35), 0 0 22px rgba(230, 194, 122, 0.18);
}

.folder-icon-wrap {
    width: 42px;
    height: 42px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(230, 194, 122, 0.08);
    border: 1px solid rgba(230, 194, 122, 0.28);
    color: var(--gold);
    transition: box-shadow 0.3s ease;
}

.folder-icon-wrap svg {
    width: 20px;
    height: 20px;
}

.folder-item:hover .folder-icon-wrap {
    box-shadow: 0 0 16px rgba(230, 194, 122, 0.35);
}

.folder-name {
    font-size: 0.95rem;
    letter-spacing: 0.3px;
    word-break: break-word;
}

.folder-index {
    position: absolute;
    top: 18px;
    right: 18px;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.65rem;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.22);
}

.folder-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: rgba(255, 255, 255, 0.4);
    padding: 30px 10px;
    letter-spacing: 1px;
}

.panel-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.panel-actions .btn-link {
    flex: 1;
    min-width: 180px;
}

.logout-btn {
    background: transparent;
    border: 1px solid #ff3366;
    color: #ff3366;
    font-size: 0.8rem;
    padding: 12px;
}

.logout-btn:hover {
    background: rgba(255, 51, 102, 0.1);
    box-shadow: 0 0 15px rgba(255, 51, 102, 0.3);
}

.reboot-btn {
    background: transparent;
    border: 1px solid #ff9900;
    color: #ff9900;
    font-size: 0.8rem;
    padding: 12px;
}

.reboot-btn:hover {
    background: rgba(255, 153, 0, 0.1);
    box-shadow: 0 0 15px rgba(255, 153, 0, 0.3);
}

/* ============ RESPONSIVE ============ */

@media (max-width: 640px) {
    .scene {
        gap: 14px;
        padding: 24px 16px 32px;
    }
    .switch-wrap { gap: 10px; }
    .power-switch { width: 108px; height: 108px; }
    .power-core { width: 70px; height: 70px; }
    .power-icon { width: 28px; height: 28px; }
    .login-container { max-width: 100%; }
    .login-box { padding: 28px 22px; gap: 18px; }
    .input-group input { padding: 12px 14px; }
    h2 { font-size: 1.4rem; }
    .folder-list { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
    .panel-actions .btn-link { min-width: 100%; }
}
