/* =============================================
   MediCore Login Page Styles
   Mobile-first, glassmorphism design
   ============================================= */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #2563EB;
    --primary-light: #3B82F6;
    --secondary: #14B8A6;
    --accent: #F97316;
    --purple: #8B5CF6;
    --success: #22C55E;
    --danger: #EF4444;
    --warning: #F59E0B;

    --bg: #0A0F1E;
    --surface: rgba(255, 255, 255, 0.04);
    --surface-hover: rgba(255, 255, 255, 0.08);
    --border: rgba(255, 255, 255, 0.1);
    --border-focus: rgba(255, 255, 255, 0.25);
    --text: #F0F4FF;
    --text-muted: rgba(240, 244, 255, 0.5);

    --radius: 16px;
    --radius-sm: 10px;
    --font: 'Inter', sans-serif;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow-x: hidden;
    padding: 20px 16px;
}

/* ── Background Orbs ── */
.login-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}
.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.35;
    animation: float-orb 8s ease-in-out infinite;
}
.orb-1 { width: 400px; height: 400px; background: radial-gradient(circle, #2563EB, transparent); top: -10%; left: -10%; animation-delay: 0s; }
.orb-2 { width: 350px; height: 350px; background: radial-gradient(circle, #8B5CF6, transparent); top: 40%; right: -5%; animation-delay: -3s; }
.orb-3 { width: 300px; height: 300px; background: radial-gradient(circle, #14B8A6, transparent); bottom: -5%; left: 30%; animation-delay: -5s; }
@keyframes float-orb {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(12px, -18px) scale(1.04); }
}

/* ── Wrapper ── */
.login-wrapper {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
}

/* ── Brand ── */
.login-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    margin-bottom: 28px;
}
.brand-icon-lg {
    width: 44px; height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    display: flex; align-items: center; justify-content: center;
    font-size: 20px;
    color: #fff;
    box-shadow: 0 6px 20px rgba(37,99,235,0.4);
}
.brand-title { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.5px; }
.brand-ai { color: var(--primary-light); }

/* ── Card ── */
.login-card {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 28px 24px;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow: 0 20px 60px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.1);
}

/* ── Step indicators ── */
.step-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 24px;
}
.step-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--border);
    transition: all 0.3s ease;
}
.step-dot.active { background: var(--primary-light); width: 24px; border-radius: 4px; }
.step-dot.done { background: var(--success); }

/* ── Step 1: Role Picker ── */
.step-title {
    text-align: center;
    margin-bottom: 20px;
}
.step-title h2 { font-size: 1.3rem; font-weight: 700; margin-bottom: 4px; }
.step-title p { font-size: 0.83rem; color: var(--text-muted); }

.role-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 8px;
}
.role-card {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}
.role-card:hover, .role-card:active { background: var(--surface-hover); transform: translateY(-2px); }
.role-card.selected {
    border-color: var(--role-color, var(--primary));
    background: rgba(var(--role-r, 37), var(--role-g, 99), var(--role-b, 235), 0.15);
    box-shadow: 0 0 0 1px var(--role-color, var(--primary));
    transform: translateY(-2px);
}
.role-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem;
    margin: 0 auto 10px;
    background: var(--role-bg, rgba(37,99,235,0.15));
    color: var(--role-color, var(--primary));
    transition: all 0.25s ease;
}
.role-card.selected .role-icon {
    background: var(--role-color, var(--primary));
    color: #fff;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}
.role-label { font-size: 0.82rem; font-weight: 600; color: var(--text); }
.role-desc { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; line-height: 1.3; }

/* ── Auth Tabs ── */
.auth-tabs {
    display: flex;
    background: rgba(255,255,255,0.06);
    border-radius: 10px;
    padding: 3px;
    margin-bottom: 24px;
    gap: 3px;
}
.auth-tab {
    flex: 1;
    padding: 9px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}
.auth-tab.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 10px rgba(37,99,235,0.4);
}

/* ── Forms ── */
.form-group { margin-bottom: 14px; }
.form-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}
.form-input {
    width: 100%;
    background: rgba(255,255,255,0.06);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    color: var(--text);
    font-family: var(--font);
    font-size: 0.92rem;
    outline: none;
    transition: all 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}
