/* ==========================================================================
   auth.css — Shared styles for RPOOL.ID auth pages
   Used by: login.php, register.php, forgot_password.php, reset_password.php
   Google-style multi-step flow, RPOOL dark theme.
   ========================================================================== */

:root {
    --auth-bg: #0a0a0f;
    --auth-card: #1a1a28;
    --auth-card2: #12121a;
    --auth-accent: #6c5ce7;
    --auth-accent-light: #a29bfe;
    --auth-grad: linear-gradient(135deg, #6c5ce7, #a29bfe);
    --auth-border: rgba(255, 255, 255, 0.06);
    --auth-muted: #8888a0;
    --auth-label: #b8b8cc;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    background: var(--auth-bg);
    font-family: 'Inter', 'Segoe UI', sans-serif;
    margin: 0;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    overflow-x: hidden;
}

/* ---------- Ambient background ---------- */
.auth-bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.auth-bg .blob { position: absolute; border-radius: 50%; filter: blur(90px); }
.auth-bg .b1 { width: 480px; height: 480px; background: #6c5ce7; opacity: 0.22; top: -140px; left: -120px; animation: blobFloat 14s ease-in-out infinite; }
.auth-bg .b2 { width: 440px; height: 440px; background: #2d2a55; opacity: 0.35; bottom: -150px; right: -110px; animation: blobFloat 18s ease-in-out infinite reverse; }
.auth-bg .b3 { width: 260px; height: 260px; background: #a29bfe; opacity: 0.10; top: 55%; left: 10%; animation: blobFloat 20s ease-in-out infinite; }

/* ---------- Keyframes ---------- */
@keyframes blobFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-26px); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes stepIn { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: translateX(0); } }
@keyframes stepInBack { from { opacity: 0; transform: translateX(-18px); } to { opacity: 1; transform: translateX(0); } }
@keyframes shake {
    10%, 90% { transform: translateX(-1px); }
    20%, 80% { transform: translateX(2px); }
    30%, 50%, 70% { transform: translateX(-3px); }
    40%, 60% { transform: translateX(3px); }
}
@keyframes authSpin { to { transform: rotate(360deg); } }
@keyframes authIndeterminate { 0% { left: -40%; } 100% { left: 110%; } }

/* ---------- Card ---------- */
.auth-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 600px;
    margin: 24px 16px;
    background: var(--auth-card);
    border: 1px solid var(--auth-border);
    border-radius: 24px;
    padding: 40px 48px 32px;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.45), 0 0 80px rgba(108, 92, 231, 0.07);
    animation: fadeUp 0.45s ease-out both;
}
.auth-card.shake { animation: shake 0.45s ease both; }

/* ---------- Top progress bar (step transition / submit loading) ---------- */
.auth-progress {
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}
.auth-progress.active { opacity: 1; }
.auth-progress span {
    position: absolute;
    top: 0; left: -40%;
    width: 40%; height: 100%;
    background: var(--auth-grad);
    border-radius: 3px;
    animation: authIndeterminate 1s ease-in-out infinite;
}

