/* Login, register, password reset — uses :root --hms-* from auth_hms_theme.blade.php */

/* Main column: breathing room below viewport top + iOS safe area (prevents logo clipped) */
.auth-app-shell .right-col {
    padding-top: max(1.25rem, env(safe-area-inset-top, 0px)) !important;
}
@media (min-width: 640px) {
    .auth-app-shell .right-col {
        padding-top: max(1.5rem, env(safe-area-inset-top, 0px)) !important;
    }
}
@media (min-width: 768px) {
    .auth-app-shell .right-col {
        padding-top: max(1.75rem, env(safe-area-inset-top, 0px)) !important;
    }
}
.auth-app-shell .container-fluid {
    overflow-x: hidden;
    overflow-y: visible;
}

/* layouts/auth.blade.php: header sits directly in .container-fluid (no .right-col) */
.auth-app-shell .container-fluid > header.auth-shell-topbar {
    margin-top: max(0.75rem, env(safe-area-inset-top, 0px));
}

/* Auth topbar: mobile = 2-row grid (logo + language | actions); md+ = single flex row */
.auth-shell-topbar {
    overflow: visible;
}
.auth-shell-topbar__grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    gap: 0.5rem 0.5rem;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    align-items: center;
}
.auth-shell-topbar__grid-logo {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.35rem;
    overflow: visible;
}
.auth-shell-topbar__grid-lang {
    grid-column: 2;
    grid-row: 1;
    align-self: center;
    justify-self: end;
    max-width: min(11rem, 42vw);
    min-width: 0;
}
.auth-shell-topbar__grid-actions {
    grid-column: 1 / -1;
    grid-row: 2;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.35rem 0.5rem;
    min-width: 0;
}
@media (max-width: 767px) {
    .auth-shell-topbar__grid-logo,
    .auth-shell-topbar__grid-actions,
    .auth-shell-topbar__grid-lang {
        order: 0;
    }
}
@media (min-width: 768px) {
    .auth-shell-topbar__grid {
        display: flex;
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: center;
        gap: 0.75rem 1rem;
        min-height: 3rem;
    }
    /* DOM is logo → lang → actions; desktop should read: logo | actions | language */
    .auth-shell-topbar__grid-logo {
        flex: 0 0 auto;
        overflow: visible;
        order: 1;
    }
    .auth-shell-topbar__grid-actions {
        flex: 1 1 0%;
        min-width: 0;
        justify-content: flex-end;
        flex-wrap: nowrap;
        order: 2;
    }
    .auth-shell-topbar__grid-lang {
        flex: 0 0 auto;
        max-width: none;
        order: 3;
    }
}

/* Logo: never clip artwork; block img removes stray baseline gap */
.auth-app-shell .auth-logo-box {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    box-sizing: border-box;
    overflow: visible;
    flex-shrink: 0;
}
.auth-app-shell .auth-logo-box img {
    display: block;
    max-height: 2.5rem;
    max-width: 2.5rem;
    width: auto;
    height: auto;
    object-fit: contain;
}
@media (min-width: 768px) {
    .auth-app-shell .auth-logo-box img {
        max-height: 3rem;
        max-width: 3rem;
    }
}

/* Language control: readable tap target; long names ellipsize on small screens */
.auth-shell-topbar__grid .tw-dw-dropdown {
    max-width: 100%;
}
.auth-shell-topbar__grid .tw-dw-dropdown > summary {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.75rem;
    line-height: 1.25;
    list-style: none;
    min-height: 2.5rem;
    display: flex;
    align-items: center;
    padding: 0.125rem 0.25rem;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.auth-shell-topbar__grid .tw-dw-dropdown > summary::-webkit-details-marker {
    display: none;
}
@media (min-width: 768px) {
    .auth-shell-topbar__grid .tw-dw-dropdown > summary {
        font-size: 0.875rem;
        min-height: 2.25rem;
    }
}
.auth-shell-topbar__grid .tw-dw-dropdown .tw-dw-dropdown-content {
    z-index: 1080;
}

/* Login fields: same text inset left/right; password keeps extra right space for eye toggle */
.auth-app-shell #login-form .auth-login-field-input {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 1rem;
    line-height: 1.5;
    -webkit-appearance: none;
    appearance: none;
}

