/* ====== Reset & Base ====== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

@font-face {
    font-family: 'Tech';
    src: local('Segoe UI'), local('PingFang SC'), local('Microsoft YaHei'), sans-serif;
}

body {
    font-family: 'Tech', sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #0a0e17;
    color: #e0e6ed;
    overflow: hidden;
    position: relative;
}

/* ====== Animated Background ====== */
.bg-grid {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 0;
    background-image:
        linear-gradient(rgba(0, 224, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 224, 255, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
    animation: gridMove 20s linear infinite;
}

@keyframes gridMove {
    0% { transform: translate(0, 0); }
    100% { transform: translate(60px, 60px); }
}

.bg-glow {
    position: fixed;
    z-index: 0;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.35;
    animation: floatGlow 12s ease-in-out infinite alternate;
}

.bg-glow.glow-1 {
    width: 500px; height: 500px;
    background: radial-gradient(circle, #00e0ff, transparent 70%);
    top: -10%; left: -5%;
}

.bg-glow.glow-2 {
    width: 400px; height: 400px;
    background: radial-gradient(circle, #7b2dff, transparent 70%);
    bottom: -10%; right: -5%;
    animation-delay: -6s;
}

.bg-glow.glow-3 {
    width: 300px; height: 300px;
    background: radial-gradient(circle, #00ffa3, transparent 70%);
    top: 50%; left: 60%;
    opacity: 0.2;
    animation-delay: -3s;
}

@keyframes floatGlow {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(40px, -30px) scale(1.15); }
}

/* ====== Particles ====== */
.particles {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 0;
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 2px; height: 2px;
    background: rgba(0, 224, 255, 0.6);
    border-radius: 50%;
    animation: particleFloat linear infinite;
}

@keyframes particleFloat {
    0% { transform: translateY(100vh) scale(0); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translateY(-10vh) scale(1); opacity: 0; }
}

/* ====== Login Card ====== */
.login-wrapper {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-card {
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(0, 224, 255, 0.12);
    border-radius: 20px;
    padding: 48px 40px 40px;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 0 40px rgba(0, 224, 255, 0.06),
        0 20px 60px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    animation: cardAppear 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    opacity: 0;
    transform: translateY(30px);
}

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

/* Top accent line */
.login-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #00e0ff, #7b2dff, #00e0ff, transparent);
    background-size: 200% 100%;
    animation: shimmer 3s linear infinite;
}

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

/* Corner decorations */
.corner-deco {
    position: absolute;
    width: 20px; height: 20px;
    border-color: rgba(0, 224, 255, 0.3);
    border-style: solid;
    border-width: 0;
}
.corner-deco.tl { top: 8px; left: 8px; border-top-width: 1px; border-left-width: 1px; border-radius: 4px 0 0 0; }
.corner-deco.tr { top: 8px; right: 8px; border-top-width: 1px; border-right-width: 1px; border-radius: 0 4px 0 0; }
.corner-deco.bl { bottom: 8px; left: 8px; border-bottom-width: 1px; border-left-width: 1px; border-radius: 0 0 0 4px; }
.corner-deco.br { bottom: 8px; right: 8px; border-bottom-width: 1px; border-right-width: 1px; border-radius: 0 0 4px 0; }

/* ====== Logo Area ====== */
.logo-area {
    text-align: center;
    margin-bottom: 36px;
}

.logo-icon {
    width: 56px; height: 56px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, #00e0ff, #7b2dff);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -1px;
    box-shadow: 0 4px 20px rgba(0, 224, 255, 0.3);
    position: relative;
}

.logo-icon::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 18px;
    background: linear-gradient(135deg, #00e0ff, #7b2dff);
    opacity: 0.2;
    z-index: -1;
}

.logo-title {
    font-size: 22px;
    font-weight: 600;
    color: #fff;
    letter-spacing: 2px;
}

.logo-subtitle {
    font-size: 13px;
    color: rgba(0, 224, 255, 0.5);
    margin-top: 6px;
    letter-spacing: 4px;
    text-transform: uppercase;
}

/* ====== Form ====== */
.form-group {
    margin-bottom: 20px;
    position: relative;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: rgba(224, 230, 237, 0.6);
    margin-bottom: 8px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.input-wrapper {
    position: relative;
}

.input-wrapper .input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(0, 224, 255, 0.4);
    width: 16px;
    height: 16px;
    transition: color 0.3s;
    pointer-events: none;
    z-index: 2;
}

.input-wrapper input {
    width: 100%;
    padding: 12px 14px 12px 42px;
    background: rgba(0, 224, 255, 0.04);
    border: 1px solid rgba(0, 224, 255, 0.1);
    border-radius: 10px;
    color: #e0e6ed;
    font-size: 14px;
    transition: all 0.3s ease;
    outline: none;
}

/* Password field needs extra right padding for toggle button */
.input-wrapper input[type="password"],
.input-wrapper input[name="password"] {
    padding-right: 42px;
}

.input-wrapper input::placeholder {
    color: rgba(224, 230, 237, 0.3);
}

.input-wrapper input:focus {
    border-color: rgba(0, 224, 255, 0.5);
    background: rgba(0, 224, 255, 0.07);
    box-shadow: 0 0 0 3px rgba(0, 224, 255, 0.08), 0 0 20px rgba(0, 224, 255, 0.05);
}

.input-wrapper input:focus ~ .input-icon,
.input-wrapper input:focus + .input-icon {
    color: #00e0ff;
}

/* password toggle */
.pwd-toggle {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(224, 230, 237, 0.3);
    cursor: pointer;
    font-size: 15px;
    padding: 4px;
    transition: color 0.3s;
    z-index: 2;
}
.pwd-toggle:hover { color: #00e0ff; }

/* ====== Captcha ====== */
.captcha-row {
    display: flex;
    gap: 12px;
    align-items: stretch;
}

.captcha-row .input-wrapper {
    flex: 1;
}

.captcha-img-wrap {
    flex-shrink: 0;
    height: 46px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid rgba(0, 224, 255, 0.1);
    cursor: pointer;
    transition: border-color 0.3s, box-shadow 0.3s;
    background: rgba(0, 224, 255, 0.04);
}

.captcha-img-wrap:hover {
    border-color: rgba(0, 224, 255, 0.4);
    box-shadow: 0 0 12px rgba(0, 224, 255, 0.1);
}

.captcha-img-wrap img {
    height: 100%;
    width: 100%;
    min-width: 110px;
    object-fit: cover;
    display: block;
}

/* ====== Remember Me ====== */
.form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.form-options:empty {
    display: none;
    margin-bottom: 0;
}

.remember-check {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.remember-check input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 18px; height: 18px;
    border: 1px solid rgba(0, 224, 255, 0.25);
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    background: rgba(0, 224, 255, 0.04);
    flex-shrink: 0;
}

.checkmark svg {
    width: 12px; height: 12px;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s;
}

.remember-check input:checked + .checkmark {
    background: linear-gradient(135deg, #00e0ff, #7b2dff);
    border-color: transparent;
}

.remember-check input:checked + .checkmark svg {
    opacity: 1;
    transform: scale(1);
}

.remember-check .check-label {
    font-size: 13px;
    color: rgba(224, 230, 237, 0.5);
}

.register-link {
    font-size: 13px;
}

.register-link a {
    color: #00e0ff;
    text-decoration: none;
    transition: color 0.3s;
}

.register-link a:hover {
    color: #7b2dff;
}

/* ====== Submit Button ====== */
.btn-login {
    width: 100%;
    padding: 13px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 2px;
    color: #fff;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #00e0ff, #7b2dff);
    transition: transform 0.2s, box-shadow 0.3s;
    box-shadow: 0 4px 20px rgba(0, 224, 255, 0.25);
}

.btn-login:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 30px rgba(0, 224, 255, 0.35);
}

.btn-login:active {
    transform: translateY(0);
}

.btn-login::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
    transition: left 0.5s;
}

.btn-login:hover::before {
    left: 100%;
}

/* ====== Validation Error ====== */
label.error {
    position: inherit !important;
    display: block;
    font-size: 12px;
    color: #ff4d6a;
    margin-top: 6px;
    padding-left: 2px;
}

input.error {
    border-color: rgba(255, 77, 106, 0.5) !important;
}

/* ====== Footer ====== */
.login-footer {
    position: relative;
    z-index: 10;
    text-align: center;
    padding: 24px 20px 16px;
    font-size: 12px;
    color: rgba(224, 230, 237, 0.25);
    letter-spacing: 0.5px;
}

.login-footer a {
    color: rgba(0, 224, 255, 0.35);
    text-decoration: none;
    transition: color 0.3s;
}

.login-footer a:hover {
    color: rgba(0, 224, 255, 0.6);
}

/* ====== Responsive ====== */
@media (max-width: 480px) {
    .login-card {
        padding: 36px 24px 32px;
        border-radius: 16px;
    }
    .logo-title { font-size: 20px; }
}

/* ====== Scanline effect ====== */
.scanline {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
    z-index: 999;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.015) 2px,
        rgba(0, 0, 0, 0.015) 4px
    );
}
