/* ==========================================================================
   MSalon — Authentication experience (2026-08-13 redesign)

   Split-screen SaaS auth: a dark brand/product panel on the left, a clean
   centered form on the right. Built entirely on the existing --sb-* design
   tokens (business_css/style.css) rather than a parallel color system, so
   this stays visually consistent with the rest of the app instead of
   introducing a third brand-red variant.
   ========================================================================== */

.auth-shell {
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    display: flex;
    background: var(--sb-neutral-50);
}

/* ── Left: brand / product panel ─────────────────────────────────────── */

.auth-brand {
    flex: 0 0 52%;
    max-width: 720px;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 64px;
    overflow: hidden;
    color: #fff;

    /* Dark, warm gradient stands in for photography. To swap in a real salon
       photo later: set an inline `style="--auth-brand-photo:url(...)"` on
       this element (or add it here) — the gradient stays layered on top as
       a scrim, so text contrast is preserved either way. */
    --auth-brand-photo: none;
    background-image:
        linear-gradient(165deg, rgba(20, 15, 15, 0.90) 0%, rgba(43, 18, 26, 0.86) 55%, rgba(65, 19, 33, 0.92) 100%),
        var(--auth-brand-photo);
    background-size: cover;
    background-position: center;
    background-color: var(--sb-neutral-950);
}

.auth-brand::before,
.auth-brand::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
    pointer-events: none;
}

.auth-brand::before {
    width: 420px;
    height: 420px;
    background: rgba(226, 55, 92, 0.35);
    top: -140px;
    right: -120px;
}

.auth-brand::after {
    width: 320px;
    height: 320px;
    background: rgba(226, 55, 92, 0.16);
    bottom: -120px;
    left: -80px;
}

.auth-brand-content {
    position: relative;
    z-index: 1;
    max-width: 440px;
    animation: authFadeUp 0.5s var(--sb-ease) both;
}

.auth-brand-logo {
    display: flex;
    align-items: center;
    margin-bottom: 48px;
}

.auth-brand-logo img {
    height: 30px;
    width: auto;
    filter: brightness(0) invert(1);
}

.auth-brand-logo-text {
    font-family: var(--sb-font-brand);
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: #fff;
}

.auth-brand-headline {
    font-family: var(--sb-font-brand);
    font-size: 34px;
    line-height: 1.2;
    font-weight: 700;
    margin: 0 0 16px;
    color: #fff;
}

.auth-brand-subhead {
    font-size: 15px;
    line-height: 1.65;
    color: rgba(255, 255, 255, 0.72);
    margin: 0 0 32px;
    max-width: 400px;
}

.auth-brand-features {
    list-style: none;
    margin: 0 0 40px;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-brand-features li {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13.5px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.88);
}

.auth-brand-features .auth-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    border-radius: 50%;
    background: rgba(226, 55, 92, 0.28);
    color: #fda9bc;
    font-size: 11px;
}

/* Floating product-preview card */

.auth-brand-preview {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: var(--sb-radius-lg);
    padding: 20px 22px;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.28);
    animation: authFloat 6s ease-in-out infinite;
}

.auth-brand-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.auth-brand-preview-header span:first-child {
    font-size: 12.5px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
}

.auth-brand-preview-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 0 3px rgba(74, 222, 128, 0.2);
}

.auth-brand-preview-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 18px;
}

