:root {
    --auth-primary: #8854f1;
    --auth-primary-dark: #6d3ce0;
    --auth-ink: #101828;
    --auth-muted: #667085;
    --auth-border: #e4e7ec;
    --auth-bg: #f9fafb;
    --auth-danger: #d92d20;
}

* {
    box-sizing: border-box;
}

html, body.auth-body {
    height: 100%;
}

body.auth-body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--auth-bg);
    color: var(--auth-ink);
}

.auth-screen {
    min-height: 100vh;
    display: flex;
}

/* Branding panel */
.auth-brand {
    position: relative;
    flex: 1 1 46%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 48px 56px;
    background: linear-gradient(155deg, var(--auth-primary-dark) 0%, var(--auth-primary) 45%, #a97bf5 100%);
    background-size: 220% 220%;
    animation: authGradientShift 16s ease-in-out infinite;
    color: #fff;
    overflow: hidden;
}

.auth-brand::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.14) 1.5px, transparent 1.5px);
    background-size: 26px 26px;
    opacity: 0.6;
    pointer-events: none;
    animation: authDotsDrift 30s linear infinite;
}

@keyframes authGradientShift {
    0% { background-position: 0% 0%; }
    50% { background-position: 100% 100%; }
    100% { background-position: 0% 0%; }
}

@keyframes authDotsDrift {
    0% { background-position: 0 0; }
    100% { background-position: 130px 130px; }
}

/* Floating decorative shapes */
.auth-float-shapes {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.auth-float-shape {
    position: absolute;
    opacity: 0.5;
    filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.12));
    animation: authFloat 7s ease-in-out infinite;
}

.auth-float-shape.s1 { top: 12%; right: 14%; animation-duration: 8s; animation-delay: 0s; }
.auth-float-shape.s2 { top: 58%; right: 28%; animation-duration: 9.5s; animation-delay: 1.2s; width: 34px; }
.auth-float-shape.s3 { top: 32%; right: 6%; animation-duration: 6.5s; animation-delay: .6s; width: 26px; }
.auth-float-shape.s4 { top: 76%; right: 10%; animation-duration: 10s; animation-delay: 2s; width: 30px; }
.auth-float-shape.s5 { top: 6%; right: 38%; animation-duration: 7.5s; animation-delay: .9s; width: 20px; }

@keyframes authFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-18px) rotate(6deg); }
}

/* Animated inventory sync graphic */
.auth-sync-graphic {
    position: relative;
    z-index: 1;
    margin: 18px 0 28px;
}

.auth-sync-graphic svg { display: block; width: 100%; max-width: 300px; height: auto; }

.auth-sync-bar {
    transform-origin: bottom;
    animation: authBarGrow 3.2s ease-in-out infinite;
}

.auth-sync-bar.b1 { animation-delay: 0s; }
.auth-sync-bar.b2 { animation-delay: .25s; }
.auth-sync-bar.b3 { animation-delay: .5s; }
.auth-sync-bar.b4 { animation-delay: .75s; }
.auth-sync-bar.b5 { animation-delay: 1s; }

@keyframes authBarGrow {
    0%, 100% { transform: scaleY(1); }
    50% { transform: scaleY(1.35); }
}

.auth-sync-dot {
    animation: authPulseDot 2.4s ease-in-out infinite;
}

@keyframes authPulseDot {
    0%, 100% { opacity: 0.4; r: 3; }
    50% { opacity: 1; r: 5; }
}

.auth-sync-path {
    stroke-dasharray: 220;
    stroke-dashoffset: 220;
    animation: authDrawPath 2.6s ease-out forwards infinite;
}

@keyframes authDrawPath {
    0% { stroke-dashoffset: 220; }
    60%, 100% { stroke-dashoffset: 0; }
}

.auth-live-badge {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .02em;
    color: rgba(255, 255, 255, 0.92);
    background: rgba(255, 255, 255, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.25);
    padding: 6px 12px;
    border-radius: 999px;
    margin-bottom: 18px;
    backdrop-filter: blur(2px);
}

.auth-live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #3dd68c;
    box-shadow: 0 0 0 0 rgba(61, 214, 140, 0.6);
    animation: authLivePulse 1.8s ease-out infinite;
}

@keyframes authLivePulse {
    0% { box-shadow: 0 0 0 0 rgba(61, 214, 140, 0.6); }
    70% { box-shadow: 0 0 0 8px rgba(61, 214, 140, 0); }
    100% { box-shadow: 0 0 0 0 rgba(61, 214, 140, 0); }
}

@media (prefers-reduced-motion: reduce) {
    .auth-brand,
    .auth-brand::before,
    .auth-float-shape,
    .auth-sync-bar,
    .auth-sync-dot,
    .auth-sync-path,
    .auth-live-dot,
    .auth-card {
        animation: none !important;
    }
}

.auth-brand-logo {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 20px;
}

.auth-brand-logo img {
    height: 32px;
    width: auto;
}

.auth-brand-copy {
    position: relative;
    z-index: 1;
    max-width: 420px;
}

.auth-brand-copy h1 {
    font-size: 32px;
    line-height: 1.25;
    font-weight: 700;
    margin: 0 0 16px;
}

.auth-brand-copy p {
    font-size: 15px;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.85);
    margin: 0 0 28px;
}

.auth-brand-features {
    position: relative;
    z-index: 1;
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 14px;
}

