/* ===== LOGIN PAGE — DigitalOcean Design System ===== */
@import url('https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;600;700&family=Source+Code+Pro:wght@400;500;600&display=swap');

:root {
    /* Surfaces */
    --bg-page:      #f5f6f7;
    --card-bg:      #ffffff;

    /* Text */
    --text-dark:      #333333;
    --text-secondary: #4d4d4d;
    --text-hint:      #b3b3b3;

    /* Borders */
    --border:       #d9d9d9;
    --border-hover: #b3b3b3;
    --border-focus: #0080ff;

    /* Interactive */
    --accent:       #0080ff;
    --accent-hover: #006fd6;
    --accent-active:#005db3;

    /* Semantic */
    --discord:       #5865F2;
    --discord-hover: #4752C4;
    --success:       #1db954;
    --error:         #e53e3e;

    /* Shadows */
    --shadow-sm:   0 1px 3px rgba(0,0,0,0.08);
    --shadow-md:   0 2px 8px rgba(0,0,0,0.10);
    --shadow-card: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-focus:0 0 0 3px rgba(0,128,255,0.25);

    /* Radii */
    --radius:    4px;
    --radius-md: 4px;
    --radius-lg: 6px;

    /* Fonts */
    --font-sans: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'Source Code Pro', 'Fira Code', monospace;
}

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

body {
    font-family: var(--font-sans);
    background: var(--bg-page);
    color: var(--text-dark);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    -webkit-font-smoothing: antialiased;
    font-size: 14px;
    line-height: 1.57;
    position: relative;
}
body::before { display: none; }

/* ====== Page Loader ====== */
.page-loader {
    position: fixed;
    inset: 0;
    background: var(--bg-page);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}
.page-loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.loader-ring {
    width: 20px; height: 20px;
    border: 2px solid #ebebeb;
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: do-spin 600ms linear infinite;
}
@keyframes do-spin { to { transform: rotate(360deg); } }

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

.login-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
    padding: 0;
    position: relative;
    overflow: hidden;
}
.login-card-inner { padding: 32px 24px 24px; }

/* ====== Brand Header ====== */
.brand {
    text-align: center;
    margin-bottom: 24px;
    padding-top: 4px;
}
.brand-logo { display: inline-block; margin-bottom: 6px; }
.brand-logo svg { width: 40px; height: 40px; }
.brand h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-dark);
    letter-spacing: -0.3px;
}
.brand p { display: none; }

/* ====== Screen Title ====== */
.screen-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 20px;
}

/* ====== Form Screens ====== */
.screen { display: none; animation: do-fade-in 150ms ease; }
.screen.active { display: block; }
@keyframes do-fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ====== Form Elements ====== */
.form-group { margin-bottom: 16px; }
.form-group label { display: none; }
.form-group input {
    width: 100%;
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: var(--font-sans);
    color: var(--text-dark);
    background: var(--card-bg);
    transition: border-color 150ms ease, box-shadow 150ms ease;
    outline: none;
}
.form-group input:hover { border-color: var(--border-hover); }
.form-group input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(0,128,255,0.15);
}
.form-group input::placeholder { color: var(--text-hint); }
.form-group .input-hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ====== Remember / Forgot Row ====== */
.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    margin-bottom: 0;
}
.toggle-row label {
    font-size: 13px;
    font-weight: 400;
    color: var(--text-dark);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}
.toggle-switch { display: none; }
.checkbox-wrap { display: flex; align-items: center; gap: 8px; }
.checkbox-wrap input[type="checkbox"] {
    width: 16px; height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}

.action-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 20px;
    margin-bottom: 0;
}
.forgot-link {
    font-size: 13px;
    color: var(--accent);
    text-decoration: none;
    cursor: pointer;
    transition: color 150ms ease;
}
.forgot-link:hover { color: var(--accent-hover); }

/* ====== Buttons ====== */
.btn {
    height: 36px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-sans);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
    position: relative;
    overflow: hidden;
}
.btn:active { transform: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:focus { outline: none; box-shadow: var(--shadow-focus); }

.btn-primary {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
    padding: 0 16px;
}
.btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}
.btn-primary:active:not(:disabled) {
    background: var(--accent-active);
    border-color: var(--accent-active);
}
.btn-full { width: 100%; }

/* Discord button */
.btn-discord {
    background: transparent;
    color: var(--text-secondary);
    border: none;
    padding: 0;
    width: 36px; height: 36px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 150ms ease;
}
.btn-discord:hover:not(:disabled) { background: #f5f6f7; }

/* Button Spinner */
.btn-spinner {
    width: 14px; height: 14px;
    border: 2px solid rgba(255,255,255,0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: do-spin 600ms linear infinite;
    display: none;
}
.btn-discord .btn-spinner {
    border-color: rgba(0,0,0,0.15);
    border-top-color: var(--accent);
}
.btn.loading .btn-text { visibility: hidden; }
.btn.loading .btn-spinner { display: block; position: absolute; }

/* ====== Social Login Section ====== */
.social-section {
    background: #f5f6f7;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px solid var(--border);
}
.social-label {
    font-size: 12px;
    color: #808080;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-family: var(--font-mono);
}
.social-icons { display: flex; gap: 8px; }
.social-icon-btn {
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    transition: opacity 150ms ease;
    background: var(--discord);
    color: #fff;
}
.social-icon-btn:hover { opacity: 0.85; }
.social-icon-btn svg { width: 18px; height: 18px; fill: currentColor; }

/* ====== Footer Link ====== */
.card-footer {
    text-align: center;
    padding: 14px 24px 18px;
    font-size: 13px;
    color: var(--text-secondary);
    background: var(--card-bg);
}
.card-footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}
.card-footer a:hover { text-decoration: underline; }

/* ====== Page Footer ====== */
.page-footer {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    text-align: center;
    padding: 14px 24px;
    z-index: 1;
}
.page-footer-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
}
.page-footer span {
    font-size: 11px;
    color: var(--text-hint);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-family: var(--font-mono);
}
.page-footer a {
    font-size: 11px;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-family: var(--font-mono);
    transition: color 150ms;
}
.page-footer a:hover { color: var(--accent); }
.page-footer .sep { color: var(--text-hint); font-size: 11px; }

