/* ==========================================================================
   AUTH PAGES — Sign In / Sign Up / Forgot / Reset
   Matches the viktohsstore.com sample (shadcn Card + Tabs geometry).
   Tailwind radii from the sample build: --radius .75rem
     .rounded-lg = 12px, .rounded-md = 10px, .rounded-xl = 12px

   NOTE: no @import here — Poppins is self-hosted in assets/fonts.
   01 · Fonts + reset
   02 · Tokens
   03 · Page shell
   04 · Head (logo / Welcome / tagline)
   05 · Tab strip (Sign In / Sign Up)
   06 · Card
   07 · Fields
   08 · Actions (submit / terms / divider / Google / footer / back)
   09 · Captcha
   10 · Dark theme
   11 · Responsive + reduced motion
   ========================================================================== */


/* ==========================================================================
   01 · FONTS + RESET
   ========================================================================== */

@font-face {
    font-family: 'Poppins';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('../../fonts/poppins-500.woff2') format('woff2');
}

@font-face {
    font-family: 'Poppins';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('../../fonts/poppins-600.woff2') format('woff2');
}

@font-face {
    font-family: 'Poppins';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('../../fonts/poppins-700.woff2') format('woff2');
}

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

html,
body {
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Poppins', ui-sans-serif, system-ui, -apple-system, 'Segoe UI',
        Roboto, 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img {
    max-width: 100%;
    border: 0;
}

a {
    text-decoration: none;
    color: inherit;
}


/* ==========================================================================
   02 · TOKENS
   ========================================================================== */

:root {
    /* Accents derive from --primary-color so auth follows the admin brand color. */
    --auth-purple: var(--primary-color);
    --auth-purple-7: color-mix(in srgb, var(--primary-color) 78%, #111827);
    --auth-purple-8: color-mix(in srgb, var(--primary-color) 64%, #111827);
    --auth-purple-50: color-mix(in srgb, var(--primary-color) 8%, #ffffff);

    --auth-bg: #f9fafb;
    --auth-surface: #ffffff;
    --auth-border: #e5e7eb;
    --auth-text: #111827;
    --auth-text-2: #4b5563;
    --auth-label: #374151;
    --auth-muted: #9ca3af;
}


/* ==========================================================================
   03 · PAGE SHELL
   ========================================================================== */

.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    width: 100%;
    padding: 40px 16px;
    background: var(--auth-bg);
    color: var(--auth-text);
}

.auth-shell {
    width: 100%;
    max-width: 448px;
    margin-inline: auto;
}


/* ==========================================================================
   04 · HEAD — logo / Welcome / tagline
   ========================================================================== */

.auth-head {
    position: relative;
    z-index: 1;
    margin-bottom: 32px;
    text-align: center;
    animation: auth-in-top 500ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

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

.auth-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.auth-logo .logo {
    height: 64px;
    width: auto;
    max-width: 100%;
    object-fit: contain;
    filter: drop-shadow(0 25px 25px rgb(0 0 0 / 0.15));
}

.auth-logo-text {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--auth-text);
    filter: drop-shadow(0 8px 16px rgb(0 0 0 / 0.1));
}

.auth-title {
    margin: 0 0 12px;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--auth-purple);
}

@media (min-width: 768px) {
    .auth-title { font-size: 30px; }
}

/* travelling highlight across the purple wordmark — narrow band so the text
   always reads as solid purple, matching the sample */
.animate-shimmer {
    background-image: linear-gradient(
        100deg,
        var(--auth-purple) 0%,
        var(--auth-purple) 47%,
        color-mix(in srgb, var(--primary-color) 55%, #ffffff) 50%,
        var(--auth-purple) 53%,
        var(--auth-purple) 100%
    );
    background-size: 220% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    animation: auth-shimmer 3.2s linear infinite;
}

@keyframes auth-shimmer {
    0%   { background-position: 120% 0; }
    100% { background-position: -20% 0; }
}

.auth-sub {
    margin: 0;
    font-size: 18px;
    font-weight: 400;
    line-height: 1.5;
    color: var(--auth-text-2);
}


/* ==========================================================================
   05 · TAB STRIP — Sign In / Sign Up
   ========================================================================== */

.auth-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: 0;
    width: 100%;
    height: 48px;
    padding: 4px;
    margin-bottom: 0;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    animation: auth-in-bottom 700ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes auth-in-bottom {
    from { opacity: 0; transform: translateY(32px); }
    to   { opacity: 1; transform: translateY(0); }
}

.auth-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    padding: 0 12px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    color: var(--auth-text);
    white-space: nowrap;
    transition: background-color 300ms ease, color 300ms ease, box-shadow 300ms ease;
}

.auth-tab i {
    width: 16px;
    height: 16px;
    font-size: 16px;
}

.auth-tab:hover {
    color: var(--auth-purple);
}

.auth-tab.is-active,
.auth-tab.is-active:hover {
    background: var(--auth-purple);
    color: #ffffff;
    box-shadow: 0 4px 10px -4px color-mix(in srgb, var(--primary-color) 60%, transparent);
}


/* ==========================================================================
   06 · CARD
   ========================================================================== */

.auth-card {
    position: relative;
    margin-top: 24px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-radius: 12px;
    -webkit-backdrop-filter: blur(24px);
    backdrop-filter: blur(24px);
    box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
    color: var(--auth-text);
}

/* forgot / reset have no tab strip above the card */
.auth-card--flush {
    margin-top: 0;
}

.auth-card-glow {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: linear-gradient(
        to bottom right,
        color-mix(in srgb, var(--auth-purple-50) 55%, transparent),
        transparent,
        color-mix(in srgb, var(--auth-purple-50) 55%, transparent)
    );
}

.auth-card-head {
    position: relative;
    z-index: 1;
    padding: 24px 24px 0;
}

.auth-card-title {
    margin: 0 0 4px;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.3;
    background: linear-gradient(to right, var(--auth-purple-7), var(--auth-purple-8));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
}

.auth-card-desc {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: var(--auth-text-2);
}

.auth-card-body {
    position: relative;
    z-index: 1;
    padding: 0 24px 24px;
}


/* ==========================================================================
   07 · FIELDS
   ========================================================================== */

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 24px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--auth-label);
}

