/* =============================================
   Login & Auth Pages
   ============================================= */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-space);
    position: relative;
    overflow: hidden;
}

/* Animated network cables background */
.network-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.network-bg .cable {
    position: absolute;
    width: 2px;
    background: linear-gradient(180deg, transparent, var(--blue-glow), transparent);
    opacity: 0.3;
    animation: cableFlow 4s linear infinite;
}

.network-bg .cable:nth-child(1) {
    left: 10%;
    height: 60%;
    top: 20%;
    animation-delay: 0s;
}

.network-bg .cable:nth-child(2) {
    left: 25%;
    height: 80%;
    top: 10%;
    animation-delay: 0.8s;
}

.network-bg .cable:nth-child(3) {
    left: 40%;
    height: 50%;
    top: 30%;
    animation-delay: 1.6s;
}

.network-bg .cable:nth-child(4) {
    left: 60%;
    height: 70%;
    top: 15%;
    animation-delay: 0.4s;
}

.network-bg .cable:nth-child(5) {
    left: 75%;
    height: 55%;
    top: 25%;
    animation-delay: 1.2s;
}

.network-bg .cable:nth-child(6) {
    left: 90%;
    height: 65%;
    top: 20%;
    animation-delay: 2s;
}

@keyframes cableFlow {
    0% {
        background-position: 0 -100%;
    }

    100% {
        background-position: 0 200%;
    }
}

/* Floating device icons */
.floating-device {
    position: absolute;
    font-size: 2rem;
    opacity: 0.15;
    animation: floatDevice 8s ease-in-out infinite;
}

.floating-device:nth-child(1) {
    top: 15%;
    left: 8%;
    animation-delay: 0s;
}

.floating-device:nth-child(2) {
    top: 70%;
    left: 15%;
    animation-delay: 2s;
}

.floating-device:nth-child(3) {
    top: 20%;
    right: 12%;
    animation-delay: 4s;
}

.floating-device:nth-child(4) {
    top: 65%;
    right: 8%;
    animation-delay: 1s;
}

.floating-device:nth-child(5) {
    top: 40%;
    left: 5%;
    animation-delay: 3s;
}

@keyframes floatDevice {

    0%,
    100% {
        transform: translateY(0) rotate(0deg);
    }

    50% {
        transform: translateY(-20px) rotate(5deg);
    }
}

/* Login Panel — Terminal retro style */
.login-panel {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 440px;
    margin: 20px;
}

.login-card {
    background: rgba(10, 14, 39, 0.92);
    border: 2px solid var(--blue-glow);
    border-radius: var(--radius-xl);
    padding: 40px 36px;
    box-shadow: 0 0 40px rgba(0, 170, 255, 0.15), 0 20px 60px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(20px);
}

/* Logo */
.login-logo {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo h1 {
    font-family: var(--font-title);
    font-size: 1.6rem;
    background: linear-gradient(135deg, var(--blue-glow), var(--green-lime), var(--yellow-gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: logoGlow 3s ease-in-out infinite;
}

.login-logo .subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 4px;
    font-weight: 600;
}

@keyframes logoGlow {

    0%,
    100% {
        filter: brightness(1);
    }

    50% {
        filter: brightness(1.3);
    }
}

/* Role Selection Buttons */
.role-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 24px;
}

.role-btn {
    padding: 16px 12px;
    border-radius: var(--radius-md);
    border: 2px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-family: var(--font-body);
}

.role-btn .role-icon {
    font-size: 2rem;
}

.role-btn:hover,
.role-btn.active {
    border-color: var(--blue-glow);
    background: rgba(0, 170, 255, 0.08);
    color: var(--text-primary);
}

.role-btn.active-student {
    border-color: var(--green-lime);
    background: rgba(57, 255, 20, 0.08);
}

.role-btn.active-teacher {
    border-color: var(--blue-glow);
    background: rgba(0, 170, 255, 0.08);
}

/* Forms */
.login-form {
    display: none;
}

.login-form.active {
    display: block;
    animation: fadeSlideIn 0.3s ease;
}

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-form .btn {
    width: 100%;
    margin-top: 8px;
}

/* PIN input */
.pin-input {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.pin-input input {
    width: 56px;
    height: 64px;
    text-align: center;
    font-size: 1.6rem;
    font-weight: 800;
    font-family: var(--font-body);
    border-radius: var(--radius-md);
    border: 2px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.pin-input input:focus {
    border-color: var(--green-lime);
    box-shadow: 0 0 12px rgba(57, 255, 20, 0.3);
    outline: none;
}

/* Register link */
.login-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.login-footer a {
    color: var(--blue-glow);
    font-weight: 700;
}

/* === Character Selection === */
.character-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-space);
    position: relative;
}

.character-select {
    text-align: center;
    max-width: 700px;
    margin: 20px;
    width: 100%;
}

.character-select h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--yellow-gold);
}

.character-select .subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 2rem;
}

.capsules {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 2rem;
}

.capsule {
    background: rgba(255, 255, 255, 0.03);
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-xl);
    padding: 30px 20px;
    cursor: pointer;
    transition: all var(--transition-medium);
    position: relative;
}

.capsule:hover {
    transform: translateY(-8px);
    border-color: rgba(255, 255, 255, 0.3);
}

.capsule.selected {
    border-color: var(--yellow-gold);
    background: rgba(255, 215, 0, 0.05);
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.2);
}

.capsule .byte-preview {
    width: 120px;
    height: 120px;
    margin: 0 auto 16px;
}

.capsule .color-name {
    font-family: var(--font-title);
    font-size: 1.1rem;
}

.capsule-blue .color-name {
    color: var(--blue-glow);
}

.capsule-green .color-name {
    color: var(--green-lime);
}

.capsule-orange .color-name {
    color: var(--orange);
}

/* Register teacher page */
.register-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-space);
}

@media (max-width: 600px) {
    .capsules {
        grid-template-columns: 1fr;
        max-width: 260px;
        margin-left: auto;
        margin-right: auto;
    }

    .login-card {
        padding: 28px 20px;
    }

    .role-buttons {
        grid-template-columns: 1fr;
    }
}