/* ====== Error / Warning Messages ====== */
.error-bar {
    background: #fff5f5;
    border: 1px solid #e53e3e;
    border-left: 3px solid #e53e3e;
    color: #b52a2a;
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 14px;
    display: none;
    animation: do-fade-in 150ms ease;
    line-height: 1.4;
}
.error-bar.show { display: block; }

.dm-warning {
    background: #fffbea;
    border: 1px solid #f5a623;
    border-left: 3px solid #f5a623;
    color: #c4851c;
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 14px;
    line-height: 1.4;
    display: none;
}
.dm-warning.show { display: block; }

/* ====== Divider ====== */
.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
}
.divider::before, .divider::after {
    content: ''; flex: 1; height: 1px;
    background: var(--border);
}
.divider span {
    font-size: 11px;
    color: #808080;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    font-family: var(--font-mono);
}

/* ====== Form Footer ====== */
.form-footer {
    text-align: center;
    margin-top: 16px;
    font-size: 13px;
    color: var(--text-secondary);
}
.form-footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}
.form-footer a:hover { text-decoration: underline; }

/* ====== OTP Screen ====== */
.otp-header { text-align: center; margin-bottom: 20px; }
.otp-header h2 {
    font-size: 18px; font-weight: 600;
    margin-bottom: 8px; color: var(--text-dark);
}
.otp-header p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}
.otp-input-wrap {
    display: flex; gap: 8px;
    justify-content: center;
    margin-bottom: 20px;
}
.otp-input-wrap input {
    width: 40px; height: 44px;
    text-align: center;
    font-size: 18px; font-weight: 700;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    outline: none;
    font-family: var(--font-mono);
    color: var(--text-dark);
    transition: border-color 150ms ease;
    background: var(--card-bg);
}
.otp-input-wrap input:focus { border-color: var(--border-focus); box-shadow: var(--shadow-focus); }

.resend-row {
    text-align: center;
    margin-top: 14px;
    font-size: 13px;
    color: var(--text-secondary);
}
.resend-row button {
    background: none; border: none;
    color: var(--accent);
    font-weight: 600; font-size: 13px;
    cursor: pointer; font-family: var(--font-sans);
    padding: 0;
}
.resend-row button:disabled { color: var(--text-hint); cursor: not-allowed; }
.resend-timer { font-variant-numeric: tabular-nums; }

/* ====== Success Screen ====== */
.success-screen { text-align: center; padding: 28px 0 20px; }
.success-icon {
    width: 48px; height: 48px;
    border-radius: 50%;
    background: #f0faf5;
    border: 2px solid #1db954;
    display: inline-flex;
    align-items: center; justify-content: center;
    margin-bottom: 16px;
    animation: scaleIn 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
@keyframes scaleIn { from { transform: scale(0); } to { transform: scale(1); } }
.success-icon .checkmark {
    width: 20px; height: 20px;
    stroke: var(--success);
    stroke-width: 3; fill: none;
    stroke-linecap: round; stroke-linejoin: round;
    stroke-dasharray: 40; stroke-dashoffset: 40;
    animation: drawCheck 0.4s 0.2s ease forwards;
}
@keyframes drawCheck { to { stroke-dashoffset: 0; } }
.success-screen h2 {
    font-size: 18px; font-weight: 600;
    margin-bottom: 6px; color: var(--text-dark);
}
.success-screen p {
    font-size: 14px; color: var(--text-secondary);
    margin-bottom: 4px;
}
.redirect-text {
    font-size: 12px; color: #808080;
    margin-top: 16px; font-family: var(--font-mono);
}
.redirect-text span { font-weight: 600; font-variant-numeric: tabular-nums; }

/* ====== Redirect Screen ====== */
.redirect-screen { text-align: center; padding: 28px 0 20px; }
.redirect-screen p {
    font-size: 14px; color: var(--text-secondary); margin-bottom: 20px;
}
.redirect-spinner {
    width: 20px; height: 20px;
    border: 2px solid #ebebeb;
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: do-spin 600ms linear infinite;
    margin: 0 auto;
}

/* ====== Discord Icon ====== */
.discord-icon { width: 18px; height: 18px; fill: currentColor; }

/* ====== Password Strength ====== */
.password-strength {
    height: 2px;
    background: #ebebeb;
    border-radius: 2px;
    margin-top: 6px;
    overflow: hidden;
}
.password-strength-fill {
    height: 100%; width: 0%;
    border-radius: 2px;
    transition: width 300ms ease, background 300ms ease;
}

/* ====== Back Button ====== */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: var(--accent);
    cursor: pointer;
    background: none; border: none;
    font-family: var(--font-sans);
    font-weight: 600;
    margin-bottom: 16px;
    padding: 0;
    transition: color 150ms ease;
}
.back-link:hover { color: var(--accent-hover); }
.back-link svg { width: 16px; height: 16px; }

/* ====== Responsive ====== */
@media (max-width: 480px) {
    .login-card-inner { padding: 24px 16px 20px; }
    .social-section { padding: 14px 16px; }
    .card-footer { padding: 12px 16px 16px; }
    .otp-input-wrap input { width: 36px; height: 40px; font-size: 16px; }
    .page-footer { position: relative; margin-top: 40px; }
}