/*
 * IDSwift v2 — shared login overlay styles.
 *
 * Light theme matching the scanner / regcard / folio look (white card,
 * navy text, teal accents, Helvetica Neue). Same palette as the rest
 * of the v1 frontend so dismissing the overlay isn't a visual jump.
 *
 * Two modes (data-mode attribute on the overlay root):
 *   minimal — just a centred spinner, no card chrome. Used while we
 *             check an existing session. Logged-in users with valid
 *             access never see the full UI.
 *   full    — branded card with hotel logo, name, app badge, form
 *             (or denial state). Used when we actually need the user
 *             to act.
 *
 * Loaded by every v2 app HTML in <head> together with auth-ui.js.
 */

#idsw-auth-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: #f2f4f8;
    font-family: "Helvetica Neue", Arial, sans-serif;
    color: #13395a;
    overflow-y: auto;
    -webkit-font-smoothing: antialiased;
    transition: opacity 0.15s ease;
}

#idsw-auth-overlay[data-state="ready"] {
    opacity: 0;
    pointer-events: none;
}

/* Belt-and-braces: my `display: flex` rules below have higher specificity
   than the browser's default `[hidden] { display: none }`, which makes the
   `hidden` HTML attribute a no-op. Without this rule, _setBusy(false)
   would never visually hide the spinner-wrap (since it's display:flex by
   default). */
#idsw-auth-overlay [hidden] {
    display: none !important;
}

/* Minimal mode: only the spinner is visible — no card chrome at all.
   Used during an existing-session check; logged-in users with valid
   access never expand to the full card. */
#idsw-auth-overlay[data-mode="minimal"] .idsw-card {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
}

#idsw-auth-overlay[data-mode="minimal"] .idsw-logo-wrap,
#idsw-auth-overlay[data-mode="minimal"] .idsw-title,
#idsw-auth-overlay[data-mode="minimal"] .idsw-app-badge,
#idsw-auth-overlay[data-mode="minimal"] form,
#idsw-auth-overlay[data-mode="minimal"] .idsw-error,
#idsw-auth-overlay[data-mode="minimal"] .idsw-secondary,
#idsw-auth-overlay[data-mode="minimal"] .idsw-footer {
    display: none !important;
}

/* Full mode card — matches v1 sidebar aesthetic. */
#idsw-auth-overlay .idsw-card {
    width: 100%;
    max-width: 26rem;
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(15, 37, 64, 0.12);
    border-radius: 16px;
    padding: 2rem 1.75rem 1.75rem;
    box-shadow: 0 12px 32px rgba(15, 37, 64, 0.16);
    letter-spacing: 0.02em;
}

#idsw-auth-overlay .idsw-logo-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 96px;
    margin-bottom: 1rem;
}

#idsw-auth-overlay .idsw-logo {
    max-height: 96px;
    max-width: 220px;
    object-fit: contain;
}

#idsw-auth-overlay .idsw-logo-placeholder {
    width: 96px;
    height: 96px;
    border-radius: 14px;
    background: #d9f3ff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    font-weight: 600;
    color: #0a4255;
    letter-spacing: 0.02em;
}

#idsw-auth-overlay .idsw-title {
    margin: 0 0 0.25rem 0;
    font-size: 1.35rem;
    font-weight: 600;
    text-align: center;
    color: #13395a;
    line-height: 1.25;
}

#idsw-auth-overlay .idsw-app-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin: 0 0 1.5rem 0;
    font-size: 0.78rem;
    color: rgba(19, 85, 109, 0.78);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}

#idsw-auth-overlay .idsw-app-badge::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #2dba6a;
}

#idsw-auth-overlay form {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

#idsw-auth-overlay label {
    display: block;
    font-size: 0.72rem;
    color: rgba(19, 85, 109, 0.78);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
}

#idsw-auth-overlay input[type="email"],
#idsw-auth-overlay input[type="password"] {
    width: 100%;
    padding: 0.7rem 0.85rem;
    border-radius: 10px;
    border: 1px solid rgba(15, 37, 64, 0.18);
    background: #ffffff;
    color: #13395a;
    font-size: 0.95rem;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.15s, background-color 0.15s, box-shadow 0.15s;
}

#idsw-auth-overlay input[type="email"]:focus,
#idsw-auth-overlay input[type="password"]:focus {
    outline: none;
    border-color: #13556d;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(19, 85, 109, 0.12);
}

#idsw-auth-overlay input::placeholder { color: rgba(19, 85, 109, 0.4); }

#idsw-auth-overlay button[type="submit"] {
    margin-top: 0.6rem;
    padding: 0.8rem 1rem;
    border-radius: 10px;
    border: none;
    background: #13556d;
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background-color 0.15s, box-shadow 0.15s, opacity 0.15s,
        transform 0.05s;
}

#idsw-auth-overlay button[type="submit"]:hover:not(:disabled) {
    background: #0f4c75;
    box-shadow: 0 4px 14px rgba(15, 37, 64, 0.18);
}

#idsw-auth-overlay button[type="submit"]:active:not(:disabled) {
    transform: translateY(1px);
}

#idsw-auth-overlay button[type="submit"]:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

#idsw-auth-overlay .idsw-error {
    min-height: 1.2rem;
    margin-top: 0.5rem;
    color: #b91c1c;
    font-size: 0.85rem;
    text-align: center;
    line-height: 1.35;
}

#idsw-auth-overlay .idsw-error[hidden] { display: none; }

#idsw-auth-overlay .idsw-spinner-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
    padding: 1rem 0 0.25rem;
}

#idsw-auth-overlay .idsw-spinner {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 3px solid rgba(15, 37, 64, 0.15);
    border-top-color: #13556d;
    animation: idsw-spin 0.8s linear infinite;
}

#idsw-auth-overlay .idsw-spinner-label {
    font-size: 0.85rem;
    color: rgba(19, 85, 109, 0.78);
}

@keyframes idsw-spin { to { transform: rotate(360deg); } }

#idsw-auth-overlay .idsw-footer {
    margin-top: 1.4rem;
    text-align: center;
    font-size: 0.7rem;
    color: rgba(15, 37, 64, 0.4);
    letter-spacing: 0.04em;
}

#idsw-auth-overlay .idsw-secondary {
    margin-top: 0.85rem;
    text-align: center;
}

#idsw-auth-overlay .idsw-secondary button {
    background: none;
    border: none;
    color: #13556d;
    cursor: pointer;
    font-size: 0.8rem;
    font-family: inherit;
    padding: 0.25rem 0.5rem;
    text-decoration: underline;
    text-underline-offset: 2px;
}

#idsw-auth-overlay .idsw-secondary button:hover { color: #0f4c75; }

@media (max-width: 480px) {
    #idsw-auth-overlay .idsw-card {
        padding: 1.5rem 1.25rem 1.25rem;
        border-radius: 12px;
    }
    #idsw-auth-overlay .idsw-title { font-size: 1.2rem; }
}
