/* Site Guardian AI — Auth Gate Styles
   ─────────────────────────────────────────────────────────────────────────
   Rendered when the visitor is not authorized (not logged in, or logged in
   but lacks manage_options).  The auth gate is a standalone, full-viewport
   centered card — entirely independent of the main plugin shell.

   Design tokens deliberately match the rest of the plugin:
     • Same gradient header as .sga-scanner-header (#0ea5e9 → #6366f1)
     • Same font (DM Sans / system-ui)
     • Same primary blue (#2563eb) for the submit button
     • Same border-radius language (10px inputs, 20px card)
   ─────────────────────────────────────────────────────────────────────────*/

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   1. BODY — full-viewport centered layout
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

body.sga-auth-page {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    height: auto !important;   /* override the 100% from clean-page reset */
    padding: 24px 20px;
    background: #0f172a;
    box-sizing: border-box;
    /* Subtle radial gradient for depth */
    background-image:
        radial-gradient(ellipse 80% 60% at 50% 0%, rgba(14,165,233,.12) 0%, transparent 70%),
        radial-gradient(ellipse 60% 40% at 80% 100%, rgba(99,102,241,.10) 0%, transparent 70%);
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   2. OUTER WRAP
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.sga-auth-wrap {
    width: 100%;
    max-width: 432px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   3. CARD SHELL
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.sga-auth-card {
    width: 100%;
    background: #ffffff;
    border-radius: 20px;
    overflow: hidden;
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, .06),
        0 32px 80px rgba(0, 0, 0, .55),
        0 8px 24px  rgba(0, 0, 0, .30);
    /* Subtle pop-in animation */
    animation: sga-auth-appear .25s cubic-bezier(.16, 1, .3, 1) both;
}

@keyframes sga-auth-appear {
    from { opacity: 0; transform: translateY(10px) scale(.98); }
    to   { opacity: 1; transform: translateY(0)    scale(1);   }
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   4. GRADIENT HEADER
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.sga-auth-head {
    background: linear-gradient(135deg, #0ea5e9 0%, #6366f1 100%);
    padding: 28px 28px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
    /* Inner top-border glint */
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15);
}

.sga-auth-head-shield {
    line-height: 0;
    filter: drop-shadow(0 3px 10px rgba(0, 0, 0, .25));
}

.sga-auth-head-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.sga-auth-head-title {
    font-family: var(--sga-font, 'DM Sans', system-ui, sans-serif);
    font-size: 17px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -.015em;
    line-height: 1.2;
}

.sga-auth-head-sub {
    font-family: var(--sga-font, 'DM Sans', system-ui, sans-serif);
    font-size: 12px;
    color: rgba(255, 255, 255, .72);
    font-weight: 400;
    letter-spacing: .01em;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   5. CARD BODY — shared between login + denied states
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.sga-auth-body {
    padding: 28px;
}

.sga-auth-title {
    font-family: var(--sga-font, 'DM Sans', system-ui, sans-serif);
    font-size: 18px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 6px;
    letter-spacing: -.015em;
    line-height: 1.3;
    text-align: center;
}

.sga-auth-desc {
    font-family: var(--sga-font, 'DM Sans', system-ui, sans-serif);
    font-size: 13.5px;
    color: #64748b;
    margin: 0 0 22px;
    line-height: 1.55;
    text-align: center;
}

.sga-auth-desc + .sga-auth-desc {
    margin-top: -14px;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   6. [hidden] SAFETY OVERRIDES
   Flex / grid containers can override the browser's default [hidden] rule.
   These rules guarantee elements remain invisible until JS explicitly shows
   them — regardless of their display type.
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.sga-auth-alert[hidden],
.sga-auth-spin[hidden],
.sga-auth-pw-btn[hidden] {
    display: none !important;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   7. ERROR / INFO ALERT BANNER
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.sga-auth-alert {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 11px 14px;
    margin-bottom: 18px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 10px;
    font-family: var(--sga-font, 'DM Sans', system-ui, sans-serif);
    font-size: 13px;
    color: #991b1b;
    line-height: 1.5;
    animation: sga-auth-appear .18s ease both;
}

.sga-auth-alert-icon {
    flex-shrink: 0;
    margin-top: 1px;
    color: #dc2626;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   8. FORM LAYOUT
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.sga-auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sga-auth-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sga-auth-label {
    font-family: var(--sga-font, 'DM Sans', system-ui, sans-serif);
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    display: block;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   9. INPUT FIELDS
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.sga-auth-input-row {
    position: relative;
    display: flex;
    align-items: center;
}

.sga-auth-input-icon {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    pointer-events: none;
    flex-shrink: 0;
    z-index: 1;
}

.sga-auth-input {
    width: 100%;
    padding: 11px 13px 11px 40px;
    font-family: var(--sga-font, 'DM Sans', system-ui, sans-serif);
    font-size: 14px;
    color: #111827;
    background: #f9fafb;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    outline: none;
    transition: border-color .14s, box-shadow .14s, background .14s;
    -webkit-appearance: none;
    appearance: none;
    box-sizing: border-box;
}

.sga-auth-input:focus {
    border-color: #2563eb;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.sga-auth-input::placeholder {
    color: #9ca3af;
}

/* Password field: extra padding-right for toggle button */
.sga-auth-input--pw {
    padding-right: 44px;
}

/* Error state (applied via JS) */
.sga-auth-input.is-error {
    border-color: #ef4444;
    background: #fff5f5;
}

.sga-auth-input.is-error:focus {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, .12);
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   10. PASSWORD SHOW / HIDE TOGGLE
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.sga-auth-pw-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 5px;
    cursor: pointer;
    color: #9ca3af;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: color .12s, background .12s;
    -webkit-tap-highlight-color: transparent;
    line-height: 0;
}

.sga-auth-pw-btn:hover {
    color: #6366f1;
    background: rgba(99, 102, 241, .08);
}

[aria-label="Show password"] .sga-pw-eye-off,
[aria-label="Hide password"] .sga-pw-eye {display: none;}


/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   11. EXTRAS ROW (remember me)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.sga-auth-extras {
    display: flex;
    align-items: center;
    margin-top: -2px;
}

.sga-auth-remember {
    display: flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    user-select: none;
}

.sga-auth-check {
    width: 15px;
    height: 15px;
    margin: 0;
    accent-color: #2563eb;
    cursor: pointer;
    flex-shrink: 0;
}

.sga-auth-remember-label {
    font-family: var(--sga-font, 'DM Sans', system-ui, sans-serif);
    font-size: 13px;
    color: #6b7280;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   12. SUBMIT BUTTON
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.sga-auth-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    margin-top: 6px;
    background: #2563eb;
    color: #fff;
    font-family: var(--sga-font, 'DM Sans', system-ui, sans-serif);
    font-size: 14.5px;
    font-weight: 600;
    border: 1.5px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    letter-spacing: .01em;
    min-height: 44px;   /* WCAG 2.5.5 minimum touch target */
    text-decoration: none;
    transition: background .12s, box-shadow .12s, transform .1s, opacity .12s;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.sga-auth-submit:hover:not(:disabled) {
    background: #1d4ed8;
    box-shadow: 0 4px 16px rgba(37, 99, 235, .35);
    transform: translateY(-1px);
}

.sga-auth-submit:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: none;
}

.sga-auth-submit:disabled {
    opacity: 0.72;
    cursor: default;
    transform: none;
}

/* Outline variant — used for "Sign Out & Try Another Account" */
.sga-auth-submit--outline {
    background: transparent;
    border-color: #2563eb;
    color: #2563eb;
}

.sga-auth-submit--outline:hover:not(:disabled) {
    background: rgba(37, 99, 235, .06);
    box-shadow: none;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   13. LOADING SPINNER (SVG, rotated via CSS animation)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.sga-auth-spin {
    animation: sga-auth-spinning .75s linear infinite;
    flex-shrink: 0;
}

@keyframes sga-auth-spinning {
    to { transform: rotate(360deg); }
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   14. FOOTER / FALLBACK LINK (used on access-denied state)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.sga-auth-foot {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid #f1f5f9;
    text-align: center;
}

.sga-auth-wp-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: var(--sga-font, 'DM Sans', system-ui, sans-serif);
    font-size: 12.5px;
    color: #94a3b8;
    text-decoration: none;
    transition: color .12s;
}

.sga-auth-wp-link:hover {
    color: #2563eb;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   15. ACCESS-DENIED STATE (logged in, not admin)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.sga-auth-body--denied {
    text-align: center;
    padding: 36px 28px 28px;
}

.sga-auth-denied-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 76px;
    height: 76px;
    margin: 0 auto 20px;
    background: #fef2f2;
    border-radius: 50%;
    color: #dc2626;
    border: 1.5px solid #fecaca;
}

.sga-auth-denied-actions {
    margin-top: 24px;
    margin-bottom: 4px;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   16. BELOW-CARD PAGE FOOTER
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

.sga-auth-page-foot {
    font-family: var(--sga-font, 'DM Sans', system-ui, sans-serif);
    font-size: 12px;
    color: #334155;
    text-align: center;
    margin: 0;
    line-height: 1.5;
}

.sga-auth-page-foot strong {
    color: #64748b;
    font-weight: 600;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   17. RESPONSIVE — mobile (≤ 480px)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

@media (max-width: 480px) {
    body.sga-auth-page         { padding: 16px 14px; }
    .sga-auth-head             { padding: 22px 20px 18px; }
    .sga-auth-body             { padding: 22px 20px; }
    .sga-auth-body--denied     { padding: 30px 20px 22px; }
    .sga-auth-title            { font-size: 16.5px; }
    .sga-auth-head-title       { font-size: 15px; }
    .sga-auth-head-shield svg  { width: 34px; height: 34px; }
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   18. REDUCED MOTION
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

@media (prefers-reduced-motion: reduce) {
    .sga-auth-card,
    .sga-auth-alert        { animation: none; }
    .sga-auth-spin         { animation: none; opacity: 0.7; }
    .sga-auth-submit       { transition: background .12s; }
}
