/* [METADATA]
   File: captive_portal_instant-on/style.css
   Version: 3.0.0 - Singularity Explosion
*/

/* [COMMENT] ========== CORE & RESET ========== */
* { box-sizing: border-box; margin: 0; padding: 0; outline: none; -webkit-tap-highlight-color: transparent; }

:root {
    --tech-bg: #050505;
    --tech-panel: rgba(10, 15, 20, 0.95);
    --tech-cyan: #00F3FF;
    --tech-green: #00FF9D;
    --tech-font: "Courier New", monospace;
    --ease-elastic: cubic-bezier(0.68, -0.55, 0.265, 1.55);
    --ease-expo: cubic-bezier(0.19, 1, 0.22, 1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background-color: var(--tech-bg);
    height: 100vh;
    display: flex; align-items: center; justify-content: center;
    color: #FFF; overflow: hidden; position: relative;
}

/* [FEATURE] Background Particles */
#tech-canvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 0; }

/* [FEATURE] Gate Overlay (Hiệu ứng mở cổng lúc đầu) */
.gate-overlay {
    position: fixed; inset: 0; z-index: 999; pointer-events: none; display: flex;
}
.gate-panel {
    width: 50%; height: 100%; background: #000; position: relative;
    border-right: 1px solid var(--tech-cyan);
    transition: transform 1.5s cubic-bezier(0.8, 0, 0.2, 1);
}
.gate-panel.right { border-right: none; border-left: 1px solid var(--tech-cyan); }
/* Gate Open State */
body.gate-open .gate-panel.left { transform: translateX(-100%); }
body.gate-open .gate-panel.right { transform: translateX(100%); }

/* [UI] Main Card Container */
.portal-card {
    background-color: var(--tech-panel);
    width: 90%; max-width: 400px; padding: 0; /* Padding handled by internal containers */
    border: 1px solid rgba(0, 243, 255, 0.2);
    box-shadow: 0 0 30px rgba(0, 243, 255, 0.05);
    border-radius: 4px; text-align: center; position: relative; z-index: 10;
    overflow: hidden; /* Quan trọng để cắt viền khi morph */
    
    /* Animation Variables */
    transition: all 0.6s var(--ease-expo);
    
    /* Init Animation */
    opacity: 0; transform: scale(0.9);
    animation: hud-appear 1s var(--ease-expo) forwards 0.5s;
}

@keyframes hud-appear { to { opacity: 1; transform: scale(1); } }

/* [STATE] 1. Scanning Phase (Gom lại thành hình tròn) */
.portal-card.is-scanning {
    width: 120px; height: 120px; /* Kích thước lõi */
    border-radius: 50%;
    border-color: var(--tech-cyan);
    background: #000;
    box-shadow: 0 0 40px var(--tech-cyan), inset 0 0 30px rgba(0, 243, 255, 0.2);
    /* Override layout */
    max-width: 120px; 
    display: flex; align-items: center; justify-content: center;
}

/* Ẩn nội dung cũ ngay lập tức */
.portal-card.is-scanning .card-content {
    opacity: 0; transform: scale(0.8); pointer-events: none;
}

/* Hiện Scanner */
.scanner-loader {
    position: absolute; inset: 0;
    opacity: 0; pointer-events: none;
    display: flex; align-items: center; justify-content: center;
    transition: opacity 0.3s ease 0.3s; /* Hiện sau khi card co lại */
}
.portal-card.is-scanning .scanner-loader { opacity: 1; }

/* Vòng xoay Scanner */
.scan-ring {
    position: absolute; border-radius: 50%;
    border: 2px solid transparent;
}
.scan-ring:nth-child(1) {
    width: 100%; height: 100%; 
    border-top-color: var(--tech-cyan); border-left-color: var(--tech-cyan);
    animation: spin 1.5s linear infinite;
    filter: drop-shadow(0 0 5px var(--tech-cyan));
}
.scan-ring:nth-child(2) {
    width: 70%; height: 70%; 
    border-bottom-color: #FFF; border-right-color: #FFF;
    animation: spin 1s reverse linear infinite;
    opacity: 0.5;
}
.scan-core {
    width: 10px; height: 10px; background: #FFF; border-radius: 50%;
    box-shadow: 0 0 20px #FFF;
    animation: pulse 0.8s ease-in-out infinite alternate;
}

/* [STATE] 2. Success Phase (Big Bang Explosion) */
.portal-card.is-success {
    /* Animation "Big Bang" */
    animation: big-bang 1.2s cubic-bezier(0.7, 0, 0.3, 1) forwards;
    
    /* Đổi màu lõi trước khi nổ */
    background: #FFF;
    border-color: #FFF;
    box-shadow: 0 0 100px #FFF;
}

/* Hiệu ứng bùng nổ */
@keyframes big-bang {
    0% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
        border-radius: 50%;
    }
    30% {
        /* [Anticipation] Co lại một chút để lấy đà */
        transform: scale(0.6) rotate(-45deg); 
        opacity: 1;
        background: var(--tech-cyan);
        box-shadow: 0 0 100px var(--tech-cyan);
    }
    100% {
        /* [Explosion] Bung cực đại */
        transform: scale(80); /* Phủ kín màn hình */
        opacity: 0; /* Fade out dần khi người dùng "bay xuyên qua" */
        background: #FFF;
        border-radius: 50%;
    }
}

/* [UI] Nội dung bên trong */
.card-content { 
    padding: 40px; 
    transition: all 0.4s ease;
    width: 100%;
}

.icon-wifi { width: 64px; height: 64px; margin: 0 auto 20px; color: var(--tech-cyan); }
.wifi-path { fill: none; stroke: currentColor; stroke-width: 2; opacity: 0.3; }
.wifi-path.active { opacity: 1; animation: signal 2s infinite; }
.wifi-path:nth-child(1) { animation-delay: 0s; }
.wifi-path:nth-child(2) { animation-delay: 0.3s; }
.wifi-path:nth-child(3) { animation-delay: 0.6s; }

h1 { color: var(--tech-cyan); font-family: var(--tech-font); font-size: 22px; margin-bottom: 8px; letter-spacing: 2px; }
p { color: #8899A6; font-size: 13px; margin-bottom: 30px; line-height: 1.5; }

.btn-connect {
    width: 100%; padding: 16px; background: rgba(0, 243, 255, 0.05); color: var(--tech-cyan);
    border: 1px solid var(--tech-cyan); font-family: var(--tech-font); font-weight: bold;
    cursor: pointer; position: relative; overflow: hidden; letter-spacing: 2px;
    transition: all 0.3s;
    clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}
.btn-connect:hover { 
    background: var(--tech-cyan); color: #000; 
    box-shadow: 0 0 30px var(--tech-cyan);
}

.footer-info { margin-top: 25px; font-size: 10px; color: #444; font-family: var(--tech-font); }

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes pulse { 0% { transform: scale(1); opacity: 0.8; } 100% { transform: scale(1.5); opacity: 1; } }
@keyframes signal { 50% { opacity: 1; stroke-width: 3; filter: drop-shadow(0 0 5px var(--tech-cyan)); } }