/* ===================================================
   Auth Page Styles (login & register only)
   Liquid background + glass card + form elements
=================================================== */

:root {
    --bg: #ffffff;
    --text: #1d1d1f;
    --text-secondary: #6e6e73;
    --text-tertiary: #86868b;
    --border: rgba(0, 0, 0, 0.06);
    --input-bg: rgba(245, 245, 247, 0.8);
    --input-border: rgba(0, 0, 0, 0.08);
    --primary: #0071e3;
    --primary-hover: #0077ed;
    --danger: #ff3b30;
    --success: #34c759;
    --radius: 16px;
    --radius-sm: 12px;
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-smooth: cubic-bezier(0.25, 0.1, 0.25, 1);
}

[data-theme="dark"] {
    --bg: #000000;
    --text: #f5f5f7;
    --text-secondary: #a1a1a6;
    --text-tertiary: #6e6e73;
    --border: rgba(255, 255, 255, 0.06);
    --input-bg: rgba(44, 44, 46, 0.8);
    --input-border: rgba(255, 255, 255, 0.08);
    --primary: #0a84ff;
    --primary-hover: #409cff;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", "Microsoft YaHei", sans-serif;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow: hidden;
}

/* ── Liquid background ── */
.liquid-bg {
    position: fixed;
    inset: 0;
    overflow: hidden;
    z-index: 0;
    pointer-events: none;
}

.liquid-blob {
    position: absolute;
    border-radius: 50%;
    will-change: transform, border-radius;
}

.liquid-blob.layer-1 {
    width: 520px; height: 520px;
    filter: blur(100px);
    opacity: 0.45;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    top: -12%; left: -8%;
    animation: drift1 20s ease-in-out infinite;
}
.liquid-blob.layer-2 {
    width: 460px; height: 460px;
    filter: blur(100px);
    opacity: 0.4;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    bottom: -15%; right: -10%;
    animation: drift2 24s ease-in-out infinite;
}
.liquid-blob.layer-3 {
    width: 340px; height: 340px;
    filter: blur(80px);
    opacity: 0.35;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    top: 55%; left: 25%;
    animation: drift3 18s ease-in-out infinite;
}
.liquid-blob.layer-4 {
    width: 280px; height: 280px;
    filter: blur(80px);
    opacity: 0.3;
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    top: 15%; right: 12%;
    animation: drift4 22s ease-in-out infinite;
}
.liquid-blob.layer-5 {
    width: 180px; height: 180px;
    filter: blur(60px);
    opacity: 0.25;
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    top: 35%; left: 60%;
    animation: drift5 15s ease-in-out infinite;
}

[data-theme="dark"] .liquid-blob { opacity: 0.2; filter: blur(120px); }
[data-theme="dark"] .liquid-blob.layer-5 { opacity: 0.12; }

@keyframes drift1 {
    0%, 100% { transform: translate(0, 0) scale(1) rotate(0deg); border-radius: 42% 58% 63% 37% / 41% 44% 56% 59%; }
    33%      { transform: translate(80px, -50px) scale(1.08) rotate(120deg); border-radius: 55% 45% 38% 62% / 53% 60% 40% 47%; }
    66%      { transform: translate(-40px, 60px) scale(0.95) rotate(240deg); border-radius: 38% 62% 55% 45% / 62% 38% 62% 38%; }
}
@keyframes drift2 {
    0%, 100% { transform: translate(0, 0) scale(1) rotate(0deg); border-radius: 58% 42% 37% 63% / 44% 41% 59% 56%; }
    33%      { transform: translate(-70px, 40px) scale(1.06) rotate(120deg); border-radius: 45% 55% 62% 38% / 60% 53% 47% 40%; }
    66%      { transform: translate(50px, -60px) scale(0.94) rotate(240deg); border-radius: 62% 38% 45% 55% / 38% 62% 38% 62%; }
}
@keyframes drift3 {
    0%, 100% { transform: translate(0, 0) scale(1); border-radius: 50% 50% 50% 50%; }
    50%      { transform: translate(60px, -70px) scale(1.12); border-radius: 40% 60% 55% 45%; }
}
@keyframes drift4 {
    0%, 100% { transform: translate(0, 0) scale(1); border-radius: 50% 50% 50% 50%; }
    50%      { transform: translate(-50px, 50px) scale(0.9); border-radius: 60% 40% 45% 55%; }
}
@keyframes drift5 {
    0%, 100% { transform: translate(0, 0) scale(1) rotate(0deg); opacity: 0.25; }
    50%      { transform: translate(30px, -40px) scale(1.15) rotate(180deg); opacity: 0.4; }
}

/* ── Noise overlay ── */
.noise-overlay {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    background-size: 128px 128px;
}

/* ── Glass card ── */
.auth-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    padding: 44px 40px 40px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(40px) saturate(200%) brightness(1.1);
    -webkit-backdrop-filter: blur(40px) saturate(200%) brightness(1.1);
    border: 1px solid rgba(255, 255, 255, 0.45);
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.02),
        0 4px 12px rgba(0, 0, 0, 0.04),
        0 16px 40px rgba(0, 0, 0, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    animation: cardEnter 0.8s var(--ease-spring) both;
}

