/* ============================================================
   GLASSMORPHISM AUTH STYLES
   - Shared across all themes
   - Each theme overrides the --auth-* CSS variables
   ============================================================ */

/* ----- Theme Variables ----- */
.auth-theme-default {
    --auth-gradient-1: #0f172a;
    --auth-gradient-2: #1e293b;
    --auth-accent: #0d9488;
    --auth-accent-light: #14b8a6;
    --auth-accent-glow: rgba(13, 148, 136, 0.5);
    --auth-glass-bg: rgba(255, 255, 255, 0.05);
    --auth-glass-border: rgba(255, 255, 255, 0.10);
    --auth-glass-shadow: rgba(0, 0, 0, 0.3);
    --auth-text: #e2e8f0;
    --auth-text-secondary: #94a3b8;
    --auth-input-bg: rgba(255, 255, 255, 0.06);
    --auth-input-border: rgba(255, 255, 255, 0.12);
    --auth-input-focus: rgba(13, 148, 136, 0.5);
    --auth-placeholder: rgba(148, 163, 184, 0.6);
    --auth-overlay: rgba(0, 0, 0, 0.3);
    --auth-danger: #ef4444;
    --auth-social-bg: rgba(255, 255, 255, 0.08);
    --auth-social-hover: rgba(255, 255, 255, 0.14);
    --auth-check-bg: rgba(13, 148, 136, 0.2);
    --auth-check-border: rgba(13, 148, 136, 0.5);
}

.auth-theme-gold {
    --auth-gradient-1: #0a0908;
    --auth-gradient-2: #1a1814;
    --auth-accent: #B58E3C;
    --auth-accent-light: #D4AF5A;
    --auth-accent-glow: rgba(181, 142, 60, 0.5);
    --auth-glass-bg: rgba(255, 255, 255, 0.04);
    --auth-glass-border: rgba(255, 255, 255, 0.08);
    --auth-glass-shadow: rgba(0, 0, 0, 0.5);
    --auth-text: #e2e8f0;
    --auth-text-secondary: #a09080;
    --auth-input-bg: rgba(255, 255, 255, 0.05);
    --auth-input-border: rgba(255, 255, 255, 0.10);
    --auth-input-focus: rgba(181, 142, 60, 0.5);
    --auth-placeholder: rgba(160, 144, 128, 0.5);
    --auth-overlay: rgba(0, 0, 0, 0.4);
    --auth-danger: #ef4444;
    --auth-social-bg: rgba(255, 255, 255, 0.06);
    --auth-social-hover: rgba(255, 255, 255, 0.12);
    --auth-check-bg: rgba(181, 142, 60, 0.2);
    --auth-check-border: rgba(181, 142, 60, 0.5);
}

/* ----- Reset & Base ----- */
.auth-body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow-x: hidden;
}

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

/* ----- Animated Background ----- */
.auth-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
}

.auth-bg-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--auth-gradient-1) 0%, var(--auth-gradient-2) 50%, color-mix(in srgb, var(--auth-accent) 15%, var(--auth-gradient-1)) 100%);
}

.auth-grid-overlay {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 60px 60px;
}

.auth-glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    pointer-events: none;
}

.auth-glow-orb--1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--auth-accent) 0%, transparent 70%);
    top: -10%;
    right: -10%;
    opacity: 0.4;
    animation: auth-float 8s ease-in-out infinite;
}

.auth-glow-orb--2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, color-mix(in srgb, var(--auth-accent) 60%, #fff) 0%, transparent 70%);
    bottom: -15%;
    left: -10%;
    opacity: 0.3;
    animation: auth-float 12s ease-in-out infinite reverse;
}

.auth-glow-orb--3 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, color-mix(in srgb, var(--auth-accent-light) 50%, transparent) 0%, transparent 70%);
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0.2;
    animation: auth-pulse 6s ease-in-out infinite;
}

@keyframes auth-float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -40px) scale(1.05); }
    66% { transform: translate(-20px, 20px) scale(0.95); }
}

