/* ==========================================================================
   Modern Auth Styles (Login, Register & Account Recovery Split-Card Experience)
   Colors dynamically inherit from admin settings (--primary, --primary-*, etc.)
   ========================================================================== */

:root {
    --auth-card-bg: #ffffff;
    --auth-card-shadow: 0 25px 60px -15px rgba(15, 23, 42, 0.12), 0 0 0 1px rgba(15, 23, 42, 0.05);
    --auth-visual-bg: var(--primary-50, #eff4ff);
    --auth-text-title: #0f172a;
    --auth-text-subtitle: #64748b;
    --auth-text-muted: #94a3b8;
    --auth-input-bg: #f8fafc;
    --auth-input-border: #e2e8f0;
    --auth-input-color: #1e293b;
    --auth-input-placeholder: #94a3b8;
    --auth-border-subtle: #f1f5f9;
    --auth-social-bg: #f8fafc;
    --auth-accent: var(--primary, #0051ff);
    --auth-accent-hover: var(--primary-600, #0055ff);
    --auth-accent-gradient: linear-gradient(135deg, var(--primary, #0051ff) 0%, var(--primary-700, #0452ec) 100%);
    --auth-accent-shadow: 0 10px 24px -6px color-mix(in srgb, var(--primary, #0051ff) 40%, transparent);
}

[data-theme-style="dark"] {
    --auth-card-bg: #1e293b;
    --auth-card-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.07);
    --auth-visual-bg: var(--primary-100, #0e4062);
    --auth-text-title: #f8fafc;
    --auth-text-subtitle: #94a3b8;
    --auth-text-muted: #64748b;
    --auth-input-bg: #0f172a;
    --auth-input-border: #334155;
    --auth-input-color: #f8fafc;
    --auth-input-placeholder: #64748b;
    --auth-border-subtle: #334155;
    --auth-social-bg: #0f172a;
    --auth-accent: var(--primary, #0448d0);
    --auth-accent-hover: var(--primary-600, #2bb3f7);
    --auth-accent-gradient: linear-gradient(135deg, var(--primary, #0448d0) 0%, var(--primary-800, #0246cd) 100%);
    --auth-accent-shadow: 0 10px 24px -6px color-mix(in srgb, var(--primary, #0448d0) 35%, transparent);
}

/* Outer layout wrapper override */
.auth-modern-wrapper {
    max-width: 980px;
    margin: 0 auto;
    width: 100%;
}

/* Split-card container */
.auth-card {
    position: relative;
    display: flex;
    min-height: 620px;
    background: var(--auth-card-bg);
    border-radius: 28px;
    box-shadow: var(--auth-card-shadow);
    overflow: hidden;
    width: 100%;
    margin-bottom: 2.5rem;
    transition: box-shadow 0.3s ease;
}

/* Left/Right Panels */
.auth-panel-visual {
    flex: 0 0 45%;
    max-width: 45%;
    position: relative;
    background: var(--auth-visual-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: transform 0.65s cubic-bezier(0.65, 0, 0.35, 1);
    z-index: 2;
}

.auth-panel-content {
    flex: 0 0 55%;
    max-width: 55%;
    padding: 3rem 3.25rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    transition: transform 0.65s cubic-bezier(0.65, 0, 0.35, 1);
    z-index: 1;
}

/* Sliding transitions */
.auth-card.is-register .auth-panel-visual {
    transform: translateX(122.22%);
}

.auth-card.is-register .auth-panel-content {
    transform: translateX(-81.82%);
}

/* Forms visibility & switching */
.auth-form-wrapper {
    width: 100%;
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.auth-card.is-login .auth-login-form {
    display: block;
    opacity: 1;
    transform: translateX(0);
}

.auth-card.is-login .auth-register-form {
    display: none;
    opacity: 0;
    transform: translateX(25px);
}

.auth-card.is-register .auth-login-form {
    display: none;
    opacity: 0;
    transform: translateX(-25px);
}

.auth-card.is-register .auth-register-form {
    display: block;
    opacity: 1;
    transform: translateX(0);
}

/* Headers & Microcopy */
.auth-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--auth-text-title);
    letter-spacing: -0.02em;
    margin-bottom: 0.35rem;
}

.auth-subtitle {
    font-size: 0.95rem;
    color: var(--auth-text-subtitle);
    margin-bottom: 1.75rem;
    line-height: 1.5;
}

/* Pill Form Inputs */
.auth-input-group {
    position: relative;
    margin-bottom: 1.15rem;
}

.auth-input-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--auth-text-title);
    margin-bottom: 0.4rem;
}

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

.auth-input-icon {
    position: absolute;
    left: 1.15rem;
    color: var(--auth-text-muted);
    font-size: 0.95rem;
    pointer-events: none;
    transition: color 0.2s ease;
    z-index: 2;
}

.auth-input-control {
    width: 100%;
    height: 48px;
    padding: 0.65rem 1.25rem 0.65rem 2.85rem;
    font-size: 0.95rem;
    border-radius: 9999px;
    border: 1.5px solid var(--auth-input-border);
    background: var(--auth-input-bg);
    color: var(--auth-input-color);
    transition: all 0.2s ease;
}

.auth-input-control:hover {
    border-color: #cbd5e1;
}

.auth-input-control:focus {
    outline: none;
    border-color: var(--auth-accent);
    background: var(--auth-card-bg);
    box-shadow: 0 0 0 3.5px color-mix(in srgb, var(--auth-accent) 20%, transparent);
}

.auth-input-control:focus + .auth-input-icon,
.auth-input-control:focus ~ .auth-input-icon {
    color: var(--auth-accent);
}

.auth-input-toggle-password {
    position: absolute;
    right: 1rem;
    background: none;
    border: none;
    color: var(--auth-text-muted);
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    font-size: 0.9rem;
    transition: color 0.2s ease;
    z-index: 2;
}

.auth-input-toggle-password:hover {
    color: var(--auth-text-title);
}

/* Main CTA Button */
.auth-btn-primary {
    width: 100%;
    height: 48px;
    border-radius: 9999px;
    font-size: 1rem;
    font-weight: 600;
    color: #ffffff !important;
    background: var(--auth-accent-gradient);
    border: none;
    box-shadow: var(--auth-accent-shadow);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 0.5rem;
}

.auth-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 28px -6px color-mix(in srgb, var(--auth-accent) 55%, transparent);
    filter: brightness(1.05);
}

.auth-btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 6px 14px -3px color-mix(in srgb, var(--auth-accent) 40%, transparent);
}

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

/* Secondary Meta Links */
.auth-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    margin-bottom: 1.15rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.auth-switch-link {
    color: var(--auth-accent);
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s ease;
    cursor: pointer;
}

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

/* Social Buttons */
.auth-divider {
    display: flex;
    align-items: center;
    margin: 1.5rem 0 1.25rem 0;
    color: var(--auth-text-muted);
    font-size: 0.825rem;
}

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

.auth-divider span {
    padding: 0 0.85rem;
    white-space: nowrap;
}

.auth-social-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
}

.auth-social-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--auth-social-bg);
    border: 1.5px solid var(--auth-input-border);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
}

.auth-social-btn:hover {
    transform: translateY(-2px);
    border-color: var(--auth-accent);
    background: var(--auth-card-bg);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
}

.auth-social-btn img {
    width: 18px;
    height: 18px;
    display: block;
}

/* Social Pill Buttons (for register_only_social_logins) */
.auth-social-pill-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
    margin-top: 0.5rem;
}

.auth-social-pill-btn {
    width: 100%;
    height: 48px;
    border-radius: 9999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--auth-text-title) !important;
    background: var(--auth-input-bg);
    border: 1.5px solid var(--auth-input-border);
    text-decoration: none !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0 1.25rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.auth-social-pill-btn:hover {
    transform: translateY(-2px);
    border-color: var(--auth-accent);
    background: var(--auth-card-bg);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    color: var(--auth-text-title) !important;
}

.auth-social-pill-btn img {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Character Scene & SVG styles */
.auth-character-scene {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 520px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    overflow: hidden;
}

.auth-shelf-tab {
    position: absolute;
    bottom: -20px;
    width: 120%;
    height: 160px;
    background: var(--auth-accent-gradient);
    border-top-left-radius: 120px;
    border-top-right-radius: 120px;
    box-shadow: 0 -15px 40px -10px color-mix(in srgb, var(--auth-accent) 40%, transparent);
    z-index: 1;
}

.auth-character-svg {
    position: relative;
    width: 82%;
    max-width: 320px;
    height: auto;
    z-index: 2;
    overflow: visible;
    margin-bottom: 25px;
}

/* Character Keyframes */
@keyframes charFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-6px);
    }
}

@keyframes eyeBlink {
    0%, 92%, 100% {
        transform: scaleY(1);
    }
    95% {
        transform: scaleY(0.08);
    }
}

@keyframes handWave {
    0%, 100% {
        transform: rotate(0deg);
    }
    20% {
        transform: rotate(-14deg);
    }
    40% {
        transform: rotate(18deg);
    }
    60% {
        transform: rotate(-10deg);
    }
    80% {
        transform: rotate(12deg);
    }
}

@keyframes sparkleTwinkle {
    0%, 100% {
        opacity: 0.25;
        transform: scale(0.7) rotate(0deg);
    }
    50% {
        opacity: 1;
        transform: scale(1.15) rotate(45deg);
    }
}

.char-body-group {
    animation: charFloat 4s ease-in-out infinite;
    transform-origin: center bottom;
}

.char-eyes {
    animation: eyeBlink 3.6s ease-in-out infinite;
    transform-origin: 170px 152px;
}

/* Sparkles */
.auth-sparkle {
    position: absolute;
    color: var(--auth-accent);
    animation: sparkleTwinkle 3s ease-in-out infinite;
    pointer-events: none;
    user-select: none;
    z-index: 3;
}

.auth-sparkle-1 {
    top: 18%;
    left: 14%;
    font-size: 1.4rem;
    animation-delay: 0s;
}

.auth-sparkle-2 {
    top: 26%;
    right: 14%;
    font-size: 1.8rem;
    color: var(--primary-400, var(--auth-accent));
    animation-delay: 1.2s;
}

.auth-sparkle-3 {
    top: 48%;
    left: 12%;
    font-size: 1rem;
    color: var(--primary-300, var(--auth-accent));
    animation-delay: 2.1s;
}

/* Character Poses switching */
.auth-card.is-login .char-hand-waving {
    display: none;
}

.auth-card.is-login .char-hand-peeking-right {
    display: block;
}

.auth-card.is-register .char-hand-peeking-right {
    display: none;
}

.auth-card.is-register .char-hand-waving {
    display: block;
}

.auth-card.is-register .char-waving-palm {
    animation: handWave 1.8s ease-in-out infinite;
    transform-origin: 275px 200px;
}

/* Mobile & Responsive Breakpoints */
@media (max-width: 860px) {
    .auth-card {
        flex-direction: column;
        min-height: auto;
        border-radius: 20px;
        margin-bottom: 3.5rem;
    }

    .auth-panel-visual {
        flex: 0 0 auto;
        max-width: 100%;
        width: 100%;
        height: 180px;
        order: 1 !important;
        transform: none !important;
    }

    .auth-panel-content {
        flex: 1 1 auto;
        max-width: 100%;
        width: 100%;
        padding: 2rem 1.5rem;
        order: 2 !important;
        transform: none !important;
    }

    .auth-character-scene {
        min-height: 180px;
        height: 180px;
    }

    .auth-shelf-tab {
        height: 80px;
        border-top-left-radius: 60px;
        border-top-right-radius: 60px;
    }

    .auth-character-svg {
        max-width: 170px;
        margin-bottom: 5px;
    }
}

/* Accessibility & Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .auth-panel-visual,
    .auth-panel-content,
    .char-body-group,
    .char-eyes,
    .char-waving-palm,
    .auth-sparkle,
    .auth-form-wrapper {
        animation: none !important;
        transition: none !important;
    }
}
