/* ═══════════════════════════════════════════
   SignUp Module — CaseConduit.io
   Open registration (invite optional) — LIGHT theme, matched to the marketing home
   (paper surfaces, deep-navy ink, teal accent, Sora + Inter type).
   Class names & hooks are unchanged so signup.js keeps working.
   ═══════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600;700;800&family=Inter:wght@400;450;500;600&family=Space+Mono:wght@400;700&display=swap');

:root {
    /* home palette */
    --paper:     #eef2f9;
    --paper-2:   #ffffff;
    --ink:       #0f1e38;
    --ink-dim:   #4c5c78;
    --ink-faint: #8494ad;
    --teal:      #0a9298;
    --teal-bright: #14b8bd;
    --line:      rgba(15, 30, 56, 0.09);
    --line-hi:   rgba(10, 146, 152, 0.40);
    --card:      #ffffff;
    --shadow-sm: 0 2px 10px rgba(15, 30, 56, 0.05);
    --shadow-md: 0 24px 60px -24px rgba(15, 30, 56, 0.22);

    /* legacy token names still referenced by inline styles in index.html */
    --accent:     #0a9298;
    --accent-glow: rgba(10, 146, 152, 0.15);
    --deep:       #04070d;
    --navy:       #ffffff;
    --charcoal:   #e3e9f2;
    --text-light: #0f1e38;
    --text-dim:   #4c5c78;
    --rose:    #e11d48;
    --emerald: #0d9488;
    --violet:  #8b3ff0;
    --amber:   #ea580c;
    --blue:    #0284c7;

    --font-d: 'Sora', -apple-system, sans-serif;
    --font-b: 'Inter', -apple-system, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: var(--font-b);
    background: var(--paper);
    color: var(--ink);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ═══ AMBIENT BACKGROUND (soft light tints, mirrors the home "sky") ═══ */
.ambient-bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.ambient-orb { position: absolute; border-radius: 50%; filter: blur(120px); opacity: 0.10; }
.orb-1 { width: 600px; height: 600px; background: var(--teal);   top: -15%; right: -10%; animation: orbFloat1 20s ease-in-out infinite; }
.orb-2 { width: 500px; height: 500px; background: var(--violet); bottom: -10%; left: -10%; opacity: 0.07; animation: orbFloat2 25s ease-in-out infinite; }
.orb-3 { width: 300px; height: 300px; background: var(--blue);   top: 50%; left: 50%; transform: translate(-50%, -50%); opacity: 0.06; animation: orbFloat3 18s ease-in-out infinite; }
@keyframes orbFloat1 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(-40px,30px)} }
@keyframes orbFloat2 { 0%,100%{transform:translate(0,0)} 50%{transform:translate(30px,-40px)} }
@keyframes orbFloat3 { 0%,100%{transform:translate(-50%,-50%) scale(1)} 50%{transform:translate(-50%,-50%) scale(1.2)} }