@keyframes auth-pulse {
    0%, 100% { opacity: 0.2; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 0.4; transform: translate(-50%, -50%) scale(1.2); }
}

/* Particles canvas */
#authParticles {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

/* ----- Outer Wrapper ----- */
.auth-wrapper {
    position: relative;
    z-index: 1;
    width: 100%;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    backdrop-filter: blur(2px);
}

/* ----- Glass Card ----- */
.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--auth-glass-bg);
    backdrop-filter: blur(24px) saturate(1.4);
    -webkit-backdrop-filter: blur(24px) saturate(1.4);
    border: 1px solid var(--auth-glass-border);
    border-radius: 24px;
    padding: 40px 36px;
    box-shadow:
        0 8px 32px var(--auth-glass-shadow),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    animation: auth-card-in 0.6s ease-out;
}

@keyframes auth-card-in {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ----- Wide card variant (registration, desktop only) ----- */
.auth-card--wide {
    max-width: 520px;
}

/* ----- Brand / Logo Area ----- */
.auth-brand {
    text-align: center;
    margin-bottom: 32px;
}

.auth-brand img {
    height: 36px;
    margin-bottom: 16px;
}

.auth-brand h1 {
    margin: 0 0 4px;
    font-size: 22px;
    font-weight: 700;
    color: var(--auth-text);
    letter-spacing: -0.3px;
}

.auth-brand p {
    margin: 0;
    font-size: 14px;
    color: var(--auth-text-secondary);
}

/* ----- Flash Messages ----- */
.auth-flash {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 13px;
    margin-bottom: 20px;
    text-align: center;
    line-height: 1.5;
    border: 1px solid transparent;
    animation: auth-shake 0.4s ease-out;
}

.auth-flash--success {
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(34, 197, 94, 0.3);
    color: #86efac;
}

.auth-flash--error {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.auth-flash--info {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.3);
    color: #93c5fd;
}

@keyframes auth-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-4px); }
    40% { transform: translateX(4px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

/* ----- Form ----- */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.auth-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.auth-form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--auth-text-secondary);
    letter-spacing: 0.2px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.auth-form-group label i {
    font-size: 14px;
}

.auth-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.auth-input-wrapper .auth-input-icon {
    position: absolute;
    left: 14px;
    color: var(--auth-text-secondary);
    font-size: 16px;
    pointer-events: none;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.auth-input-wrapper:focus-within .auth-input-icon {
    opacity: 1;
    color: var(--auth-accent);
}

.auth-input {
    width: 100%;
    padding: 12px 14px 12px 42px;
    background: var(--auth-input-bg);
    border: 1px solid var(--auth-input-border);
    border-radius: 12px;
    color: var(--auth-text);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: all 0.25s ease;
}

.auth-input::placeholder {
    color: var(--auth-placeholder);
}

.auth-input:focus {
    border-color: var(--auth-accent);
    box-shadow: 0 0 0 3px var(--auth-input-focus);
    background: rgba(255, 255, 255, 0.08);
}

.auth-input.input-error {
    border-color: var(--auth-danger);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2);
}

.auth-input-wrapper .auth-toggle-pass {
    position: absolute;
    right: 4px;
    background: none;
    border: none;
    color: var(--auth-text-secondary);
    padding: 8px 10px;
    cursor: pointer;
    border-radius: 8px;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.auth-input-wrapper .auth-toggle-pass:hover {
    color: var(--auth-text);
    background: rgba(255, 255, 255, 0.06);
}

.auth-input-wrapper .auth-toggle-pass:focus-visible {
    outline: 2px solid var(--auth-accent);
    outline-offset: 2px;
}

.auth-input-error {
    font-size: 12px;
    color: var(--auth-danger);
    margin: 2px 0 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ----- Form Row (2-column grid for register) ----- */
.auth-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 480px) {
    .auth-form-row {
        grid-template-columns: 1fr;
    }
}

/* ----- Row helpers (forgot password + remember) ----- */
.auth-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 14px 0 20px;
}

.auth-check {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.auth-check input[type="checkbox"] {
    appearance: none;
    width: 18px;
    height: 18px;
    border: 2px solid var(--auth-check-border);
    border-radius: 5px;
    background: var(--auth-check-bg);
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    transition: all 0.2s;
}

.auth-check input[type="checkbox"]:checked {
    background: var(--auth-accent);
    border-color: var(--auth-accent);
}

.auth-check input[type="checkbox"]:checked::after {
    content: "\f26e";
    font-family: "bootstrap-icons", "Font Awesome 6 Free", "FontAwesome", sans-serif;
    font-weight: 900;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 12px;
}

.auth-check input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--auth-accent);
    outline-offset: 2px;
}

