/* =============================================================================
   Maestro Calendar — Auth (login, recuperação, tenant, logout, erro)
   Split-screen: foto editorial à esquerda + card de formulário à direita.
   Cobre o markup do HubitIdentity (form-floating, remember switch, SSO, tenant).
   ============================================================================= */

.auth-body {
    margin: 0;
    min-height: 100dvh;
    font-family: var(--font-family-sans, Roboto, sans-serif);
    background: var(--bg-body, #f8fafc);
    color: var(--text-primary, #0f172a);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.auth-shell {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 4fr);
    min-height: 100dvh;
    min-height: 100svh;
}

@media (min-width: 901px) {
    .auth-shell { grid-template-rows: minmax(100dvh, auto); }
}

@media (min-width: 1600px) {
    .auth-shell { grid-template-columns: minmax(0, 1.25fr) minmax(480px, 560px); }
}

/* ------------------------------------------------------------------ */
/* Painel editorial (foto 02 — colaboração noturna)                   */
/* ------------------------------------------------------------------ */
.auth-panel--marketing {
    position: relative;
    color: #fff;
    padding: 56px 64px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    isolation: isolate;
    background-color: #0b1220;
    background-image:
        linear-gradient(180deg, rgba(7, 12, 22, .42) 0%, rgba(7, 12, 22, .58) 42%, rgba(7, 12, 22, .78) 100%),
        url("../img/login/bg-login-calendar-02.jpg");
    background-size: cover;
    background-position: center 40%;
    background-repeat: no-repeat;
}

.auth-panel--marketing::after {
    content: "";
    position: absolute;
    inset: auto -10% -20% auto;
    width: min(52vw, 520px);
    height: min(52vw, 520px);
    background: radial-gradient(circle, rgba(45, 156, 219, .28), transparent 68%);
    pointer-events: none;
    z-index: 0;
}

.auth-panel__brand,
.auth-panel__content,
.auth-panel__footer { position: relative; z-index: 1; }

.auth-panel__brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    font-size: 1.05rem;
    letter-spacing: -.01em;
}

.auth-panel__brand img {
    height: 40px;
    width: auto;
    max-width: 220px;
    object-fit: contain;
}

.auth-brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .12);
    border: 1px solid rgba(255, 255, 255, .2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .28);
}

.auth-panel__content {
    max-width: 560px;
    animation: authPanelIn 640ms cubic-bezier(.22, 1, .36, 1) both;
}

.auth-panel__eyebrow {
    margin: 0 0 12px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .72);
}

.auth-panel__title {
    margin: 0 0 16px;
    color: #fff;
    font-size: clamp(1.75rem, 3vw, 2.5rem);
    line-height: 1.15;
    font-weight: 700;
    letter-spacing: -.03em;
    text-wrap: balance;
}

.auth-panel__sub {
    margin: 0 0 32px;
    max-width: 460px;
    font-size: 1rem;
    line-height: 1.55;
    color: rgba(255, 255, 255, .78);
}

.auth-panel__features {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 12px;
}

.auth-panel__features li {
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255, 255, 255, .94);
}

.auth-panel__features i {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .16);
    color: #dbeafe;
    font-size: 13px;
}

.auth-panel__footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 12px;
    color: rgba(255, 255, 255, .58);
}

.auth-panel__footer a {
    color: rgba(255, 255, 255, .82);
    text-decoration: none;
}

