/* Squid Game Portal — Dark Theme */

:root {
    --bg-primary: #0d0d0d;
    --bg-secondary: #1a1a1a;
    --bg-card: #141414;
    --pink: #ED1B76;
    --pink-glow: rgba(237, 27, 118, 0.3);
    --pink-dark: #b8155e;
    --teal: #00b894;
    --yellow: #FFD700;
    --blue: #2f6fed;
    --text-primary: #e0e0e0;
    --text-secondary: #888;
    --text-dim: #555;
    --border: #333;
    --error: #ff4444;
    --success: #00b894;
    --warning: #f39c12;
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* ─── Squid Game Background ─────────────────────────────────────────────── */

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('/static/squid-bg.png') no-repeat center center fixed;
    background-size: cover;
    opacity: 0.15;
    z-index: 0;
    filter: grayscale(30%) contrast(1.2);
}

body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg,
        rgba(13, 13, 13, 0.85) 0%,
        rgba(13, 13, 13, 0.6) 50%,
        rgba(13, 13, 13, 0.85) 100%
    );
    z-index: 0;
}

/* Scanline overlay — CRT/surveillance feel */
.scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent 0px,
        transparent 2px,
        rgba(237, 27, 118, 0.015) 2px,
        rgba(237, 27, 118, 0.015) 4px
    );
    pointer-events: none;
    z-index: 2;
}

/* Vignette — dark edges, spotlight center */
.vignette {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        ellipse at center,
        transparent 30%,
        rgba(13, 13, 13, 0.6) 80%,
        rgba(13, 13, 13, 0.95) 100%
    );
    pointer-events: none;
    z-index: 2;
}

/* Falling shapes — circle, triangle, square */
.squid-shapes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.squid-shape {
    position: absolute;
    top: -60px;
    opacity: 0;
    animation: fall linear infinite;
}

.squid-shape.circle {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid rgba(237, 27, 118, 0.3);
}

.squid-shape.triangle {
    width: 24px;
    height: 24px;
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
    background: rgba(0, 184, 148, 0.15);
}

.squid-shape.square {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 215, 0, 0.2);
    transform: rotate(45deg);
}

@keyframes fall {
    0% {
        opacity: 0;
        transform: translateY(0) rotate(0deg);
    }
    10% {
        opacity: 0.5;
    }
    90% {
        opacity: 0.5;
    }
    100% {
        opacity: 0;
        transform: translateY(100vh) rotate(360deg);
    }
}

.squid-shape:nth-child(1) { left: 5%; animation-duration: 15s; animation-delay: 0s; }
.squid-shape:nth-child(2) { left: 15%; animation-duration: 20s; animation-delay: 3s; }
.squid-shape:nth-child(3) { left: 25%; animation-duration: 18s; animation-delay: 6s; }
.squid-shape:nth-child(4) { left: 35%; animation-duration: 22s; animation-delay: 1s; }
.squid-shape:nth-child(5) { left: 45%; animation-duration: 16s; animation-delay: 4s; }
.squid-shape:nth-child(6) { left: 55%; animation-duration: 25s; animation-delay: 7s; }
.squid-shape:nth-child(7) { left: 65%; animation-duration: 19s; animation-delay: 2s; }
.squid-shape:nth-child(8) { left: 75%; animation-duration: 21s; animation-delay: 5s; }
.squid-shape:nth-child(9) { left: 85%; animation-duration: 17s; animation-delay: 8s; }
.squid-shape:nth-child(10) { left: 95%; animation-duration: 23s; animation-delay: 3s; }

/* Red light / green light pulse */
.red-light-pulse {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 50% 0%, rgba(237, 27, 118, 0.08), transparent 40%);
    pointer-events: none;
    z-index: 2;
    animation: redLight 8s ease-in-out infinite;
}

@keyframes redLight {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.8; }
}

/* ─── Login Page ────────────────────────────────────────────────────────── */

.login-container {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
    background: rgba(13, 13, 13, 0.6);
    backdrop-filter: blur(2px);
    border-radius: 16px;
    margin: 2rem auto;
    max-width: 440px;
    box-shadow: 0 0 60px rgba(237, 27, 118, 0.1);
    border: 1px solid rgba(237, 27, 118, 0.1);
}

