/* styles/login.css
 *
 * Styling for the login overlay only. Every selector is prefixed `ui-` and
 * scoped under #fpbx-login-root, so nothing here can reach the phone UI.
 *
 * phone.css is treated as protected in this project (README, "Notes") — it is
 * not touched. These rules replace the inline styles the overlay used to carry
 * in index.html.
 *
 * The tokens below reproduce the previous overlay's palette exactly, so the
 * migration is visually identical.
 */

#fpbx-login-root {
    --ui-backdrop:     #1a1230;
    --ui-header-bg:    #1e293b;
    --ui-surface:      #ffffff;
    --ui-text:         #1e293b;
    --ui-text-muted:   #64748b;
    --ui-text-subtle:  #94a3b8;
    --ui-text-body:    #475569;
    --ui-primary:      #2563eb;
    --ui-primary-fg:   #ffffff;
    --ui-border:       #d1d5db;
    --ui-danger:       #ef4444;
    --ui-warning:      #f59e0b;
    --ui-success:      #22c55e;
    --ui-radius:       8px;
    --ui-radius-lg:    16px;

    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ── Layout ─────────────────────────────────────────────────────────────── */

.ui-backdrop {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: var(--ui-backdrop);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 16px;
    box-sizing: border-box;
    overflow-y: auto;
}

.ui-card {
    background: var(--ui-surface);
    border-radius: var(--ui-radius-lg);
    box-shadow: 0 8px 32px rgba(0, 0, 0, .2);
    max-width: 380px;
    width: 100%;
    overflow: hidden;
}

.ui-card__header {
    background: var(--ui-header-bg);
    padding: 28px;
    text-align: center;
}

.ui-card__logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    filter: drop-shadow(0 0 14px rgba(201, 114, 173, .6));
    margin-bottom: 8px;
}

.ui-card__title {
    margin: 0;
    color: #fff;
    font-size: 22px;
    font-weight: 700;
}

.ui-card__subtitle {
    margin: 6px 0 0;
    color: var(--ui-text-subtle);
    font-size: 13px;
}

.ui-card__body { padding: 32px 28px; }

/* ── Text ───────────────────────────────────────────────────────────────── */

.ui-prompt {
    margin: 0 0 20px;
    color: var(--ui-text-body);
    font-size: 14px;
    text-align: center;
}

/* ── Fields ─────────────────────────────────────────────────────────────── */

.ui-field {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius);
    font-size: 15px;
    outline: none;
    box-sizing: border-box;
    margin-bottom: 16px;
    background: var(--ui-surface);
    color: var(--ui-text);
}

select.ui-field { cursor: pointer; }

.ui-field:focus { border-color: var(--ui-primary); }

.ui-field:disabled {
    background: #f8fafc;
    color: var(--ui-text-muted);
    cursor: not-allowed;
}

/* ── Buttons ────────────────────────────────────────────────────────────── */

.ui-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px;
    border: none;
    border-radius: var(--ui-radius);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.ui-btn--block { width: 100%; }

.ui-btn--primary {
    background: var(--ui-primary);
    color: var(--ui-primary-fg);
}

.ui-btn--secondary {
    background: #e2e8f0;
    color: var(--ui-text);
}

.ui-btn--ghost {
    background: transparent;
    color: var(--ui-primary);
}

.ui-btn:disabled {
    opacity: .65;
    cursor: default;
}

/* ── Notices ────────────────────────────────────────────────────────────── */

.ui-notice {
    margin-top: 20px;
    text-align: center;
    font-size: 13px;
    color: var(--ui-text-muted);
}

.ui-notice__icon { margin-bottom: 8px; font-size: 20px; }

.ui-notice__title { font-weight: 600; margin-bottom: 4px; }

.ui-notice--info    .ui-notice__icon  { color: var(--ui-primary); }
.ui-notice--info    .ui-notice__title { color: var(--ui-text); }
.ui-notice--error   { color: var(--ui-danger); font-weight: 500; }
.ui-notice--warning { color: var(--ui-warning); font-weight: 600; }
.ui-notice--success .ui-notice__icon,
.ui-notice--success .ui-notice__title { color: var(--ui-success); font-size: 20px; }
.ui-notice--success .ui-notice__title { font-size: 14px; }

.ui-countdown {
    margin-top: 8px;
    color: var(--ui-primary);
    font-weight: 700;
    font-size: 18px;
    text-align: center;
}

/* ── Login trace panel ───────────────────────────────────────────────────────
   Only rendered for accounts with tracing enabled, so it never reaches a
   normal user. Deliberately plain and scrollable: it exists to be read and
   copied, not to look good. phone.css is protected and untouched.          */
#fpbx-login-root .ui-debug {
    margin-top: 16px;
    border: 1px solid rgba(122, 42, 143, 0.35);
    border-radius: 8px;
    background: #10131a;
    color: #d7dae0;
    text-align: left;
    overflow: hidden;
}
#fpbx-login-root .ui-debug-title {
    padding: 8px 12px;
    background: rgba(122, 42, 143, 0.25);
    font: 600 12px/1.4 system-ui, sans-serif;
    letter-spacing: .04em;
}
#fpbx-login-root .ui-debug-step { border-top: 1px solid rgba(255,255,255,.08); }
#fpbx-login-root .ui-debug-stage {
    padding: 6px 12px 0;
    font: 600 12px/1.5 system-ui, sans-serif;
    color: #ffd479;
}
#fpbx-login-root .ui-debug-json {
    margin: 4px 0 10px;
    padding: 0 12px;
    max-height: 40vh;
    overflow: auto;
    font: 11px/1.45 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    white-space: pre;
    color: #c8e1ff;
}
#fpbx-login-root .ui-debug-foot {
    padding: 8px 12px;
    border-top: 1px solid rgba(255,255,255,.08);
    font: 11px/1.4 system-ui, sans-serif;
    color: #8b93a1;
}

/* ── Audio device chooser, on the login screen ───────────────────────────────
   Deliberately quiet: it is an option, not a step. A user who does not need it
   should not have to read past it to reach the e-mail field.               */
#fpbx-login-root .ui-linkbutton {
    display: inline-block;
    margin-top: 12px;
    padding: 6px 4px;
    border: 0;
    background: none;
    color: inherit;
    opacity: .7;
    font: 13px/1.4 system-ui, sans-serif;
    text-decoration: underline;
    cursor: pointer;
}
#fpbx-login-root .ui-linkbutton:hover { opacity: 1; }
#fpbx-login-root .ui-audio {
    margin-top: 12px;
    padding: 12px;
    border: 1px solid rgba(122, 42, 143, 0.25);
    border-radius: 8px;
    text-align: left;
}
#fpbx-login-root .ui-audio-label {
    margin: 8px 0 4px;
    font: 600 12px/1.4 system-ui, sans-serif;
    opacity: .8;
}
#fpbx-login-root .ui-audio-note {
    margin-top: 8px;
    font: 12px/1.4 system-ui, sans-serif;
    opacity: .7;
}
/* Build marker: readable when looked for, invisible when not. */
#fpbx-login-root .ui-build {
    margin-top: 14px;
    font: 11px/1.4 ui-monospace, Menlo, Consolas, monospace;
    opacity: .45;
    letter-spacing: .05em;
}