.auth-brand-preview-stats > div {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.auth-brand-preview-stats .stat-label {
    font-size: 10.5px;
    color: rgba(255, 255, 255, 0.55);
    font-weight: 500;
}

.auth-brand-preview-stats .stat-value {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    font-variant-numeric: tabular-nums;
}

.auth-brand-preview-chart {
    display: flex;
    align-items: flex-end;
    gap: 5px;
    height: 40px;
}

.auth-brand-preview-chart span {
    flex: 1;
    border-radius: 3px 3px 0 0;
    background: linear-gradient(180deg, rgba(226, 55, 92, 0.9), rgba(226, 55, 92, 0.35));
}

/* ── Right: authentication panel ─────────────────────────────────────── */

.auth-panel {
    flex: 1;
    display: flex;
    padding: 32px 24px;
    position: relative;
    overflow-y: auto;
}

.auth-panel-inner {
    width: 100%;
    max-width: 392px;
    margin: auto;
    animation: authFadeUp 0.45s var(--sb-ease) both;
}

.auth-panel-back {
    position: absolute;
    top: 28px;
    left: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid var(--sb-border);
    color: var(--sb-text-soft);
    box-shadow: var(--sb-shadow-sm);
    transition: color var(--sb-duration-fast) var(--sb-ease), border-color var(--sb-duration-fast) var(--sb-ease);
    text-decoration: none;
}

.auth-panel-back:hover {
    color: var(--sb-accent);
    border-color: var(--sb-accent-200);
}

.auth-logo-compact {
    display: flex;
    align-items: center;
    margin-bottom: 32px;
}

.auth-logo-compact img {
    height: 26px;
    width: auto;
}

.auth-logo-compact span {
    font-family: var(--sb-font-brand);
    font-size: 18px;
    font-weight: 600;
    color: var(--sb-text);
}

.auth-heading {
    font-family: var(--sb-font-brand);
    font-size: 26px;
    font-weight: 700;
    color: var(--sb-text);
    margin: 0 0 8px;
    line-height: 1.25;
}

.auth-subheading {
    font-size: 14.5px;
    color: var(--sb-text-soft);
    margin: 0 0 32px;
    line-height: 1.55;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* Segmented Business / Staff control */

.auth-segmented {
    display: flex;
    gap: 2px;
    background: var(--sb-neutral-100);
    border-radius: var(--sb-radius-md);
    padding: 3px;
    margin-bottom: 28px;
}

.auth-segmented a {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 0;
    border-radius: calc(var(--sb-radius-md) - 2px);
    font-size: 13.5px;
    font-weight: 600;
    color: var(--sb-text-soft);
    text-decoration: none;
    transition: background var(--sb-duration-fast) var(--sb-ease), color var(--sb-duration-fast) var(--sb-ease);
}

.auth-segmented a.is-active {
    background: var(--sb-accent-50);
    color: var(--sb-accent-700);
    box-shadow: var(--sb-shadow-sm);
}

.auth-segmented a:not(.is-active):hover {
    color: var(--sb-text);
}

/* Field */

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

.auth-field-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--sb-text);
}

.auth-field-input-wrap {
    position: relative;
}

.auth-field-input {
    width: 100%;
    height: 50px;
    padding: 0 16px;
    border: 1px solid var(--sb-border);
    border-radius: var(--sb-radius-lg);
    background: #fff;
    font-size: 14.5px;
    font-family: var(--sb-font-body);
    color: var(--sb-text);
    transition: border-color var(--sb-duration-fast) var(--sb-ease), box-shadow var(--sb-duration-fast) var(--sb-ease);
}

.auth-field-input::placeholder {
    color: var(--sb-neutral-400);
}

.auth-field-input:focus {
    outline: none;
    border-color: var(--sb-accent);
    box-shadow: 0 0 0 4px var(--sb-accent-50);
}

.auth-field-input.is-invalid {
    border-color: var(--sb-danger);
}

.auth-field-input.is-invalid:focus {
    box-shadow: 0 0 0 4px var(--sb-danger-soft);
}

.auth-field-input[readonly] {
    background: var(--sb-neutral-50);
    color: var(--sb-text-soft);
}

.auth-field-input.has-suffix {
    padding-right: 46px;
}

select.auth-field-input {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2378726b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

.auth-field-suffix-btn {
    position: absolute;
    right: 4px;
    top: 4px;
    bottom: 4px;
    width: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: var(--sb-radius-md);
    color: var(--sb-text-soft);
    cursor: pointer;
    transition: color var(--sb-duration-fast) var(--sb-ease), background var(--sb-duration-fast) var(--sb-ease);
}

.auth-field-suffix-btn:hover {
    color: var(--sb-text);
    background: var(--sb-neutral-100);
}

.auth-field-error {
    font-size: 12.5px;
    color: var(--sb-danger-ink);
    font-weight: 500;
}

.auth-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

/* Primary button */

.auth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 50px;
    border: none;
    border-radius: var(--sb-radius-lg);
    background: var(--sb-accent);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--sb-duration-base) var(--sb-ease), transform var(--sb-duration-fast) var(--sb-ease), box-shadow var(--sb-duration-fast) var(--sb-ease);
    text-decoration: none;
}