.logo {
    display: flex;
    gap: 12px;
    margin-bottom: 1.5rem;
}

.circle {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 3px solid var(--pink);
    animation: pulse 2s ease-in-out infinite;
}

.circle-1 { animation-delay: 0s; }
.circle-2 { animation-delay: 0.3s; border-radius: 4px; transform: rotate(45deg); }
.circle-3 { animation-delay: 0.6s; clip-path: polygon(50% 0%, 0% 100%, 100% 100%); border: none; background: var(--pink); }

@keyframes pulse {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.1); }
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: 8px;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    letter-spacing: 4px;
    margin-bottom: 2rem;
}

.error {
    background: rgba(255, 68, 68, 0.1);
    border: 1px solid var(--error);
    color: var(--error);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    animation: shake 0.3s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.rate-limit-warning {
    background: rgba(243, 156, 18, 0.1);
    border: 1px solid var(--warning);
    color: var(--warning);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.lock-icon {
    font-size: 1.2rem;
}

.login-form {
    width: 100%;
    max-width: 360px;
}

.input-group {
    position: relative;
    margin-bottom: 1.5rem;
}

.input-group input {
    width: 100%;
    padding: 1rem 0;
    background: transparent;
    border: none;
    border-bottom: 2px solid var(--border);
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
}

.input-group input:focus {
    border-bottom-color: var(--pink);
}

.input-group label {
    position: absolute;
    top: 1rem;
    left: 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
    letter-spacing: 2px;
    pointer-events: none;
    transition: all 0.3s;
}

.input-group input:focus + label,
.input-group input:not(:placeholder-shown) + label {
    top: -0.5rem;
    font-size: 0.7rem;
    color: var(--pink);
    letter-spacing: 1px;
}

.underline {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--pink);
    transition: width 0.3s;
}

.input-group input:focus ~ .underline {
    width: 100%;
}

.password-toggle {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.password-toggle:hover {
    opacity: 1;
}

.remember-row {
    margin-bottom: 1.5rem;
}

.checkbox-container {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.checkbox-container input {
    width: 16px;
    height: 16px;
    accent-color: var(--pink);
}

.btn-login {
    width: 100%;
    padding: 1rem;
    background: transparent;
    border: 2px solid var(--pink);
    color: var(--pink);
    font-size: 0.9rem;
    letter-spacing: 3px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s;
    margin-top: 1rem;
}

.btn-login:hover:not(:disabled) {
    background: var(--pink);
    color: white;
    box-shadow: 0 0 30px var(--pink-glow);
}

.btn-login:disabled {
    border-color: var(--text-dim);
    color: var(--text-dim);
    cursor: not-allowed;
}

.btn-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: var(--pink);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
    opacity: 0.2;
}

.btn-login:active .btn-glow {
    width: 300px;
    height: 300px;
}

.footer {
    margin-top: 2rem;
    color: var(--text-dim);
    font-size: 0.75rem;
    letter-spacing: 2px;
}

/* Background circles */
.bg-circles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.bg-circle {
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(237, 27, 118, 0.08);
}

.bg-circle:nth-child(1) {
    width: 400px;
    height: 400px;
    top: -100px;
    right: -100px;
    animation: float 20s ease-in-out infinite;
}

.bg-circle:nth-child(2) {
    width: 300px;
    height: 300px;
    bottom: -50px;
    left: -50px;
    animation: float 15s ease-in-out infinite reverse;
}

.bg-circle:nth-child(3) {
    width: 200px;
    height: 200px;
    top: 40%;
    left: 60%;
    animation: float 25s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(5deg); }
}

/* ─── Dashboard ─────────────────────────────────────────────────────────── */

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: rgba(26, 26, 26, 0.85);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--pink);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 20px rgba(237, 27, 118, 0.1);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-small {
    font-size: 1.5rem;
}

.topbar-title {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 4px;
    color: var(--text-primary);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-badge {
    color: var(--text-primary);
    font-size: 0.85rem;
    letter-spacing: 1px;
}

.role-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.7rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-weight: 600;
}

.role-badge.user {
    background: rgba(0, 184, 148, 0.2);
    color: var(--teal);
    border: 1px solid var(--teal);
}

