/* =========================================================================
 * Atadecor Auth — login / registration modal.
 *
 * Fully self-contained: the host theme is not required to expose any design
 * tokens. Override the custom properties below to match a brand.
 * ====================================================================== */

#atadecor-auth-modal,
#atadecor-auth-backdrop,
#atadecor-auth-toast {
    --atadecor-auth-primary: #1f2937;
    --atadecor-auth-on-primary: #ffffff;
    --atadecor-auth-accent: #2563eb;
    --atadecor-auth-surface: #ffffff;
    --atadecor-auth-text: #111827;
    --atadecor-auth-muted: #6b7280;
    --atadecor-auth-border: #e5e7eb;
    --atadecor-auth-danger: #dc2626;
    --atadecor-auth-success: #16a34a;
    --atadecor-auth-radius: 12px;
    --atadecor-auth-font: inherit;
}

/* ---- backdrop + shell ---- */
.atadecor-auth-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100000;
    background: rgba(0, 0, 0, .45);
    opacity: 0;
    transition: opacity .25s ease;
}
.atadecor-auth-backdrop.is-open { opacity: 1; }
.atadecor-auth-backdrop[hidden] { display: none; }

.atadecor-auth-modal {
    position: fixed;
    inset: 0;
    z-index: 100001;
    display: flex;
    align-items: stretch;
    justify-content: center;
    direction: rtl;
}
.atadecor-auth-modal[hidden] { display: none; }

@media (min-width: 768px) {
    .atadecor-auth-modal { align-items: center; padding: 16px; }
}

/* ---- card ---- */
.atadecor-auth-card {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    background: var(--atadecor-auth-surface);
    color: var(--atadecor-auth-text);
    font-family: var(--atadecor-auth-font);
    overflow-y: auto;
    opacity: 0;
    transform: translateY(12px);
    transition: opacity .22s ease, transform .22s ease;
}
.atadecor-auth-modal.is-open .atadecor-auth-card { opacity: 1; transform: translateY(0); }

@media (min-width: 768px) {
    .atadecor-auth-card {
        width: 440px;
        max-height: calc(100vh - 32px);
        border-radius: var(--atadecor-auth-radius);
        box-shadow: 0 16px 48px rgba(17, 24, 39, .22);
    }
}

/* ---- close ---- */
.atadecor-auth-close {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: transparent;
    border-radius: 999px;
    color: var(--atadecor-auth-muted);
    cursor: pointer;
    transition: background-color .2s;
    z-index: 2;
}
.atadecor-auth-close:hover { background: rgba(17, 24, 39, .08); }

/* ---- header ---- */
.atadecor-auth-header { padding: 24px 24px 12px; text-align: right; }
.atadecor-auth-heading {
    margin: 0;
    font-size: 20px;
    line-height: 28px;
    font-weight: 700;
    color: var(--atadecor-auth-text);
}

/* ---- tabs ---- */
.atadecor-auth-tabs {
    display: flex;
    padding: 0 12px;
    border-bottom: 1px solid var(--atadecor-auth-border);
}
.atadecor-auth-tab {
    position: relative;
    flex: 1 1 0;
    height: 48px;
    border: 0;
    background: transparent;
    cursor: pointer;
    font: inherit;
    font-weight: 600;
    font-size: 14px;
    color: var(--atadecor-auth-muted);
    transition: color .2s;
}
.atadecor-auth-tab.is-active { color: var(--atadecor-auth-accent); }
.atadecor-auth-tab::after {
    content: "";
    position: absolute;
    bottom: -1px;
    left: 6px;
    right: 6px;
    height: 3px;
    border-radius: 3px;
    background: var(--atadecor-auth-accent);
    opacity: 0;
    transition: opacity .2s;
}
.atadecor-auth-tab.is-active::after { opacity: 1; }

/* ---- body ---- */
.atadecor-auth-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    padding: 24px;
}
.atadecor-auth-step[hidden],
.atadecor-auth-form[hidden] { display: none; }

/* ---- fields ---- */
.atadecor-auth-field { margin-bottom: 16px; }
.atadecor-auth-label {
    display: block;
    padding: 0 4px 6px;
    text-align: right;
    font-size: 14px;
    font-weight: 600;
    color: var(--atadecor-auth-text);
}
.atadecor-auth-input-wrap { position: relative; }
.atadecor-auth-input {
    box-sizing: border-box;
    width: 100%;
    height: 48px;
    padding: 0 12px;
    border: 1px solid var(--atadecor-auth-border);
    border-radius: 8px;
    background: var(--atadecor-auth-surface);
    color: var(--atadecor-auth-text);
    font: inherit;
    font-size: 14px;
    text-align: right;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}