.auth-btn:hover {
    background: var(--sb-accent-hover);
}

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

.auth-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px var(--sb-accent-100);
}

.auth-btn:disabled,
.auth-btn.is-loading {
    opacity: 0.75;
    cursor: not-allowed;
}

.auth-btn-secondary {
    background: #fff;
    color: var(--sb-text);
    border: 1px solid var(--sb-border);
}

.auth-btn-secondary:hover {
    background: var(--sb-neutral-50);
    border-color: var(--sb-neutral-300);
}

.auth-btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.auth-spinner {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    animation: authSpin 0.7s linear infinite;
}

/* Meta rows: forgot password, create account, support */

.auth-meta-row {
    display: flex;
    justify-content: flex-end;
    margin-top: -4px;
}

.auth-link {
    font-size: 13px;
    font-weight: 600;
    color: var(--sb-text-soft);
    text-decoration: none;
    transition: color var(--sb-duration-fast) var(--sb-ease);
}

.auth-link:hover {
    color: var(--sb-accent);
}

.auth-link-accent {
    color: var(--sb-accent);
    font-weight: 600;
    text-decoration: none;
}

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

.auth-switch-line {
    text-align: center;
    font-size: 13.5px;
    color: var(--sb-text-soft);
    margin-top: 4px;
}

.auth-switch-line button {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

.auth-support-footer {
    text-align: center;
    margin-top: 32px;
    font-size: 13px;
    color: var(--sb-text-soft);
}

.auth-support-footer a {
    color: var(--sb-text-soft);
    font-weight: 600;
    text-decoration: none;
    border-bottom: 1px solid var(--sb-border);
    transition: color var(--sb-duration-fast) var(--sb-ease), border-color var(--sb-duration-fast) var(--sb-ease);
}

.auth-support-footer a:hover {
    color: var(--sb-accent);
    border-color: var(--sb-accent-200);
}

/* Staff multi-business picker */

.auth-business-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.auth-business-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 18px 12px;
    border: 1px solid var(--sb-border);
    border-radius: var(--sb-radius-lg);
    background: #fff;
    cursor: pointer;
    text-align: center;
    transition: border-color var(--sb-duration-fast) var(--sb-ease), box-shadow var(--sb-duration-fast) var(--sb-ease), transform var(--sb-duration-fast) var(--sb-ease);
}

.auth-business-card:hover {
    border-color: var(--sb-accent);
    box-shadow: var(--sb-shadow-md);
    transform: translateY(-1px);
}

.auth-business-card img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--sb-border);
}

.auth-business-card span {
    font-size: 13px;
    font-weight: 600;
    color: var(--sb-text);
    line-height: 1.3;
}

/* ── Animations (subtle only) ────────────────────────────────────────── */

@keyframes authFadeUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes authSpin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .auth-brand-content,
    .auth-panel-inner,
    .auth-brand-preview {
        animation: none;
    }
}

/* ── Responsive ───────────────────────────────────────────────────────
   Tablet and mobile both hide the marketing panel (matches the app's
   existing d-lg-* breakpoint convention) so the form gets full, focused
   width rather than being squeezed beside a half-cut visual. ── */

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

    .auth-panel {
        padding: 32px 20px;
    }
}