.auth-check-label {
    font-size: 13px;
    color: var(--auth-text-secondary);
    cursor: pointer;
    user-select: none;
}

.auth-forgot-link {
    font-size: 13px;
    color: var(--auth-accent-light);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
}

.auth-forgot-link:hover {
    color: var(--auth-accent);
    text-decoration: underline;
}

.auth-forgot-link:focus-visible {
    outline: 2px solid var(--auth-accent);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ----- Gradient Submit Button ----- */
.auth-btn {
    width: 100%;
    padding: 14px 24px;
    border: none;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, var(--auth-accent), color-mix(in srgb, var(--auth-accent) 70%, var(--auth-accent-light)));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: 0.3px;
}

.auth-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, color-mix(in srgb, var(--auth-accent) 80%, #fff), var(--auth-accent-light));
    opacity: 0;
    transition: opacity 0.3s;
}

.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px var(--auth-accent-glow);
}

.auth-btn:hover::before {
    opacity: 1;
}

.auth-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 12px var(--auth-accent-glow);
}

.auth-btn:focus-visible {
    outline: 2px solid var(--auth-accent-light);
    outline-offset: 2px;
}

.auth-btn > span,
.auth-btn > i {
    position: relative;
    z-index: 1;
}

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

@keyframes auth-ripple {
    to { transform: scale(4); opacity: 0; }
}

/* ----- Social Login ----- */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0 20px;
    color: var(--auth-text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--auth-glass-border);
}

.auth-social {
    display: flex;
    gap: 12px;
}

.auth-social-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 12px;
    background: var(--auth-social-bg);
    border: 1px solid var(--auth-glass-border);
    border-radius: 12px;
    color: var(--auth-text);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}

.auth-social-btn:hover {
    background: var(--auth-social-hover);
    transform: translateY(-1px);
    border-color: rgba(255, 255, 255, 0.2);
}

.auth-social-btn:focus-visible {
    outline: 2px solid var(--auth-accent);
    outline-offset: 2px;
}

.auth-social-btn i,
.auth-social-btn svg {
    font-size: 18px;
}

/* ----- 2FA Code Input ----- */
.auth-code-input {
    font-size: 1.8rem;
    letter-spacing: 8px;
    font-weight: 700;
    text-align: center;
    font-family: 'Courier New', monospace;
    padding: 14px 16px;
}

/* ----- Info List (verify-email) ----- */
.auth-info-list {
    list-style: none;
    padding: 0;
    margin: 0 0 24px;
}

.auth-info-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 14px;
    color: var(--auth-text-secondary);
    line-height: 1.5;
}

.auth-info-list li i {
    font-size: 16px;
    flex-shrink: 0;
}

/* ----- Warning Section (disable-2fa) ----- */
.auth-warning-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    background: rgba(239, 68, 68, 0.12);
}

.auth-warning-icon i {
    font-size: 32px;
    color: #ef4444;
}

/* ----- Setup 2FA Grid ----- */
.auth-setup-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
}

@media (max-width: 768px) {
    .auth-setup-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }
}

.auth-setup-step h3 {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 12px;
    color: var(--auth-text);
}

.auth-setup-step p {
    font-size: 14px;
    color: var(--auth-text-secondary);
    margin: 0 0 16px;
    line-height: 1.5;
}

.auth-qr-box {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--auth-glass-border);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    margin-bottom: 16px;
}

.auth-qr-box img {
    max-width: 180px;
    height: auto;
    border-radius: 8px;
}