/* Grid pattern overlay — light engineering grid like the home page */
.grid-pattern {
    position: fixed; inset: 0; z-index: 1; pointer-events: none;
    background-image:
        linear-gradient(rgba(15,30,56,0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(15,30,56,0.045) 1px, transparent 1px);
    background-size: 60px 60px;
    -webkit-mask-image: radial-gradient(80% 60% at 50% 40%, #000 30%, transparent 100%);
            mask-image: radial-gradient(80% 60% at 50% 40%, #000 30%, transparent 100%);
}

/* ═══ MAIN LAYOUT ═══ */
.signup-wrapper {
    position: relative; z-index: 10;
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    padding: 40px 20px;
}

/* ═══ BRAND HEADER (top-left corner) ═══ */
.brand-mark { position: fixed; top: 28px; left: 32px; z-index: 20; display: flex; align-items: center; gap: 10px; }
.brand-mark .logo-icon {
    width: 32px; height: 32px; border-radius: 8px;
    background: linear-gradient(135deg, var(--teal-bright), var(--teal));
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 6px 18px -6px rgba(10,146,152,0.5);
}
.brand-mark .logo-img { height: 32px; width: auto; border-radius: 8px; object-fit: contain; }
.brand-mark .logo-text { font-family: var(--font-d); font-size: 15px; font-weight: 700; color: var(--ink); letter-spacing: -0.01em; }
.brand-mark .logo-dot { color: var(--ink); }
.brand-mark .logo-io { color: var(--teal); }

/* ═══ SIGNUP CARD ═══ */
.signup-card {
    width: 100%; max-width: 480px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.card-header { padding: 32px 36px 0; text-align: center; }
.card-header h1 {
    font-family: var(--font-d);
    font-size: 24px; font-weight: 700; color: var(--ink);
    letter-spacing: -0.02em; margin-bottom: 8px;
}
.card-header p { font-size: 13px; color: var(--ink-dim); line-height: 1.55; }

/* ═══ STEP INDICATOR ═══ */
.step-indicator { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 22px 36px 0; }
.step-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: rgba(10,146,152,0.18); border: 1px solid rgba(10,146,152,0.15);
    transition: all 0.4s cubic-bezier(0.22,1,0.36,1);
}
.step-dot.active { background: var(--teal); border-color: var(--teal); box-shadow: 0 0 0 4px rgba(10,146,152,0.12); width: 24px; border-radius: 4px; }
.step-dot.complete { background: var(--emerald); border-color: var(--emerald); }

/* ═══ FORM STEPS ═══ */
.form-body { padding: 26px 36px 32px; }
.form-step { display: none; animation: stepFadeIn 0.4s cubic-bezier(0.22,1,0.36,1); }
.form-step.active { display: block; }
@keyframes stepFadeIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ═══ FORM ELEMENTS ═══ */
.field-group { margin-bottom: 18px; }
.field-label {
    display: block; font-size: 10px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.1em; color: var(--ink-faint); margin-bottom: 8px;
}
.field-input {
    width: 100%; padding: 14px 16px; background: #fff;
    border: 1px solid var(--line); border-radius: 12px;
    color: var(--ink); font-family: var(--font-b); font-size: 15px;
    outline: none; transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
}
.field-input:focus { border-color: var(--line-hi); box-shadow: 0 0 0 3px rgba(10,146,152,0.10); }
.field-input::placeholder { color: var(--ink-faint); }
.field-input.error { border-color: rgba(225,29,72,0.55); }

.field-hint { font-size: 11px; color: var(--ink-faint); margin-top: 6px; line-height: 1.45; }
.field-error { font-size: 11px; color: var(--rose); margin-top: 6px; font-weight: 600; display: none; }
.field-error.visible { display: block; }

/* Password strength bar */
.pw-strength { height: 4px; background: rgba(15,30,56,0.08); border-radius: 2px; margin-top: 8px; overflow: hidden; }
.pw-strength .fill { height: 100%; border-radius: 2px; transition: width 0.4s, background 0.4s; width: 0; }

/* ═══ ROLE SELECTOR ═══ */
.role-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.role-card {
    display: flex; align-items: center; gap: 14px; padding: 14px 16px;
    background: #fff; border: 2px solid var(--line);
    border-radius: 14px; cursor: pointer; transition: border-color 0.25s, background 0.25s, box-shadow 0.25s;
}
.role-card:hover { border-color: rgba(10,146,152,0.30); box-shadow: var(--shadow-sm); }
.role-card.selected { border-color: var(--teal); background: rgba(10,146,152,0.06); }
.role-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.role-card .role-name { font-family: var(--font-d); font-size: 14px; font-weight: 700; color: var(--ink); }
.role-card .role-desc { font-size: 11px; color: var(--ink-dim); margin-top: 3px; line-height: 1.4; }
.role-card.selected .role-name { color: var(--teal); }

/* ═══ BUTTONS (home pill treatment) ═══ */
.btn-primary {
    width: 100%; padding: 15px; border: none; border-radius: 999px;
    background: linear-gradient(120deg, var(--teal-bright), var(--teal) 60%, #0a7d82);
    color: #ffffff;
    font-family: var(--font-d); font-size: 15px; font-weight: 600;
    letter-spacing: 0; cursor: pointer;
    transition: transform 0.25s cubic-bezier(.2,.9,.3,1.3), box-shadow 0.25s;
    box-shadow: 0 8px 22px -6px rgba(10,146,152,0.55), inset 0 1px 0 rgba(255,255,255,0.25);
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 14px 30px -8px rgba(10,146,152,0.6), inset 0 1px 0 rgba(255,255,255,0.25); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.4; cursor: default; transform: none; box-shadow: none; }

.btn-secondary {
    width: 100%; padding: 12px; border: 1px solid var(--line);
    border-radius: 999px; background: rgba(255,255,255,0.6); color: var(--ink-dim);
    font-family: var(--font-d); font-size: 13px; font-weight: 600;
    letter-spacing: 0; cursor: pointer; transition: color 0.25s, border-color 0.25s, background 0.25s; margin-top: 10px;
}
.btn-secondary:hover { border-color: var(--line-hi); color: var(--ink); background: #fff; }

/* ═══ TEXT-LINK BUTTON + PLAN REASSURANCE (step 0) ═══ */
.btn-link {
    display: block; width: 100%; margin: 14px auto 0; padding: 4px;
    background: none; border: none; cursor: pointer;
    font-family: var(--font-b); font-size: 12px; font-weight: 600;
    color: var(--teal); text-decoration: underline; text-underline-offset: 3px;
    transition: color 0.25s;
}
.btn-link:hover { color: var(--ink); }

.plan-note {
    margin-top: 10px; text-align: center;
    font-size: 11px; color: var(--ink-faint); line-height: 1.5;
}

.invite-block { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.invite-block .btn-secondary { margin-top: 14px; }

/* ═══ DENIED / SUCCESS STATES ═══ */
.state-screen { text-align: center; padding: 48px 36px; }
.state-icon { width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 20px; display: flex; align-items: center; justify-content: center; }
.state-screen h2 { font-family: var(--font-d); font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.state-screen p { font-size: 13px; color: var(--ink-dim); line-height: 1.55; max-width: 320px; margin: 0 auto; }

/* ═══ FULL-ACCESS NOTE (replaces the old role picker) ═══ */
.access-note {
    display: flex; align-items: flex-start; gap: 13px; padding: 16px 18px;
    background: rgba(10,146,152,0.06); border: 1px solid rgba(10,146,152,0.22);
    border-radius: 14px;
}
.access-note-icon {
    width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
    background: rgba(10,146,152,0.12); border: 1px solid rgba(10,146,152,0.25);
    color: var(--teal); display: flex; align-items: center; justify-content: center;
}
.access-note-title { font-family: var(--font-d); font-size: 14px; font-weight: 700; color: var(--ink); margin-bottom: 3px; }
.access-note-desc { font-size: 12px; color: var(--ink-dim); line-height: 1.5; }

/* ═══ TERMS CHECKBOX ═══ */
.terms-check {
    display: flex; align-items: start; gap: 10px; padding: 14px 16px;
    background: rgba(15,30,56,0.03); border: 1px solid var(--line); border-radius: 12px; margin-top: 20px;
}
.terms-check input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--teal); margin-top: 2px; flex-shrink: 0; cursor: pointer; }
.terms-check label { font-size: 11px; color: var(--ink-dim); line-height: 1.5; cursor: pointer; }
.terms-check label a { color: var(--teal); text-decoration: none; }

/* ═══ LOADING SPINNER ═══ */
.spinner { width: 18px; height: 18px; border: 2px solid rgba(10,146,152,0.2); border-top-color: var(--teal); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══ RESPONSIVE ═══ */
@media (max-width: 520px) {
    .signup-card { border-radius: 20px; }
    .card-header { padding: 24px 24px 0; }
    .form-body { padding: 20px 24px 24px; }
    .brand-mark { top: 16px; left: 16px; }
}
