/* ═══════════════════════════════════════════════════
   Mailada — Auth Pages Design
   ═══════════════════════════════════════════════════ */

:root {
    --primary: #7c3aed;
    --primary-light: #a78bfa;
    --primary-glow: rgba(124, 58, 237, 0.25);
    --accent: #06d6a0;

    --bg-deep: #06070a;
    --bg-surface: #12151e;
    --bg-elevated: #1a1e2e;

    --glass-border: rgba(255, 255, 255, 0.07);
    --glass-strong: rgba(255, 255, 255, 0.08);

    --text-main: #f0f0f5;
    --text-secondary: #b0b3c6;
    --text-muted: #6b7094;

    --border: rgba(255, 255, 255, 0.06);
    --danger: #ef4444;

    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 999px;
}

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 15px;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg-deep);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-font-smoothing: antialiased;
    position: relative;
    overflow-y: auto;
}

/* Animated mesh background */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(ellipse at 30% 40%, rgba(124, 58, 237, 0.12) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 60%, rgba(6, 214, 160, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 20%, rgba(59, 130, 246, 0.06) 0%, transparent 50%);
    animation: meshFloat 25s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes meshFloat {

    0%,
    100% {
        transform: translate(0, 0) rotate(0deg);
    }

    33% {
        transform: translate(3%, -2%) rotate(1deg);
    }

    66% {
        transform: translate(-2%, 3%) rotate(-1deg);
    }
}

/* Auth Container */
.auth-container {
    position: relative;
    z-index: 1;
    width: min(520px, 92vw);
    padding: 2rem 0;
}

/* Logo */
.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;
    margin-bottom: 2rem;
    animation: fadeDown 0.6s ease both;
}

.auth-logo .logo-icon {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 40px var(--primary-glow);
}

.auth-logo .logo-icon svg {
    width: 22px;
    height: 22px;
}

.auth-logo .logo-text {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, #fff 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Card */
.auth-card {
    background: var(--bg-surface);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 2.5rem 2rem;
    box-shadow:
        0 24px 64px rgba(0, 0, 0, 0.5),
        0 0 80px rgba(124, 58, 237, 0.08);
    animation: fadeUp 0.5s ease both;
    animation-delay: 0.1s;
}

.auth-card h2 {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.4rem;
}

.auth-card .subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

/* ── OAuth Buttons ─────────────────────────────── */
.oauth-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 1.5rem;
}

.btn-oauth {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
    border: 1px solid var(--border);
}

.btn-google {
    background: white;
    color: #3c4043;
}

.btn-google:hover {
    background: #f8f9fa;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-1px);
}

.btn-microsoft {
    background: var(--bg-deep);
    color: var(--text-main);
    border-color: var(--glass-border);
}

.btn-microsoft:hover {
    background: var(--bg-elevated);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: translateY(-1px);
}

/* ── Divider ───────────────────────────────────── */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.25rem 0;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.auth-divider span {
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

/* ── Form ──────────────────────────────────────── */
.form-group {
    margin-bottom: 1rem;
    flex: 1;
}

.form-group label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.35rem;
}

.form-input {
    width: 100%;
    background: var(--bg-deep);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.65rem 0.9rem;
    color: var(--text-main);
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-input::placeholder {
    color: var(--text-muted);
}

select.form-input {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none' stroke='%236b7094' stroke-width='2'%3E%3Cpath d='M3 5l3 3 3-3'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
}

/* Form rows */
.form-row {
    display: flex;
    gap: 0.75rem;
}

.form-group-sm {
    flex: 0 0 100px;
}

/* Form hints */
.form-hint {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

/* Server fields section */
.server-fields {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 0.5rem;
}

.server-fields-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
}

/* Remember me / extras */
.form-extras {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
}

.checkbox-group input[type="checkbox"] {
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Buttons */
.btn-auth {
    width: 100%;
    padding: 0.8rem;
    background: linear-gradient(135deg, var(--primary), #9333ea);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.35);
}

.btn-auth:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 30px rgba(124, 58, 237, 0.5);
}

.btn-auth:active {
    transform: translateY(0);
}

/* Footer */
.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    animation: fadeUp 0.5s ease both;
    animation-delay: 0.2s;
}

.auth-footer a {
    color: var(--primary-light);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease;
}

.auth-footer a:hover {
    color: white;
}

/* Errors */
.auth-errors {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
    color: #fca5a5;
}

.auth-errors ul {
    list-style: none;
}

.auth-errors li::before {
    content: '• ';
    color: var(--danger);
}

/* Animations */
@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeDown {
    from {
        opacity: 0;
        transform: translateY(-16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 99px;
}

/* ── Responsive: iPhone SE & small phones (≤375px) ── */
@media (max-width: 375px) {
    html {
        font-size: 14px;
    }

    .auth-container {
        width: 100vw;
        padding: 1rem 0;
    }

    .auth-card {
        padding: 1.5rem 1.25rem;
        border-radius: 16px;
    }

    .auth-card h2 {
        font-size: 1.2rem;
    }

    .auth-card .subtitle {
        font-size: 0.82rem;
    }

    .auth-logo {
        margin-bottom: 1.25rem;
        gap: 0.5rem;
    }

    .auth-logo .logo-icon {
        width: 36px;
        height: 36px;
    }

    .auth-logo .logo-text {
        font-size: 1.3rem;
    }

    .btn-oauth {
        padding: 0.65rem 0.8rem;
        font-size: 0.82rem;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .form-group-sm {
        flex: 1;
    }

    .form-input {
        padding: 0.6rem 0.75rem;
        font-size: 0.85rem;
    }

    .btn-auth {
        padding: 0.7rem;
        font-size: 0.88rem;
    }

    .auth-footer {
        font-size: 0.82rem;
    }

    .server-fields {
        padding: 0.75rem;
    }

    .form-extras {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }
}

/* ── Responsive: Large phones (376px–480px) ── */
@media (min-width: 376px) and (max-width: 480px) {
    html {
        font-size: 14.5px;
    }

    .auth-container {
        width: 95vw;
    }

    .auth-card {
        padding: 2rem 1.5rem;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .form-group-sm {
        flex: 1;
    }

    .form-extras {
        gap: 0.5rem;
    }
}

/* ── Responsive: Small tablets (481px–768px) ── */
@media (min-width: 481px) and (max-width: 768px) {
    .auth-container {
        width: min(480px, 90vw);
    }

    .auth-card {
        padding: 2.25rem 1.75rem;
    }
}

/* ── Responsive: Large desktops (1440px+) ── */
@media (min-width: 1440px) {
    html {
        font-size: 16px;
    }

    .auth-container {
        width: min(560px, 92vw);
    }

    .auth-card {
        padding: 3rem 2.5rem;
    }
}