.auth-secret-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.auth-secret-row input {
    flex: 1;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--auth-glass-border);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 13px;
    color: var(--auth-text);
    font-family: 'Courier New', monospace;
    outline: none;
    transition: border-color 0.2s;
}

.auth-secret-row input:focus {
    border-color: var(--auth-accent);
}

.auth-secret-copy {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--auth-glass-border);
    border-radius: 10px;
    padding: 10px 16px;
    font-size: 13px;
    color: var(--auth-text);
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
    transition: all 0.2s;
}

.auth-secret-copy:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.auth-secret-copy:focus-visible {
    outline: 2px solid var(--auth-accent);
    outline-offset: 2px;
}

/* ----- Button variants ----- */
.auth-btn-danger {
    background: linear-gradient(135deg, #dc2626, #ef4444);
}

.auth-btn-danger:hover {
    box-shadow: 0 8px 30px rgba(239, 68, 68, 0.4);
}

/* ----- Footer link ----- */
.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 13px;
    color: var(--auth-text-secondary);
}

.auth-footer a {
    color: var(--auth-accent-light);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

.auth-footer a:hover {
    color: var(--auth-accent);
    text-decoration: underline;
}

.auth-footer a:focus-visible {
    outline: 2px solid var(--auth-accent);
    outline-offset: 2px;
    border-radius: 4px;
}

/* ----- Responsive (mobile-first polish for phones) ----- */
@media (max-width: 480px) {
    /* Natural document flow: never clips tall cards, page scrolls vertically */
    body.auth-body {
        display: block;
        overflow-x: hidden;
    }

    .auth-wrapper {
        display: block;
        min-height: 100vh;
        min-height: 100svh;
        padding: 20px 12px 32px; /* 12px side spacing -> card = calc(100% - 24px) */
    }

    .auth-card {
        width: auto;
        max-width: 390px;
        height: auto;
        margin: 0 auto; /* centered horizontally */
        padding: 26px 18px;
        border-radius: 20px;
    }

    /* Brand */
    .auth-brand {
        margin-bottom: 16px;
    }

    .auth-brand img {
        width: 180px;
        max-width: 72%;
        max-height: 52px;
        object-fit: contain;
        height: auto;
        margin-bottom: 16px;
    }

    .auth-brand h1 {
        font-size: 28px;
        line-height: 1.15;
        margin: 0 0 6px;
    }

    .auth-brand p {
        font-size: 16px;
        line-height: 1.3;
        margin-bottom: 20px;
    }

    /* Flash */
    .auth-flash {
        margin-bottom: 14px;
    }

    /* Form fields: compact grouping, 2-column rows stay side-by-side */
    .auth-form {
        gap: 2px;
    }

    .auth-form-group {
        gap: 6px;
        margin-bottom: 12px;
    }

    .auth-form-row {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .auth-input {
        min-height: 52px;
        padding: 13px 42px 13px 40px;
        font-size: 16px; /* prevents iOS focus zoom */
        border-radius: 14px;
    }

    .auth-toggle-pass {
        right: 6px;
    }

    /* Remember me + Forgot password on one line */
    .auth-row {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 8px;
        margin: 4px 0 0;
    }

    /* Submit button */
    .auth-btn {
        min-height: 54px;
        padding: 15px 20px;
        font-size: 15px;
        margin-top: 14px;
    }

    /* Divider + social buttons */
    .auth-divider {
        margin: 16px 0 12px;
    }

    .auth-social {
        flex-direction: row;
        gap: 10px;
    }

    .auth-social-btn {
        min-height: 50px;
        padding: 12px 8px;
        font-size: 13px;
    }

    .auth-footer {
        margin-top: 16px;
    }
}

/* Very narrow phones: tighten row gaps only */
@media (max-width: 360px) {
    .auth-form-row {
        gap: 8px;
    }
}

/* ----- Reduced Motion ----- */
@media (prefers-reduced-motion: reduce) {
    .auth-card,
    .auth-glow-orb,
    #authParticles {
        animation: none !important;
    }
}