@media (max-width: 575.98px) {
    .auth-panel-back {
        top: 16px;
        left: 16px;
    }

    .auth-field-row {
        grid-template-columns: 1fr;
    }

    .auth-business-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* ── Fit login screens on one screen (no page scroll) on shorter viewports ── */
@media (max-height: 820px) {
    .auth-brand { padding: 32px 48px; }
    .auth-brand-logo { margin-bottom: 24px; }
    .auth-brand-headline { font-size: 30px; margin-bottom: 10px; }
    .auth-brand-subhead { margin-bottom: 18px; }
    .auth-brand-features { margin-bottom: 22px; gap: 8px; }
    .auth-brand-preview { padding: 14px 18px; }
    .auth-brand-preview-header, .auth-brand-preview-stats { margin-bottom: 10px; }
    .auth-panel { padding: 16px 24px; }
    .auth-logo-compact { margin-bottom: 18px; }
    .auth-subheading { margin-bottom: 20px; }
    .auth-segmented { margin-bottom: 18px; }
    .auth-form { gap: 14px; }
    .auth-field-input, .auth-btn { height: 46px; }
    .auth-support-footer { margin-top: 18px; }
}
@media (max-height: 660px) {
    .auth-brand-preview, .auth-brand-features { display: none; }
    .auth-logo-compact { margin-bottom: 10px; }
    .auth-heading { font-size: 22px; }
    .auth-subheading { margin-bottom: 14px; }
    .auth-form { gap: 10px; }
    .auth-field-input, .auth-btn { height: 42px; }
}

/* ── Register screen (many fields): tighter layout so it fits one screen ── */
@media (max-height: 900px) {
    .auth-panel-inner:has(.auth-field-row) .auth-logo-compact { margin-bottom: 10px; }
    .auth-panel-inner:has(.auth-field-row) .auth-heading { font-size: 22px; margin-bottom: 4px; }
    .auth-panel-inner:has(.auth-field-row) .auth-subheading { margin-bottom: 10px; font-size: 13.5px; }
    .auth-panel-inner:has(.auth-field-row) .auth-segmented { margin-bottom: 12px; }
    .auth-panel-inner:has(.auth-field-row) .auth-segmented a { padding: 6px 0; }
    .auth-panel-inner:has(.auth-field-row) .auth-form { gap: 9px; }
    .auth-panel-inner:has(.auth-field-row) .auth-field { gap: 3px; }
    .auth-panel-inner:has(.auth-field-row) .auth-field-label { font-size: 12.5px; }
    .auth-panel-inner:has(.auth-field-row) .auth-field-input,
    .auth-panel-inner:has(.auth-field-row) .auth-btn { height: 40px; font-size: 14px; }
    .auth-panel-inner:has(.auth-field-row) .auth-field-error { font-size: 11.5px; }
    .auth-panel-inner:has(.auth-field-row) .auth-switch-line { margin-top: 8px; font-size: 13px; }
    .auth-panel-inner:has(.auth-field-row) .auth-support-footer { margin-top: 8px; font-size: 12px; }
    .auth-panel:has(.auth-field-row) { padding-top: 12px; padding-bottom: 12px; }
}
@media (max-height: 640px) {
    .auth-panel-inner:has(.auth-field-row) .auth-logo-compact,
    .auth-panel-inner:has(.auth-field-row) .auth-subheading { display: none; }
    .auth-panel-inner:has(.auth-field-row) .auth-support-footer { display: none; }
}
@media (max-height: 640px) {
    .auth-panel:has(.auth-field-row) { padding-top: 8px; padding-bottom: 8px; }
    .auth-panel-inner:has(.auth-field-row) .auth-heading { font-size: 20px; }
    .auth-panel-inner:has(.auth-field-row) .auth-segmented { margin-bottom: 8px; padding: 2px; }
    .auth-panel-inner:has(.auth-field-row) .auth-segmented a { padding: 4px 0; font-size: 12.5px; }
    .auth-panel-inner:has(.auth-field-row) .auth-form { gap: 6px; }
    .auth-panel-inner:has(.auth-field-row) .auth-field { gap: 2px; }
    .auth-panel-inner:has(.auth-field-row) .auth-field-label { font-size: 12px; }
    .auth-panel-inner:has(.auth-field-row) .auth-field-input,
    .auth-panel-inner:has(.auth-field-row) .auth-btn { height: 36px; }
    .auth-panel-inner:has(.auth-field-row) .auth-switch-line { margin-top: 4px; }
}