.field-label i {
    width: 16px;
    height: 16px;
    font-size: 16px;
    color: var(--auth-purple);
}

.input-wrap {
    position: relative;
}

.input-wrap .input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 16px;
    height: 16px;
    font-size: 16px;
    line-height: 1;
    color: var(--auth-muted);
    pointer-events: none;
    transition: color 0.25s ease;
}

.input-wrap:focus-within .input-icon {
    color: var(--auth-purple);
}

.form-control {
    display: block;
    width: 100%;
    height: 48px;
    padding: 0 16px 0 44px;
    border: 2px solid var(--auth-border);
    border-radius: 12px;
    outline: none;
    background: rgba(255, 255, 255, 0.8);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    color: var(--auth-text);
    font-family: inherit;
    font-size: 15px;
    line-height: 1.5;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-control:focus {
    border-color: var(--auth-purple);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary-color) 15%, transparent);
}

.form-control::placeholder {
    color: var(--auth-muted);
    font-size: 14px;
}

.form-control:read-only {
    background: #f3f4f6;
    color: var(--auth-text-2);
    cursor: not-allowed;
}

.auth-terms {
    font-size: 13px;
    line-height: 1.55;
    color: var(--auth-text-2);
}

.auth-terms-link {
    color: var(--auth-purple);
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.auth-terms-link:hover {
    color: var(--auth-purple-7);
}


/* ==========================================================================
   08 · ACTIONS
   ========================================================================== */

.auth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 48px;
    padding: 0 18px;
    border: none;
    border-radius: 12px;
    background: var(--auth-purple);
    color: #ffffff;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 10px 15px -3px color-mix(in srgb, var(--primary-color) 40%, transparent),
        0 4px 6px -4px color-mix(in srgb, var(--primary-color) 40%, transparent);
    transition: background-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}

.auth-btn > span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.auth-btn > span i {
    width: 16px;
    height: 16px;
    font-size: 16px;
}

.auth-btn:hover {
    background: var(--auth-purple-7);
    transform: scale(1.02);
    box-shadow: 0 15px 25px -5px color-mix(in srgb, var(--primary-color) 50%, transparent),
        0 8px 10px -6px color-mix(in srgb, var(--primary-color) 50%, transparent);
}

.auth-btn:active {
    transform: scale(1);
}

.auth-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.auth-wake {
    margin: 0;
    text-align: center;
    font-size: 13px;
    color: var(--auth-purple);
    animation: auth-pulse 1.5s ease-in-out infinite;
}

@keyframes auth-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.45; }
}

/* forgot / reset helpers */
.auth-helper {
    margin: 0;
    font-size: 13px;
    color: var(--auth-text-2);
}

.auth-helper a {
    color: var(--auth-purple);
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.auth-helper a:hover {
    color: var(--auth-purple-7);
}

.auth-footer {
    display: flex;
    flex-direction: column;
    gap: 8px;
    text-align: center;
}

.auth-footer-line {
    margin: 0;
    font-size: 14px;
    color: var(--auth-text-2);
}

.auth-footer-link {
    color: var(--auth-purple);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.2s ease;
}

.auth-footer-link:hover {
    color: var(--auth-purple-7);
}

.auth-footer-link--block {
    display: block;
    font-size: 14px;
    color: var(--auth-text-2);
    text-decoration: none;
}

.auth-footer-link--block:hover {
    color: var(--auth-purple);
}

/* OR divider */
.auth-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    width: 100%;
}

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

.auth-divider span {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--auth-muted);
}

/* Google */
.auth-google-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: 48px;
    padding: 0 16px;
    background: rgba(255, 255, 255, 0.85);
    border: 2px solid var(--auth-border);
    border-radius: 12px;
    color: var(--auth-text);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