.auth-brand-features li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.92);
}

.auth-brand-features li svg {
    flex: none;
    margin-top: 2px;
}

.auth-brand-footer {
    position: relative;
    z-index: 1;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.65);
}

/* Form panel */
.auth-panel {
    flex: 1 1 54%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    background: #fff;
}

.auth-card {
    width: 100%;
    max-width: 380px;
    animation: authCardIn .6s cubic-bezier(.16, 1, .3, 1) both;
}

@keyframes authCardIn {
    0% { opacity: 0; transform: translateY(14px); }
    100% { opacity: 1; transform: translateY(0); }
}

.auth-card-header {
    margin-bottom: 32px;
}

.auth-card-header h2 {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 8px;
    color: var(--auth-ink);
}

.auth-card-header p {
    font-size: 14px;
    color: var(--auth-muted);
    margin: 0;
}

.auth-field {
    margin-bottom: 18px;
}

.auth-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--auth-ink);
    margin-bottom: 6px;
}

.auth-input-group {
    position: relative;
}

.auth-input-group input {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    font-size: 14px;
    border: 1px solid var(--auth-border);
    border-radius: 8px;
    background: #fff;
    color: var(--auth-ink);
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.auth-input-group input:focus {
    border-color: var(--auth-primary);
    box-shadow: 0 0 0 3px rgba(136, 84, 241, 0.15);
}

.auth-input-group input.parsley-error {
    border-color: var(--auth-danger);
}

.auth-toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: 0;
    padding: 4px;
    cursor: pointer;
    color: var(--auth-muted);
    display: flex;
}

.auth-toggle-password:hover {
    color: var(--auth-ink);
}

.auth-row-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
}

.auth-remember {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--auth-muted);
}

.auth-remember input {
    width: 16px;
    height: 16px;
    accent-color: var(--auth-primary);
}

.auth-forgot-link {
    font-size: 13px;
    font-weight: 600;
    color: var(--auth-primary);
    text-decoration: none;
}

.auth-forgot-link:hover {
    text-decoration: underline;
}

.auth-submit {
    width: 100%;
    height: 46px;
    border: 0;
    border-radius: 8px;
    background: var(--auth-primary);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background .15s ease;
}

.auth-submit:hover {
    background: var(--auth-primary-dark);
}

.auth-submit:disabled {
    opacity: .75;
    cursor: not-allowed;
}

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

.auth-footer-link a {
    color: var(--auth-primary);
    font-weight: 600;
    text-decoration: none;
}

.auth-footer-link a:hover {
    text-decoration: underline;
}

.auth-back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--auth-muted);
    text-decoration: none;
    margin-bottom: 28px;
}

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

.auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: #fef3f2;
    border: 1px solid #fecdca;
    color: var(--auth-danger);
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 13px;
    margin-bottom: 20px;
}

@media (max-width: 900px) {
    .auth-brand {
        display: none;
    }

    .auth-panel {
        flex: 1 1 100%;
    }
}

/* Wide variant (registration) */
.auth-card.wide {
    max-width: 660px;
}

.auth-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 20px;
}

@media (max-width: 560px) {
    .auth-grid-2 {
        grid-template-columns: 1fr;
    }
}

.auth-input-group select {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    font-size: 14px;
    border: 1px solid var(--auth-border);
    border-radius: 8px;
    background: #fff;
    color: var(--auth-ink);
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23667085' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.auth-input-group select:focus {
    border-color: var(--auth-primary);
    box-shadow: 0 0 0 3px rgba(136, 84, 241, 0.15);
}

/* Package summary */
.auth-package-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: var(--auth-bg);
    border: 1px solid var(--auth-border);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 24px;
}

.auth-package-summary .plan-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--auth-ink);
}

.auth-package-summary .plan-meta {
    font-size: 12px;
    color: var(--auth-muted);
    margin-top: 2px;
}

.auth-package-summary .plan-price {
    font-size: 16px;
    font-weight: 700;
    color: var(--auth-primary);
    white-space: nowrap;
}

.auth-package-summary .plan-price small {
    font-size: 11px;
    font-weight: 500;
    color: var(--auth-muted);
}

.auth-package-change {
    font-size: 12px;
    font-weight: 600;
    color: var(--auth-primary);
    text-decoration: none;
    white-space: nowrap;
}

.auth-package-change:hover {
    text-decoration: underline;
}

/* Password strength meter */
.auth-strength-meter {
    display: flex;
    gap: 4px;
    margin-top: 8px;
}

.auth-strength-meter span {
    height: 4px;
    flex: 1;
    border-radius: 2px;
    background: var(--auth-border);
    transition: background .2s ease;
}

.auth-strength-label {
    font-size: 12px;
    margin-top: 6px;
    color: var(--auth-muted);
}

.auth-strength-meter.weak span:nth-child(-n+1) { background: var(--auth-danger); }
.auth-strength-meter.fair span:nth-child(-n+2) { background: #f79009; }
.auth-strength-meter.good span:nth-child(-n+3) { background: #2e90fa; }
.auth-strength-meter.strong span { background: #12b76a; }

.auth-terms {
    font-size: 12px;
    color: var(--auth-muted);
    line-height: 1.6;
}

.auth-terms a {
    color: var(--auth-primary);
    font-weight: 600;
    text-decoration: none;
}

.auth-terms a:hover {
    text-decoration: underline;
}
