/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary:       #667eea;
    --primary-dark:  #5568d3;
    --secondary:     #764ba2;
    --bg:            #0f172a;
    --card-bg:       rgba(255, 255, 255, 0.95);
    --text:          #1e293b;
    --text-muted:    #64748b;
    --border:        #e2e8f0;
    --danger:        #ef4444;
    --success:       #10b981;
    --radius:        16px;
    --shadow:        0 20px 60px rgba(0, 0, 0, 0.3);
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #312e81 100%);
    overflow: hidden;
}

/* ===== Background Animation ===== */
.bg-animation { position: fixed; inset: 0; z-index: 0; overflow: hidden; }
.bg-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: float 20s infinite ease-in-out;
}
.shape1 { width: 400px; height: 400px; background: #667eea; top: -100px; left: -100px; }
.shape2 { width: 300px; height: 300px; background: #764ba2; bottom: -80px; right: -60px; animation-delay: -7s; }
.shape3 { width: 350px; height: 350px; background: #4f46e5; top: 50%; left: 50%; transform: translate(-50%, -50%); animation-delay: -14s; }

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33%      { transform: translate(30px, -30px) scale(1.1); }
    66%      { transform: translate(-20px, 20px) scale(0.95); }
}

/* ===== Container ===== */
.login-container {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

/* ===== Card ===== */
.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 40px 36px;
    animation: cardIn 0.6s ease;
}

@keyframes cardIn {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ===== Header ===== */
.login-header { text-align: center; margin-bottom: 32px; }
.logo {
    width: 64px; height: 64px;
    margin: 0 auto 16px;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    border-radius: 16px;
}
.login-header h1 {
    font-size: 26px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 6px;
}
.subtitle { font-size: 13px; color: var(--text-muted); }

/* ===== Form ===== */
.form-group { margin-bottom: 20px; }
.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 8px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}
.input-icon {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    pointer-events: none;
    z-index: 1;
}
.input-wrapper input {
    width: 100%;
    padding: 12px 14px 12px 42px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    color: var(--text);
    background: #f8fafc;
    transition: all 0.25s ease;
    outline: none;
}
.input-wrapper input:focus {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}
.toggle-pwd {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 6px;
    border-radius: 6px;
    z-index: 1;
    transition: color 0.2s;
}
.toggle-pwd:hover { color: var(--primary); }

/* ===== Options ===== */
.form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    font-size: 14px;
}
.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    color: var(--text-muted);
    gap: 6px;
}
.checkbox-label input { display: none; }
.checkmark {
    width: 18px; height: 18px;
    border: 2px solid var(--border);
    border-radius: 5px;
    transition: all 0.2s;
    position: relative;
}
.checkbox-label input:checked + .checkmark {
    background: var(--primary);
    border-color: var(--primary);
}
.checkbox-label input:checked + .checkmark::after {
    content: '';
    position: absolute;
    left: 4px; top: 0px;
    width: 6px; height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}
.link-text {
    color: var(--primary);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}
.link-text:hover { color: var(--primary-dark); }

/* ===== Button ===== */
.btn-login {
    width: 100%;
    padding: 13px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}
.btn-login:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
}
.btn-login:active { transform: translateY(0); }
.btn-login:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }

.btn-spinner { display: flex; align-items: center; justify-content: center; }
.spinner {
    width: 18px; height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Message ===== */
.message {
    margin-top: 16px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
}
.message.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.3);
}
.message.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* ===== Footer ===== */
.login-footer { margin-top: 32px; }
.footer-divider {
    text-align: center;
    position: relative;
    margin-bottom: 16px;
}
.footer-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0; right: 0;
    height: 1px;
    background: var(--border);
}
.footer-divider span {
    position: relative;
    background: var(--card-bg);
    padding: 0 14px;
    font-size: 12px;
    color: var(--text-muted);
}
.api-info {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.api-info code {
    font-size: 12px;
    color: var(--text-muted);
    background: #f1f5f9;
    padding: 6px 12px;
    border-radius: 6px;
    word-break: break-all;
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
    .login-card { padding: 32px 24px; }
    .login-header h1 { font-size: 22px; }
}