/* Chrome autofill can add uneven inner spacing vs password — neutralize with inset fill */
.auth-app-shell #login-form .auth-login-field-input:-webkit-autofill,
.auth-app-shell #login-form .auth-login-field-input:-webkit-autofill:hover,
.auth-app-shell #login-form .auth-login-field-input:-webkit-autofill:focus {
    -webkit-text-fill-color: #0f172a;
    box-shadow: 0 0 0 1000px #f1f5f9 inset;
    transition: background-color 99999s ease-out;
}

/* Login password visibility toggle — aligned to input on all screen sizes */
.auth-app-shell .auth-login-password-field {
    position: relative;
    width: 100%;
}
.auth-app-shell .auth-login-password-input {
    padding-right: 2.75rem;
    box-sizing: border-box;
}
.auth-app-shell .auth-login-toggle-password {
    position: absolute;
    right: 0.25rem;
    top: 50%;
    transform: translateY(-50%);
    margin: 0;
    padding: 0.25rem;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
    -webkit-tap-highlight-color: transparent;
}
.auth-app-shell .auth-login-toggle-password:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--hms-primary) 60%, #000);
    outline-offset: 2px;
    border-radius: 6px;
}

.auth-app-shell .auth-btn-primary {
    display: block;
    width: 100%;
    max-width: 100%;
    min-height: 3rem;
    border-radius: 0.75rem;
    border: none;
    margin-top: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    line-height: 1.25;
    color: #fff;
    cursor: pointer;
    background: linear-gradient(135deg, var(--hms-primary-dark), var(--hms-primary));
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    transition: filter 0.15s ease, box-shadow 0.15s ease;
}

@media (min-width: 768px) {
    .auth-app-shell .auth-btn-primary {
        font-size: 1rem;
    }
}

.auth-app-shell .auth-btn-primary:hover {
    filter: brightness(1.06);
}

.auth-app-shell .auth-btn-primary:focus {
    outline: none;
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px color-mix(in srgb, var(--hms-primary) 55%, transparent);
}

.auth-app-shell .auth-text-gradient {
    background: linear-gradient(135deg, var(--hms-primary-dark), var(--hms-primary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
}

.auth-app-shell .auth-text-gradient:hover {
    color: var(--hms-secondary);
    -webkit-text-fill-color: var(--hms-secondary);
    background: none;
    -webkit-background-clip: unset;
    background-clip: unset;
    text-decoration: underline;
}

/* jQuery Steps — Next / Finish (see public/js/login.js); .actions may be inside the form after init */
.auth-app-shell #business_register_form .actions a[href="#next"].tw-dw-btn-primary,
.auth-app-shell #business_register_form .actions a[href="#finish"].tw-dw-btn-primary,
.auth-app-shell .wizard .actions a[href="#next"].tw-dw-btn-primary,
.auth-app-shell .wizard .actions a[href="#finish"].tw-dw-btn-primary {
    background: linear-gradient(135deg, var(--hms-primary-dark), var(--hms-primary)) !important;
    border-color: var(--hms-primary) !important;
    color: #fff !important;
}

.auth-app-shell #business_register_form .actions a[href="#next"].tw-dw-btn-primary:hover,
.auth-app-shell #business_register_form .actions a[href="#finish"].tw-dw-btn-primary:hover,
.auth-app-shell .wizard .actions a[href="#next"].tw-dw-btn-primary:hover,
.auth-app-shell .wizard .actions a[href="#finish"].tw-dw-btn-primary:hover {
    filter: brightness(1.06);
}

/* Register form field groups */
.auth-app-shell #business_register_form .input-group-addon {
    background: color-mix(in srgb, var(--hms-primary) 10%, #f8fafc);
    border-color: color-mix(in srgb, var(--hms-primary) 22%, #dee2e6);
    color: var(--hms-primary-dark);
}

.auth-app-shell #business_register_form h3,
.auth-app-shell #business_register_form legend.text-black {
    color: var(--hms-primary-dark);
}

/* Login card: same visual width as forgot-password; stack labels + inputs full width */
.auth-app-shell .auth-login-form-col .tw-dw-form-control {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    max-width: 100%;
}

/* Card inputs (Tailwind-styled auth forms) */
.auth-app-shell input.tw-rounded-lg:focus,
.auth-app-shell textarea.tw-rounded-lg:focus,
.auth-app-shell select.tw-rounded-lg:focus {
    border-color: var(--hms-primary) !important;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--hms-primary) 14%, transparent) !important;
    outline: none;
}