[data-theme="dark"] .auth-container {
    background: rgba(28, 28, 30, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.1),
        0 4px 12px rgba(0, 0, 0, 0.2),
        0 16px 40px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

@keyframes cardEnter {
    from { opacity: 0; transform: translateY(30px) scale(0.96); filter: blur(4px); }
    to   { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}

/* ── Header ── */
.auth-header {
    text-align: center;
    margin-bottom: 32px;
    animation: fadeSlideUp 0.6s var(--ease-smooth) 0.15s both;
}

.auth-header .logo {
    width: 52px; height: 52px;
    margin: 0 auto 14px;
    transition: transform 0.5s var(--ease-spring);
    filter: drop-shadow(0 2px 8px rgba(0, 113, 227, 0.15));
}

.auth-header:hover .logo {
    transform: scale(1.12) rotate(-8deg);
}

.auth-header h1 {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.025em;
    margin-bottom: 6px;
    background: linear-gradient(135deg, var(--text) 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-header p {
    color: var(--text-tertiary);
    font-size: 14px;
    font-weight: 400;
}

@keyframes fadeSlideUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Alerts ── */
.alert {
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-size: 13px;
    font-weight: 500;
    animation: alertPopIn 0.4s var(--ease-spring);
}

@keyframes alertPopIn {
    from { opacity: 0; transform: translateY(-8px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.alert-error {
    background: rgba(255, 59, 48, 0.08);
    color: var(--danger);
    border: 1px solid rgba(255, 59, 48, 0.15);
}

.alert-success {
    background: rgba(52, 199, 89, 0.08);
    color: var(--success);
    border: 1px solid rgba(52, 199, 89, 0.15);
}

/* ── Form ── */
.form-group {
    margin-bottom: 18px;
    animation: fadeSlideUp 0.5s var(--ease-smooth) both;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-secondary);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    transition: color 0.3s ease;
}

.form-group:focus-within label {
    color: var(--primary);
}

.input-wrapper {
    position: relative;
}

.input-wrapper input {
    width: 100%;
    padding: 13px 16px 13px 42px;
    background: var(--input-bg);
    border: 1.5px solid var(--input-border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    color: var(--text);
    font-family: inherit;
    transition: all 0.3s var(--ease-smooth);
    -webkit-appearance: none;
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.9);
    box-shadow:
        0 0 0 3px rgba(0, 113, 227, 0.12),
        inset 0 2px 4px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .input-wrapper input:focus {
    background: rgba(44, 44, 46, 0.9);
    box-shadow:
        0 0 0 3px rgba(10, 132, 255, 0.2),
        inset 0 2px 4px rgba(0, 0, 0, 0.15);
}

.input-wrapper input::placeholder {
    color: var(--text-tertiary);
}

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: var(--text-tertiary);
    transition: color 0.3s ease;
    pointer-events: none;
}

.form-group:focus-within .input-icon {
    color: var(--primary);
}

/* ── Button ── */
.btn {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px;
    border-radius: 980px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    letter-spacing: -0.01em;
    position: relative;
    overflow: hidden;
    transition: all 0.3s var(--ease-smooth);
    animation: fadeSlideUp 0.5s var(--ease-smooth) 0.45s both;
}

.btn-primary {
    background: linear-gradient(135deg, #0071e3 0%, #0077ed 50%, #409cff 100%);
    color: #fff;
    margin-top: 4px;
    box-shadow: 0 2px 8px rgba(0, 113, 227, 0.25);
}

.btn-primary:hover {
    transform: translateY(-1px) scale(1.01);
    box-shadow: 0 6px 20px rgba(0, 113, 227, 0.35);
}

.btn-primary:active {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 1px 4px rgba(0, 113, 227, 0.2);
}

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

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

.btn-ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.35);
    transform: scale(0);
    animation: rippleWave 0.6s ease-out forwards;
    pointer-events: none;
}

@keyframes rippleWave {
    to { transform: scale(4); opacity: 0; }
}

/* ── Footer ── */
.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 13px;
    color: var(--text-tertiary);
    animation: fadeSlideUp 0.5s var(--ease-smooth) 0.55s both;
}

.auth-footer a {
    color: var(--primary);
    font-weight: 600;
    transition: all 0.2s;
    position: relative;
}

.auth-footer a::after {
    content: '';
    position: absolute;
    bottom: -1px; left: 0;
    width: 0; height: 1.5px;
    background: var(--primary);
    transition: width 0.3s var(--ease-smooth);
}

.auth-footer a:hover::after {
    width: 100%;
}

/* ── Theme toggle ── */
.theme-toggle-auth {
    position: fixed;
    top: 16px; right: 16px;
    z-index: 10;
    background: rgba(255,255,255,0.45);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255,255,255,0.3);
    cursor: pointer;
    padding: 0;
    border-radius: 50%;
    width: 38px; height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    transition: all 0.4s var(--ease-spring);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

[data-theme="dark"] .theme-toggle-auth {
    background: rgba(28,28,30,0.45);
    border-color: rgba(255,255,255,0.08);
}

.theme-toggle-auth:hover {
    transform: rotate(40deg) scale(1.15);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

/* ── Responsive ── */
@media (max-width: 480px) {
    .auth-container { padding: 36px 24px 32px; }
    .liquid-blob.layer-1 { width: 300px; height: 300px; filter: blur(70px); }
    .liquid-blob.layer-2 { width: 260px; height: 260px; filter: blur(70px); }
    .liquid-blob.layer-3 { width: 200px; height: 200px; }
    .liquid-blob.layer-4, .liquid-blob.layer-5 { display: none; }
}
