/* ============================================================
   auth.css — Login & authentication page styles for BetterGather
   All styles are external (NEVER use inline styles in HTML).
   ============================================================ */

/* ── Variables ──────────────────────────────────────────────── */
:root {
    --brand-green:      #2e7d32;
    --brand-green-dark: #1b5e20;
    --brand-green-light:#e8f5e9;
    --brand-blue:       #0078d4;
    --brand-blue-dark:  #005a9e;
    --brand-blue-light: #e3f2fd;
    --text-primary:     #202124;
    --text-secondary:   #5f6368;
    --border:           #dadce0;
    --error:            #d32f2f;
    --error-bg:         #ffebee;
    --warning-bg:       #fff3e0;
    --warning-text:     #e65100;
    --white:            #ffffff;
    --bg-page:          #f0f4f8;
    --radius:           8px;
    --shadow:           0 2px 12px rgba(0,0,0,0.10);
}

/* ── Reset / base ────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg-page);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Utility: hidden by default, shown via JS ────────────────── */
.initially-hidden {
    display: none !important;
}

/* ── Page layout ─────────────────────────────────────────────── */
.auth-page {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-card {
    background: var(--bg-secondary, var(--white));
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 420px;
}

/* ── Logo + branding ─────────────────────────────────────────── */
.auth-logo {
    text-align: center;
    margin-bottom: 1.75rem;
}

.auth-logo .logo-image {
    height: 56px;
    width: auto;
    display: block;
    margin: 0 auto 0.4rem;
    object-fit: contain;
}

.auth-logo .logo-name {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--brand-green);
    letter-spacing: -0.02em;
}

.auth-logo .logo-tagline {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* ── Section heading ─────────────────────────────────────────── */
.auth-heading {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    margin: 0 0 1.5rem;
}

/* ── Legal checkbox ──────────────────────────────────────────── */
.auth-legal {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    margin-bottom: 1.25rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
    cursor: pointer;
}

.auth-legal input[type="checkbox"] {
    margin-top: 2px;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--brand-green);
}

.auth-legal a {
    color: var(--brand-green);
    text-decoration: none;
}

.auth-legal a:hover {
    text-decoration: underline;
}

/* ── "Just signed up?" escape hatch ──────────────────────────── */
.auth-help {
    margin-top: 1.25rem;
    font-size: 0.85rem;
    text-align: center;
    color: var(--text-secondary);
}

/* :not(.link-disabled) rather than escalating specificity on the blocked state. `.auth-help a`
   is (0,1,1) and would outrank a bare `.link-disabled` at (0,1,0), which is exactly how the
   signup CTA ended up painting its label in its own background colour. */
.auth-help a:not(.link-disabled) {
    color: var(--brand-green);
}

/* Held shut until the legal checkbox is ticked, same as the buttons. An anchor cannot be
   :disabled, so the class carries what the pseudo-class would have. The blocked state is
   the one every first-time visitor sees, so it uses the secondary text colour rather than
   an opacity knock-down: 0.5 opacity on brand green lands near 2.4:1, which fails AA on
   text nobody has done anything wrong to deserve. */
.link-disabled {
    color: var(--text-secondary);
    text-decoration: none;
    cursor: not-allowed;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.auth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.7rem 1rem;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
    text-decoration: none;
    margin-bottom: 0.75rem;
}

.auth-btn:disabled,
.auth-btn.is-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Microsoft / Entra (primary) */
.auth-btn-microsoft {
    background: var(--brand-blue);
    color: var(--white);
}

.auth-btn-microsoft:hover:not(:disabled) {
    background: var(--brand-blue-dark);
}

/* Email (secondary) */
.auth-btn-email {
    background: var(--brand-green);
    color: var(--white);
}

.auth-btn-email:hover:not(:disabled) {
    background: var(--brand-green-dark);
}

/* Google (outlined) */
.auth-btn-google {
    background: var(--bg-secondary, var(--white));
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.auth-btn-google:hover:not(:disabled) {
    background: var(--bg-hover, #f5f5f5);
}

/* ── Divider ─────────────────────────────────────────────────── */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 0.5rem 0 1rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ── Provider icon (SVG inline replacements) ────────────────── */
.provider-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* ── Alert / message boxes ────────────────────────────────────── */
.auth-alert {
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.auth-alert-error {
    background: var(--error-bg);
    color: var(--error);
    border-left: 3px solid var(--error);
}

.auth-alert-warning {
    background: var(--warning-bg);
    color: var(--warning-text);
    border-left: 3px solid var(--warning-text);
}

/* ── In-app browser warning ───────────────────────────────────── */
.inapp-warning {
    background: var(--warning-bg);
    border: 1px solid #ffcc80;
    border-radius: var(--radius);
    padding: 0.9rem 1rem;
    margin-bottom: 1.25rem;
    font-size: 0.85rem;
    color: var(--warning-text);
    line-height: 1.5;
}

.inapp-warning strong {
    display: block;
    margin-bottom: 0.3rem;
}

/* ── Not provisioned panel ────────────────────────────────────── */
.not-provisioned-panel {
    text-align: center;
    padding: 1rem 0;
}

.not-provisioned-panel .np-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.not-provisioned-panel p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0 0 1rem;
    line-height: 1.5;
}

.not-provisioned-panel .signout-link {
    display: inline-block;
    margin-top: 0.25rem;
    color: var(--primary);
    font-weight: 600;
    font-size: 0.875rem;
    text-decoration: underline;
    cursor: pointer;
}

.not-provisioned-panel .signout-link:hover {
    opacity: 0.8;
}

/* ── Footer ───────────────────────────────────────────────────── */
.auth-footer {
    text-align: center;
    padding: 1.5rem 1rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--text-secondary);
    text-decoration: none;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* ── Spinner for loading state ────────────────────────────────── */
.auth-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: var(--white);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 480px) {
    .auth-card {
        padding: 2rem 1.25rem;
        border-radius: 0;
        box-shadow: none;
    }

    .auth-page {
        align-items: flex-start;
        padding: 0;
    }
}

/* ── Dark mode overrides ──────────────────────────────────────────
   The :root block above locally redefines --text-primary, --text-secondary,
   --border, and --bg-page with fixed light-mode hex values so this file
   works standalone (auth pages don't currently load theme.css). Those
   names collide with theme.css's real dark-aware tokens of the same name,
   so if theme.css/dark-mode toggling is ever added to a page using this
   file, this file's own :root block would win the cascade and silently
   keep everything light. Re-declaring the dark values here (scoped to
   [data-theme="dark"], at the end of this file) guarantees the override
   wins regardless of load order, without touching theme.css or any other
   file. Brand/status colors (--brand-*, --error*, --warning*) are
   intentionally left as-is in both themes. --white is intentionally left
   as-is too — it's reused for white text/icons on colored buttons, which
   must stay white in both themes; the two surface usages that used
   var(--white) as a card/button background were re-pointed to
   var(--bg-secondary, var(--white)) at their call sites instead. */
[data-theme="dark"] {
    --text-primary:   #e5e7eb;
    --text-secondary: #d1d5db;
    --border:         #2d2d2d;
    --bg-page:        #121212;
    --shadow:         0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
}