.role-badge.admin {
    background: rgba(237, 27, 118, 0.2);
    color: var(--pink);
    border: 1px solid var(--pink);
}

.btn-sessions {
    font-size: 1.2rem;
    text-decoration: none;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.btn-sessions:hover {
    opacity: 1;
}

.btn-logout, .btn-back {
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--text-dim);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.75rem;
    letter-spacing: 2px;
    transition: all 0.3s;
    border-radius: 4px;
}

.btn-logout:hover {
    border-color: var(--error);
    color: var(--error);
}

.btn-back:hover {
    border-color: var(--teal);
    color: var(--teal);
}

.dashboard {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
    z-index: 10;
}

.dashboard h2 {
    font-size: 1.2rem;
    letter-spacing: 4px;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.service-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.service-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    text-decoration: none;
    color: var(--text-primary);
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--pink);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s;
}

.service-card:hover::before {
    transform: scaleX(1);
}

.service-card:hover {
    border-color: var(--pink);
    box-shadow: 0 4px 20px rgba(237, 27, 118, 0.1);
}

.service-card.primary {
    border-color: var(--pink);
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(237, 27, 118, 0.05) 100%);
}

.service-card.primary::before {
    transform: scaleX(1);
}

.service-card.admin {
    border-color: var(--pink-dark);
}

.card-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 2px;
    margin-bottom: 0.5rem;
}

.card-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.card-status {
    font-size: 0.7rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-weight: 600;
}

.card-status.online {
    color: var(--success);
}

.card-status.offline {
    color: var(--error);
}

.card-status.unknown {
    color: var(--text-dim);
}

.card-status.available {
    color: var(--text-dim);
}

.card-status.admin {
    color: var(--pink);
}

.info-panel, .session-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 1rem;
}

.info-panel h3, .session-panel h3 {
    font-size: 0.9rem;
    letter-spacing: 3px;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    color: var(--text-dim);
    font-size: 0.8rem;
    letter-spacing: 1px;
}

.info-value {
    color: var(--text-primary);
    font-size: 0.85rem;
    font-weight: 500;
}

.info-value.mono {
    font-family: monospace;
}

.status-online { color: var(--success); }
.status-offline { color: var(--error); }
.status-unknown { color: var(--text-dim); }

/* ─── Session Management ────────────────────────────────────────────────── */

.session-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.session-card.active {
    border-color: var(--success);
}

.session-icon {
    font-size: 1.5rem;
}

.session-info {
    flex: 1;
}

.session-user {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.session-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    display: flex;
    gap: 8px;
}

.session-current {
    font-size: 0.7rem;
    color: var(--success);
    letter-spacing: 1px;
    font-weight: 600;
}

.session-actions {
    margin-top: 1.5rem;
}

.btn-danger {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: 1px solid var(--error);
    color: var(--error);
    text-decoration: none;
    font-size: 0.85rem;
    letter-spacing: 1px;
    border-radius: 4px;
    transition: all 0.3s;
}

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

/* ─── 2FA ──────────────────────────────────────────────────────────────────── */

.twofa-hint {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.twofa-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 2rem;
    margin-top: 1rem;
    text-align: center;
}

.twofa-panel h3 {
    font-size: 1rem;
    letter-spacing: 3px;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.twofa-info {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.qr-container {
    display: flex;
    justify-content: center;
    margin: 1.5rem 0;
}

.qr-code {
    width: 200px;
    height: 200px;
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 8px;
    background: white;
}

.secret-container {
    margin: 1rem 0;
}

.secret-code {
    display: inline-block;
    background: var(--bg-secondary);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-family: monospace;
    font-size: 1.1rem;
    letter-spacing: 2px;
    color: var(--pink);
    border: 1px solid var(--border);
    user-select: all;
}

.success-msg {
    background: rgba(0, 184, 148, 0.1);
    border: 1px solid var(--success);
    color: var(--success);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

/* ─── Responsive ────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
    h1 { font-size: 1.8rem; letter-spacing: 4px; }
    .service-grid { grid-template-columns: 1fr; }
    .topbar { padding: 0.75rem 1rem; }
    .dashboard { padding: 1rem; }
    .topbar-right { gap: 8px; }
    .user-badge { display: none; }
}