.auth-panel__footer a:hover { color: #fff; }

@keyframes authPanelIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ------------------------------------------------------------------ */
/* Painel do formulário (foto 01 — workshop) + card elevado            */
/* ------------------------------------------------------------------ */
.auth-panel--form {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(32px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(32px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left));
    min-height: 100%;
    background-color: #111827;
    background-image:
        linear-gradient(180deg, rgba(15, 23, 42, .45), rgba(15, 23, 42, .62)),
        url("../img/login/bg-login-calendar-01.jpg");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

@media (min-width: 901px) {
    .auth-panel--form { min-height: 100dvh; }
}

.auth-form-shell {
    width: min(100%, 440px);
    background: var(--bg-surface, #fff);
    border: 1px solid var(--border-color-light, #e2e8f0);
    border-radius: 18px;
    padding: 40px 36px;
    box-shadow: 0 18px 48px rgba(15, 23, 42, .28);
    animation: authFormIn 520ms cubic-bezier(.22, 1, .36, 1) both;
}

@keyframes authFormIn {
    from { opacity: 0; transform: translateY(12px) scale(.99); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-form-header { margin-bottom: 24px; }
.auth-form-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -.02em;
    color: var(--text-primary, #0f172a);
    line-height: 1.2;
}
.auth-form-header p {
    margin: 8px 0 0;
    color: var(--text-tertiary, #64748b);
    font-size: .875rem;
    line-height: 1.45;
}

/* ------------------------------------------------------------------ */
/* Campos HubitIdentity / Bootstrap floating                          */
/* ------------------------------------------------------------------ */
.auth-form-body input[type="text"],
.auth-form-body input[type="email"],
.auth-form-body input[type="password"],
.auth-form-body input[type="tel"],
.auth-form-body input[type="number"],
.auth-form-body select,
.auth-form-body textarea,
.auth-form-body .form-control {
    width: 100%;
    height: 48px;
    padding: 0 14px;
    border-radius: 10px;
    border: 1px solid var(--border-color, #e2e8f0);
    background: var(--bg-surface, #fff);
    color: var(--text-primary, #0f172a);
    font: inherit;
    font-size: .9375rem;
    box-sizing: border-box;
    transition: border-color .16s ease, box-shadow .16s ease;
}

.auth-form-body textarea,
.auth-form-body textarea.form-control {
    height: auto;
    min-height: 96px;
    padding: 12px 14px;
    resize: vertical;
}

.auth-form-body .form-control:hover { border-color: var(--border-color-strong, #cbd5e1); }
.auth-form-body .form-control:focus {
    outline: none;
    border-color: var(--color-primary, #2D9CDB);
    box-shadow: var(--shadow-focus, 0 0 0 3px rgba(45, 156, 219, .22));
}

.auth-form-body .form-floating { position: relative; margin-bottom: 16px; }
.auth-form-body .form-floating > .form-control {
    height: 56px;
    padding: 20px 14px 6px;
}
.auth-form-body .form-floating > .form-control::placeholder { color: transparent; }
.auth-form-body .form-floating > label,
.auth-form-body .form-floating > .form-label {
    position: absolute;
    inset: 0 auto 0 0;
    height: 100%;
    margin: 0;
    padding: 18px 14px;
    pointer-events: none;
    color: var(--text-tertiary, #64748b);
    font-weight: 500;
    line-height: 1.2;
    transform-origin: left top;
    transition: transform .16s ease, color .16s ease;
    max-width: calc(100% - 12px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.auth-form-body .form-floating > .form-control:focus ~ label,
.auth-form-body .form-floating > .form-control:focus ~ .form-label,
.auth-form-body .form-floating > .form-control:not(:placeholder-shown) ~ label,
.auth-form-body .form-floating > .form-control:not(:placeholder-shown) ~ .form-label {
    transform: translateY(-9px) scale(.78);
    color: var(--text-secondary, #475569);
}

.auth-form-body .form-floating > .form-control:focus ~ label,
.auth-form-body .form-floating > .form-control:focus ~ .form-label {
    color: var(--color-primary, #2D9CDB);
}

.auth-form-body .hubit-pwd-toggle-wrap { position: relative; }
.auth-form-body .hubit-pwd-toggle-wrap > .form-control { padding-right: 48px; }
.auth-form-body .hubit-pwd-toggle-btn {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--text-tertiary, #64748b);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}
.auth-form-body .hubit-pwd-toggle-btn:hover {
    background: var(--bg-hover, #f1f5f9);
    color: var(--color-primary, #2D9CDB);
}

.auth-form-body .hubit-login-remember { margin-bottom: 16px; }
.auth-form-body .hubit-login-remember__label { color: var(--text-secondary, #475569); cursor: pointer; }
.auth-form-body .hubit-login-remember__input:checked + .hubit-login-remember__label .hubit-login-remember__switch {
    background: var(--color-primary, #2D9CDB);
}

.auth-form-body .d-grid { display: grid; gap: 10px; }
.auth-form-body .mt-3 { margin-top: 16px; }
.auth-form-body .mt-3 p { margin: 0 0 6px; font-size: .875rem; color: var(--text-tertiary, #64748b); }
.auth-form-body .mb-3 { margin-bottom: 16px; }
.auth-form-body .text-center { text-align: center; }

.auth-form-body .btn-primary,
.auth-form-body a.btn-primary,
.auth-form-body button[type="submit"]:not([class*="outline"]) {
    width: 100%;
    min-height: 48px;
    padding: 0 16px;
    border-radius: 10px;
    border: 1px solid var(--color-primary, #2D9CDB);
    background: var(--color-primary, #2D9CDB);
    color: #fff;
    font-weight: 600;
    font-size: .95rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    box-sizing: border-box;
    transition: background-color .16s ease, transform .08s ease, box-shadow .16s ease;
}

.auth-form-body .btn-primary:hover,
.auth-form-body a.btn-primary:hover,
.auth-form-body button[type="submit"]:not([class*="outline"]):hover {
    background: var(--color-primary-hover, #1F86C1);
    border-color: var(--color-primary-hover, #1F86C1);
    color: #fff;
}

.auth-form-body .btn-primary:active,
.auth-form-body button[type="submit"]:not([class*="outline"]):active {
    transform: translateY(1px);
}

.auth-form-body .btn-outline-secondary,
.auth-form-body a.btn-outline-secondary,
.auth-form-body .btn-outline-primary,
.auth-form-body a.btn-outline-primary {
    width: 100%;
    min-height: 48px;
    padding: 0 16px;
    border-radius: 10px;
    background: transparent;
    color: var(--text-secondary, #475569);
    border: 1px solid var(--border-color-strong, #cbd5e1);
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    box-sizing: border-box;
}

.auth-form-body .btn-outline-primary,
.auth-form-body a.btn-outline-primary {
    color: var(--color-primary, #2D9CDB);
    border-color: var(--color-primary, #2D9CDB);
}

.auth-form-body a {
    color: var(--color-primary, #2D9CDB);
    font-weight: 500;
    text-decoration: none;
}
.auth-form-body a:hover { text-decoration: underline; text-underline-offset: 3px; }
.auth-form-body a[class*="btn-"]:hover { text-decoration: none; }

.auth-form-body .text-danger,
.auth-form-body .field-validation-error {
    color: var(--color-danger, #ef4444);
    font-size: 12px;
    margin-top: 4px;
    display: block;
}

.auth-form-body .alert {
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--border-color-light, #e2e8f0);
    font-size: .875rem;
    margin-bottom: 16px;
    line-height: 1.45;
}
.auth-form-body .alert-danger {
    background: var(--color-danger-subtle, #fee2e2);
    color: #991b1b;
    border-color: rgba(239, 68, 68, .22);
}
.auth-form-body .alert-success {
    background: var(--color-success-subtle, #d1fae5);
    color: #166534;
    border-color: rgba(34, 197, 94, .22);
}
.auth-form-body .alert-info,
.auth-form-body .alert-warning {
    background: var(--color-info-subtle, #e0e7ff);
    color: #1e3a8a;
}

.auth-form-body .external-providers,
.auth-form-body .mt-4 form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.auth-form-body .mt-4 h4 { display: none; }
.auth-form-body hr,
.auth-form-body .divider {
    border: 0;
    height: 1px;
    margin: 20px 0 16px;
    background: var(--border-color-light, #e2e8f0);
    position: relative;
}
.auth-form-body .divider::after {
    content: "ou continue com";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-surface, #fff);
    padding: 0 12px;
    color: var(--text-tertiary, #64748b);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.auth-form-body .hi-tenant-pick--list {
    --hi-line: var(--border-color, #e2e8f0);
    --hi-surface-hover: var(--bg-surface-alt, #f1f5f9);
    --hi-tint: color-mix(in srgb, var(--color-primary, #2D9CDB) 16%, transparent);
    --hi-text: var(--text-primary, #0f172a);
    --hi-muted: var(--text-tertiary, #64748b);
    --hi-accent: var(--color-primary, #2D9CDB);
    --hi-accent-ink: var(--color-primary-hover, #1F86C1);
}

.auth-status {
    display: grid;
    gap: 12px;
    text-align: center;
}
.auth-status i {
    font-size: 28px;
    color: var(--color-primary, #2D9CDB);
}
.auth-status p { margin: 0; color: var(--text-secondary, #475569); line-height: 1.5; }

/* ------------------------------------------------------------------ */
/* Breakpoints: tablet, mobile, TV                                    */
/* ------------------------------------------------------------------ */
@media (max-width: 900px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-panel--marketing {
        min-height: 34vh;
        padding: 28px 22px 36px;
        gap: 20px;
        background-position: center 30%;
    }
    .auth-panel__title { font-size: 1.55rem; }
    .auth-panel__sub { margin-bottom: 16px; font-size: .9rem; }
    .auth-panel__features { display: none; }
    .auth-panel__footer { font-size: 11px; }
    .auth-panel--form {
        padding: 0 16px 32px;
        align-items: flex-start;
        background-image: none;
        background-color: var(--bg-body, #f8fafc);
    }
    .auth-form-shell {
        margin-top: -28px;
        padding: 28px 22px;
        position: relative;
        z-index: 2;
        box-shadow: 0 16px 40px rgba(15, 23, 42, .16);
    }
}

@media (max-width: 480px) {
    .auth-panel--marketing { padding: 22px 16px 32px; min-height: 30vh; }
    .auth-panel__brand img { height: 32px; }
    .auth-form-shell { padding: 22px 16px; border-radius: 16px; }
    .auth-form-header h2 { font-size: 1.3rem; }
}

@media (min-width: 1400px) {
    .auth-panel--marketing { padding: 72px 80px; }
    .auth-form-shell { max-width: 460px; padding: 44px 40px; }
}

@media (min-width: 1920px) {
    .auth-panel__title { font-size: 3rem; }
    .auth-panel--marketing { background-position: center 35%; }
}

@media (prefers-reduced-motion: reduce) {
    .auth-panel__content,
    .auth-form-shell { animation: none !important; }
}

:root[data-theme="dark"] .auth-form-shell,
:root[data-mw-theme="dark"] .auth-form-shell {
    background: var(--bg-surface);
    border-color: var(--border-color);
}

:root[data-theme="dark"] .auth-form-body .divider::after,
:root[data-mw-theme="dark"] .auth-form-body .divider::after {
    background: var(--bg-surface);
}

@media (max-width: 900px) {
    :root[data-theme="dark"] .auth-panel--form,
    :root[data-mw-theme="dark"] .auth-panel--form {
        background-color: var(--bg-body);
    }
}