/* ---------- Head ---------- */
.auth-head { margin-bottom: 22px; }
.auth-logo { display: block; margin-bottom: 16px; }
.auth-logo svg { width: 44px; height: 44px; display: block; }
.auth-logo img { width: 52px; height: 52px; display: block; border-radius: 50%; box-shadow: 0 4px 18px rgba(108, 92, 231, 0.35); }
.auth-head h1 { font-size: 1.45rem; font-weight: 800; color: #fff; margin: 0 0 4px; letter-spacing: 0.2px; }
.auth-head p { color: var(--auth-muted); font-size: 0.92rem; margin: 0; }

/* ---------- Steps (wizard) ---------- */
.auth-step { display: block; }
.js .auth-step { display: none; }
.js .auth-step.active { display: block; animation: stepIn 0.32s ease both; }
.js .auth-step.active.anim-back { animation-name: stepInBack; }
/* Without JS the wizard controls are useless — hide them, all fields stay visible */
html:not(.js) [data-next],
html:not(.js) [data-back] { display: none !important; }

/* ---------- Floating-label fields ---------- */
.field-wrap { margin-bottom: 16px; }
.field { position: relative; }
.field input {
    width: 100%;
    height: 56px;
    padding: 16px 14px 14px;
    background: var(--auth-card2);
    border: 1px solid rgba(108, 92, 231, 0.3);
    border-radius: 12px;
    color: #fff;
    font-family: inherit;
    font-weight: 500;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.field input:focus {
    border-color: var(--auth-accent);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.15);
    outline: none;
}
.field label {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    padding: 0 4px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.95rem;
    font-weight: 400;
    pointer-events: none;
    transition: all 0.15s ease;
    background: transparent;
    border-radius: 4px;
}
.field input:focus + label,
.field input:not(:placeholder-shown) + label {
    top: 0;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--auth-accent-light);
    /* two-tone background only when floated, so it covers the input border seam */
    background: linear-gradient(to bottom, var(--auth-card) 50%, var(--auth-card2) 50%);
}
.field-wrap.invalid .field input { border-color: rgba(239, 68, 68, 0.6); }
.field-wrap.invalid .field input:focus { box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12); }
.field-wrap.invalid .field label,
.field-wrap.invalid .field input:focus + label,
.field-wrap.invalid .field input:not(:placeholder-shown) + label { color: #fca5a5; }
.field-error {
    display: none;
    align-items: center;
    gap: 6px;
    color: #fca5a5;
    font-size: 0.8rem;
    font-weight: 500;
    margin: 6px 2px 0;
}
.field-wrap.invalid .field-error { display: flex; }

/* ---------- Alerts ---------- */
.auth-alert {
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.88rem;
    margin-bottom: 16px;
    padding: 10px 14px;
    letter-spacing: 0.2px;
}
.auth-alert.danger { background: rgba(239, 68, 68, 0.1); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.25); }
.auth-alert.warning { background: rgba(245, 158, 11, 0.1); color: #fcd34d; border: 1px solid rgba(245, 158, 11, 0.25); }
.auth-alert.info { background: rgba(108, 92, 231, 0.1); color: #a29bfe; border: 1px solid rgba(108, 92, 231, 0.25); }
.auth-alert.success { background: rgba(34, 197, 94, 0.1); color: #86efac; border: 1px solid rgba(34, 197, 94, 0.25); }

/* ---------- Email chip (step 2) ---------- */
.email-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(108, 92, 231, 0.12);
    border: 1px solid rgba(108, 92, 231, 0.35);
    color: #dfe0ff;
    border-radius: 999px;
    padding: 6px 14px 6px 10px;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 18px;
    transition: background 0.2s;
}
.email-chip:hover { background: rgba(108, 92, 231, 0.22); }
.email-chip i { font-size: 0.9rem; }

/* ---------- Checkboxes ---------- */
.auth-check { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.auth-check input {
    appearance: none;
    -webkit-appearance: none;
    width: 16px; height: 16px;
    border-radius: 4px;
    border: 1.5px solid rgba(108, 92, 231, 0.4);
    background: var(--auth-card2);
    cursor: pointer;
    margin: 0;
    flex: 0 0 auto;
    position: relative;
    top: 0;
}
.auth-check input:checked {
    background-color: var(--auth-accent);
    border-color: var(--auth-accent);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='m6 10 3 3 6-6'/%3e%3c/svg%3e");
    background-size: 12px;
    background-position: center;
    background-repeat: no-repeat;
}
.auth-check input:focus { box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.25); outline: none; }
.auth-check label { color: var(--auth-label); font-weight: 500; font-size: 0.85rem; cursor: pointer; }

/* ---------- Captcha ---------- */
.captcha-panel {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    background: var(--auth-card2);
    border: 1px solid rgba(108, 92, 231, 0.2);
    border-radius: 12px;
    padding: 10px 12px;
    margin-bottom: 10px;
}
.captcha-panel img { border-radius: 8px; display: block; flex: 0 0 auto; }
.captcha-hint {
    flex: 1 1 auto;
    color: var(--auth-label);
    font-size: 0.75rem;
    line-height: 1.35;
    opacity: 0.75;
}
.captcha-refresh {
    flex: 0 0 auto;
    background: none;
    border: 1px solid rgba(108, 92, 231, 0.25);
    border-radius: 8px;
    color: var(--auth-accent-light);
    font-weight: 500;
    cursor: pointer;
    font-size: 0.82rem;
    font-family: inherit;
    padding: 6px 10px;
    white-space: nowrap;
    transition: all 0.2s;
}
.captcha-refresh:hover { color: #fff; border-color: rgba(108, 92, 231, 0.5); }
.form-text-hint { color: var(--auth-label); font-size: 0.78rem; opacity: 0.7; margin-top: 6px; }

/* ---------- Actions row ---------- */
.auth-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 32px;
}
.btn-primary {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--auth-grad);
    border: none;
    color: #fff;
    font-family: inherit;
    font-weight: 700;
    border-radius: 12px;
    font-size: 0.95rem;
    padding: 11px 26px;
    min-width: 112px;
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.3);
    transition: all 0.2s;
    cursor: pointer;
}
.btn-primary:hover { background: linear-gradient(135deg, #5b4bd6, #8b80f0); box-shadow: 0 6px 20px rgba(108, 92, 231, 0.4); transform: translateY(-1px); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-primary .spinner {
    display: none;
    width: 15px; height: 15px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: authSpin 0.7s linear infinite;
}
.btn-primary.loading .spinner { display: inline-block; }
.btn-link {
    background: none;
    border: none;
    color: var(--auth-accent-light);
    font-family: inherit;
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    padding: 10px 12px;
    margin-left: -12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-link:hover { color: #fff; background: rgba(108, 92, 231, 0.1); }

/* ---------- Password strength ---------- */
.pw-strength { height: 4px; border-radius: 2px; margin-top: 8px; width: 0; background: transparent; transition: all 0.3s; }
.pw-hint { color: var(--auth-label); font-size: 0.78rem; opacity: 0.7; margin-top: 6px; }

/* ---------- Success panel ---------- */
.auth-success { text-align: center; padding: 8px 0 4px; animation: fadeUp 0.35s ease-out both; }
.auth-success .success-icon {
    width: 62px; height: 62px;
    border-radius: 50%;
    background: var(--auth-grad);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 1.5rem;
    color: #fff;
    box-shadow: 0 8px 24px rgba(108, 92, 231, 0.35);
}
.auth-success h2 { font-size: 1.2rem; font-weight: 800; color: #fff; margin: 0 0 8px; }
.auth-success p { color: var(--auth-muted); font-size: 0.9rem; line-height: 1.5; margin: 0 0 20px; }
.auth-success p strong { color: var(--auth-accent-light); font-weight: 600; }
.auth-success .btn-primary { width: 100%; }
.auth-success .resend { margin-top: 14px; }

/* ---------- Destination chooser (login.php, already logged in) ---------- */
.chooser-container {
    position: relative;
    z-index: 1;
    max-width: 560px;
    width: 100%;
    margin: 24px 16px;
    animation: fadeUp 0.45s ease-out both;
}
.chooser-header { text-align: center; margin-bottom: 30px; }
.chooser-header svg { width: 48px; height: 48px; margin-bottom: 12px; }
.chooser-header h3 { color: var(--auth-accent-light); font-weight: 800; font-size: 1.4rem; margin: 0 0 6px; }
.chooser-header p { color: var(--auth-muted); font-size: 0.95rem; margin: 0; }
.chooser-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.chooser-card {
    background: var(--auth-card);
    border: 1px solid var(--auth-border);
    border-radius: 20px;
    padding: 30px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    animation: fadeUp 0.35s ease-out both;
}
.chooser-card:nth-child(1) { animation-delay: 0.05s; }
.chooser-card:nth-child(2) { animation-delay: 0.1s; }
.chooser-card:nth-child(3) { animation-delay: 0.15s; }
.chooser-card:nth-child(4) { animation-delay: 0.2s; }
.chooser-card:hover { border-color: rgba(108, 92, 231, 0.5); box-shadow: 0 8px 30px rgba(108, 92, 231, 0.15); transform: translateY(-4px); }
.chooser-card .chooser-icon { width: 64px; height: 64px; border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 1.8rem; }
.chooser-card .chooser-icon.library { background: linear-gradient(135deg, #6c5ce7, #a29bfe); color: #fff; }
.chooser-card .chooser-icon.store { background: linear-gradient(135deg, #00b894, #55efc4); color: #fff; }
.chooser-card .chooser-icon.admin { background: linear-gradient(135deg, #e17055, #fab1a0); color: #fff; }
.chooser-card .chooser-icon.remixer { background: linear-gradient(135deg, #fdcb6e, #f39c12); color: #fff; }
.chooser-card .chooser-title { color: #fff; font-weight: 700; font-size: 1.1rem; }
.chooser-card .chooser-desc { color: var(--auth-muted); font-size: 0.8rem; line-height: 1.4; }
.chooser-logout { margin-top: 24px; text-align: center; }
.chooser-logout a { color: #666; font-size: 0.85rem; text-decoration: none; transition: color 0.2s; }
.chooser-logout a:hover { color: var(--auth-accent-light); }

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
    .auth-card { padding: 26px 20px 20px; margin: 16px 12px; border-radius: 20px; }
    .auth-head h1 { font-size: 1.25rem; }
    .auth-actions { margin-top: 20px; }
    .captcha-panel { flex-wrap: wrap; }
    .chooser-grid { grid-template-columns: 1fr; }
    .chooser-card { padding: 24px 18px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