.atadecor-auth-input::placeholder { color: var(--atadecor-auth-muted); }
.atadecor-auth-input:focus {
    border-color: var(--atadecor-auth-accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}
.atadecor-auth-input--pw { padding-left: 44px; }

.atadecor-auth-eye {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    background: transparent;
    border-radius: 999px;
    color: var(--atadecor-auth-muted);
    cursor: pointer;
    transition: background-color .2s;
}
.atadecor-auth-eye:hover { background: rgba(17, 24, 39, .08); }

/* ---- primary button ---- */
.atadecor-auth-btn {
    width: 100%;
    height: 48px;
    border: 0;
    border-radius: 8px;
    background: var(--atadecor-auth-primary);
    color: var(--atadecor-auth-on-primary);
    font: inherit;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity .2s;
}
.atadecor-auth-btn:hover:not(:disabled) { opacity: .9; }
.atadecor-auth-btn:disabled {
    background: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
}

/* ---- OTP ---- */
.atadecor-auth-note {
    margin: 0 0 12px;
    text-align: right;
    font-size: 14px;
    color: var(--atadecor-auth-text);
}
.atadecor-auth-note span { font-weight: 700; color: var(--atadecor-auth-accent); }

.atadecor-auth-otp {
    display: flex;
    gap: 9px;
    justify-content: center;
    margin-bottom: 12px;
}
.atadecor-auth-otp input {
    box-sizing: border-box;
    flex: 1 1 0;
    min-width: 0;
    height: 52px;
    border: 1px solid var(--atadecor-auth-border);
    border-radius: 8px;
    background: var(--atadecor-auth-surface);
    color: var(--atadecor-auth-text);
    font: inherit;
    font-size: 20px;
    font-weight: 700;
    text-align: center;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}
.atadecor-auth-otp input:focus {
    border-color: var(--atadecor-auth-accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}

.atadecor-auth-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 16px;
}
.atadecor-auth-link {
    border: 0;
    padding: 0;
    background: none;
    cursor: pointer;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--atadecor-auth-accent);
}
.atadecor-auth-link:hover { text-decoration: underline; }
.atadecor-auth-link[hidden],
.atadecor-auth-timer[hidden] { display: none; }
.atadecor-auth-timer { font-size: 14px; color: var(--atadecor-auth-muted); }
.atadecor-auth-timer span { font-weight: 700; color: var(--atadecor-auth-text); }

/* ---- newsletter ---- */
.atadecor-auth-check {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    cursor: pointer;
    font-size: 14px;
    color: var(--atadecor-auth-muted);
}
.atadecor-auth-check input {
    width: 18px;
    height: 18px;
    accent-color: var(--atadecor-auth-accent);
}

/* ---- terms ---- */
.atadecor-auth-terms {
    margin: auto 0 0;
    padding-top: 16px;
    text-align: right;
    font-size: 12px;
    line-height: 24px;
    color: var(--atadecor-auth-muted);
}
.atadecor-auth-terms a {
    color: var(--atadecor-auth-accent);
    font-weight: 700;
    text-decoration: underline;
}

/* ---- toast ---- */
.atadecor-auth-toast {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(-12px);
    z-index: 100002;
    max-width: calc(100vw - 32px);
    padding: 12px 20px;
    border-radius: 8px;
    background: var(--atadecor-auth-primary);
    color: #fff;
    font-size: 14px;
    direction: rtl;
    box-shadow: 0 8px 24px rgba(17, 24, 39, .25);
    opacity: 0;
    transition: opacity .2s ease, transform .2s ease;
}
.atadecor-auth-toast[hidden] { display: none; }
.atadecor-auth-toast.is-open { opacity: 1; transform: translateX(-50%) translateY(0); }
.atadecor-auth-toast.is-error { background: var(--atadecor-auth-danger); }
.atadecor-auth-toast.is-success { background: var(--atadecor-auth-success); }

/* ---- step transition ---- */
.atadecor-auth-step { animation: atadecor-auth-fade .25s ease; }
@keyframes atadecor-auth-fade {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .atadecor-auth-step,
    .atadecor-auth-card,
    .atadecor-auth-backdrop,
    .atadecor-auth-toast { animation: none; transition: none; }
}