.auth-google-btn:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    transform: translateY(-1px);
}

.auth-google-btn svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* back link under the card */
.auth-back {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 24px;
    font-size: 14px;
    font-weight: 500;
    color: var(--auth-text-2);
    transition: color 0.2s ease;
}

.auth-back:hover {
    color: var(--auth-purple);
}

.auth-back i {
    width: 16px;
    height: 16px;
    font-size: 16px;
}


/* ==========================================================================
   09 · CAPTCHA
   ========================================================================== */

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

.captcha-row .form-control {
    flex: 1 1 auto;
    min-width: 0;
}

.captcha-text {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 92px;
    height: 48px;
    padding: 0 12px;
    border: 2px solid var(--auth-border);
    border-radius: 12px;
    background: var(--auth-purple-50);
    color: var(--auth-purple-8);
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 3px;
    user-select: none;
}

.captcha-refresh {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 2px solid var(--auth-border);
    border-radius: 12px;
    background: var(--auth-surface);
    color: var(--auth-purple);
    font-size: 18px;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.captcha-refresh:hover {
    background: var(--auth-purple-50);
    border-color: var(--auth-purple);
}


/* ==========================================================================
   10 · DARK THEME (auth.js restores the saved preference)
   ========================================================================== */

.logo-light { display: inline-block; }
.logo-dark  { display: none; }

[data-theme='dark'] .logo-light { display: none; }
[data-theme='dark'] .logo-dark  { display: inline-block; }

[data-theme='dark'] body,
[data-theme='dark'] .auth-container {
    background: #09090b;
    color: #f9fafb;
}

[data-theme='dark'] .auth-title {
    color: color-mix(in srgb, var(--primary-color) 60%, #ffffff);
}

[data-theme='dark'] .auth-sub,
[data-theme='dark'] .auth-card-desc,
[data-theme='dark'] .auth-terms,
[data-theme='dark'] .auth-footer-line,
[data-theme='dark'] .auth-helper {
    color: #9ca3af;
}

[data-theme='dark'] .auth-logo-text {
    color: #f9fafb;
}

[data-theme='dark'] .auth-tabs {
    background: rgba(0, 0, 0, 0.9);
}

[data-theme='dark'] .auth-tab {
    color: #d1d5db;
}

[data-theme='dark'] .auth-tab:hover {
    color: color-mix(in srgb, var(--primary-color) 60%, #ffffff);
}

[data-theme='dark'] .auth-card {
    background: rgba(9, 9, 11, 0.95);
    border-color: rgba(39, 39, 42, 0.9);
}

[data-theme='dark'] .auth-card-glow {
    background: linear-gradient(
        to bottom right,
        color-mix(in srgb, var(--primary-color) 28%, transparent),
        transparent,
        color-mix(in srgb, var(--primary-color) 28%, transparent)
    );
}

[data-theme='dark'] .auth-card-title {
    background: linear-gradient(
        to right,
        color-mix(in srgb, var(--primary-color) 62%, #ffffff),
        color-mix(in srgb, var(--primary-color) 45%, #f472b6)
    );
    -webkit-background-clip: text;
    background-clip: text;
}

[data-theme='dark'] .field-label {
    color: #d1d5db;
}

[data-theme='dark'] .form-control,
[data-theme='dark'] .auth-google-btn {
    background: rgba(9, 9, 11, 0.8);
    border-color: #27272a;
    color: #f9fafb;
}

[data-theme='dark'] .form-control:focus {
    border-color: var(--auth-purple);
}

[data-theme='dark'] .form-control:read-only {
    background: #18181b;
    color: #71717a;
}

[data-theme='dark'] .captcha-text {
    background: color-mix(in srgb, var(--primary-color) 35%, transparent);
    border-color: #27272a;
    color: color-mix(in srgb, var(--primary-color) 45%, #ffffff);
}

[data-theme='dark'] .captcha-refresh {
    background: #18181b;
    border-color: #27272a;
    color: color-mix(in srgb, var(--primary-color) 60%, #ffffff);
}

[data-theme='dark'] .auth-divider::before,
[data-theme='dark'] .auth-divider::after {
    background: #27272a;
}


/* ==========================================================================
   11 · RESPONSIVE + REDUCED MOTION
   ========================================================================== */

@media (max-width: 480px) {
    .auth-container {
        align-items: flex-start;
        padding: 28px 16px 40px;
    }

    .auth-logo .logo {
        height: 56px;
    }

    .auth-title {
        font-size: 22px;
    }

    .auth-sub {
        font-size: 15px;
    }

    .auth-tab {
        font-size: 13px;
        gap: 6px;
    }

    .auth-card-head {
        padding: 20px 20px 0;
    }

    .auth-card-body {
        padding: 0 20px 20px;
    }

    .auth-card-title {
        font-size: 22px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .auth-container,
    .auth-container * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .animate-shimmer {
        background-image: none;
        color: var(--auth-purple);
        -webkit-text-fill-color: currentColor;
    }
}