.form-input::placeholder { color: var(--text-muted); }
.form-input:focus {
    border-color: var(--primary-light);
    background: rgba(255,255,255,0.09);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.18);
}
.form-input-wrap {
    position: relative;
}
.form-input-wrap .form-input { padding-left: 40px; }
.form-input-icon {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.9rem;
    pointer-events: none;
}
.pw-toggle {
    position: absolute;
    right: 12px;
    top: 50%; transform: translateY(-50%);
    background: none; border: none;
    color: var(--text-muted); cursor: pointer;
    padding: 4px; font-size: 0.9rem;
}
.pw-toggle:hover { color: var(--text); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

select.form-input option {
    background: #1a2035;
    color: var(--text);
}

/* ── Divider ── */
.form-divider {
    display: flex; align-items: center; gap: 10px;
    margin: 14px 0;
    color: var(--text-muted); font-size: 0.76rem;
}
.form-divider::before, .form-divider::after {
    content: ''; flex: 1;
    height: 1px; background: var(--border);
}

/* ── Demo fill ── */
.demo-fill-btn {
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px dashed var(--border);
    border-radius: 8px;
    padding: 9px;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-family: var(--font);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    transition: all 0.2s ease;
}
.demo-fill-btn:hover {
    background: rgba(255,255,255,0.09);
    color: var(--text);
    border-color: var(--primary-light);
}

/* ── Submit Button ── */
.btn-submit {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: #fff;
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    box-shadow: 0 6px 20px rgba(37,99,235,0.35);
    margin-top: 4px;
    letter-spacing: 0.2px;
}
.btn-submit:hover { background: var(--primary-light); transform: translateY(-1px); box-shadow: 0 8px 28px rgba(37,99,235,0.45); }
.btn-submit:active { transform: translateY(0); }
.btn-submit:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* Role-colored submit */
.btn-submit.role-patient { background: linear-gradient(135deg, #2563EB, #3B82F6); }
.btn-submit.role-doctor  { background: linear-gradient(135deg, #0D9488, #14B8A6); }
.btn-submit.role-hospital{ background: linear-gradient(135deg, #EA580C, #F97316); }
.btn-submit.role-admin   { background: linear-gradient(135deg, #7C3AED, #8B5CF6); }

/* ── Back button ── */
.btn-back {
    display: flex; align-items: center; gap: 6px;
    background: none; border: none;
    color: var(--text-muted); font-size: 0.85rem;
    font-family: var(--font); cursor: pointer;
    padding: 0; margin-bottom: 20px;
    transition: color 0.2s;
}
.btn-back:hover { color: var(--text); }

/* ── Role badge (shown in step 2 header) ── */
.selected-role-badge {
    display: flex; align-items: center; gap: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 30px;
    padding: 6px 12px 6px 8px;
    font-size: 0.8rem; font-weight: 600;
    width: fit-content;
    margin-bottom: 20px;
}
.selected-role-badge .badge-dot {
    width: 8px; height: 8px; border-radius: 50%;
}

/* ── Error/Success messages ── */
.form-message {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.82rem;
    margin-bottom: 14px;
    display: none;
}
.form-message.error { background: rgba(239,68,68,0.15); border: 1px solid rgba(239,68,68,0.3); color: #FCA5A5; display: block; }
.form-message.success { background: rgba(34,197,94,0.15); border: 1px solid rgba(34,197,94,0.3); color: #86EFAC; display: block; }

/* ── Loading spinner ── */
.spinner {
    width: 18px; height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Agreements ── */
.form-check {
    display: flex; align-items: flex-start; gap: 10px;
    margin: 14px 0;
}
.form-check input[type="checkbox"] {
    width: 16px; height: 16px; flex-shrink: 0;
    margin-top: 2px;
    accent-color: var(--primary);
    cursor: pointer;
}
.form-check label { font-size: 0.78rem; color: var(--text-muted); line-height: 1.5; }
.form-check a { color: var(--primary-light); text-decoration: none; }

/* ── Footer ── */
.login-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.7;
}
.login-footer a { color: var(--primary-light); text-decoration: none; }

/* ── Step transitions ── */
.login-step { display: none; }
.login-step.active { display: block; animation: fadeSlideIn 0.35s ease; }
@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Responsive: Very small screens ── */
@media (max-width: 360px) {
    .login-card { padding: 22px 16px; }
    .role-grid { gap: 8px; }
    .role-card { padding: 13px 8px; }
    .role-icon { width: 38px; height: 38px; font-size: 1rem; }
    .form-row { grid-template-columns: 1fr; }
}

