/* =========================================================
   Zambia Form OCR - elegant login styles
   - Soft aurora gradient background with floating blurred blobs
   - Refined card with layered shadow and subtle entrance animation
   - Icon-prefixed inputs, gradient primary button, eye toggle
   ========================================================= */

:root {
    --bg-1: #eef2ff;
    --bg-2: #ffe9f4;
    --bg-3: #e0f2fe;

    --card-bg: rgba(255, 255, 255, 0.85);
    --card-border: rgba(255, 255, 255, 0.6);

    --text: #1f2937;
    --text-muted: #6b7280;
    --label: #374151;
    --border: #e5e7eb;
    --border-strong: #d1d5db;
    --input-bg: #f9fafb;
    --input-bg-focus: #ffffff;

    --primary: #4f46e5;
    --primary-2: #7c3aed;
    --primary-hover: #4338ca;
    --primary-soft: #ede9fe;
    --primary-ring: rgba(99, 102, 241, 0.18);

    --error-bg: #fef2f2;
    --error-text: #991b1b;
    --error-border: #fecaca;

    --radius: 20px;
    --radius-sm: 12px;

    --shadow-card:
        0 1px 1px rgba(15, 23, 42, 0.04),
        0 10px 20px -8px rgba(15, 23, 42, 0.10),
        0 30px 60px -20px rgba(79, 70, 229, 0.18);
    --shadow-card-hover:
        0 1px 1px rgba(15, 23, 42, 0.04),
        0 14px 26px -8px rgba(15, 23, 42, 0.14),
        0 40px 80px -20px rgba(124, 58, 237, 0.22);

    --transition: 0.2s ease;
    --transition-slow: 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    position: relative;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 32px 16px;
    overflow-x: hidden;

    background:
        radial-gradient(circle at 15% 20%, var(--bg-1) 0%, transparent 55%),
        radial-gradient(circle at 85% 10%, var(--bg-2) 0%, transparent 50%),
        radial-gradient(circle at 50% 95%, var(--bg-3) 0%, transparent 55%),
        linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
}

/* ---------- Decorative blobs ---------- */

.bg-blob {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.55;
    z-index: 0;
    pointer-events: none;
    animation: float 14s ease-in-out infinite;
}

.bg-blob-1 {
    width: 480px;
    height: 480px;
    top: -160px;
    left: -120px;
    background: radial-gradient(circle, #c7d2fe 0%, transparent 70%);
}

.bg-blob-2 {
    width: 420px;
    height: 420px;
    top: 20%;
    right: -140px;
    background: radial-gradient(circle, #fbcfe8 0%, transparent 70%);
    animation-delay: -5s;
}

.bg-blob-3 {
    width: 520px;
    height: 520px;
    bottom: -200px;
    left: 35%;
    background: radial-gradient(circle, #bae6fd 0%, transparent 70%);
    animation-delay: -10s;
}

@keyframes float {
    0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
    50%      { transform: translate3d(0, -30px, 0) scale(1.05); }
}

@media (prefers-reduced-motion: reduce) {
    .bg-blob { animation: none; }
}

/* ---------- Typography ---------- */

h1 {
    margin: 0 0 8px;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
    background: linear-gradient(135deg, #111827 0%, #4f46e5 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

p {
    margin: 0;
}

/* ---------- Card ---------- */

.login-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
    padding: 40px 36px;
    backdrop-filter: blur(18px) saturate(180%);
    -webkit-backdrop-filter: blur(18px) saturate(180%);
    transition: box-shadow var(--transition-slow), transform var(--transition-slow);
    animation: card-in 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.login-card:hover {
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-2px);
}

@keyframes card-in {
    0%   { opacity: 0; transform: translateY(16px) scale(0.98); }
    100% { opacity: 1; transform: translateY(0)    scale(1); }
}

@media (prefers-reduced-motion: reduce) {
    .login-card { animation: none; }
}

.login-header {
    text-align: center;
    margin-bottom: 28px;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.97rem;
}

/* ---------- Form ---------- */

.login-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--label);
    letter-spacing: 0.02em;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    pointer-events: none;
    transition: color var(--transition);
}

.input-icon svg {
    width: 100%;
    height: 100%;
}

.form-group input {
    width: 100%;
    padding: 14px 16px 14px 44px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.97rem;
    color: var(--text);
    background: var(--input-bg);
    transition: border-color var(--transition), box-shadow var(--transition),
                background var(--transition);
    outline: none;
}

.form-group input::placeholder {
    color: #9ca3af;
}

.form-group input:hover {
    border-color: var(--border-strong);
}

.form-group input:focus {
    border-color: var(--primary);
    background: var(--input-bg-focus);
    box-shadow: 0 0 0 4px var(--primary-ring);
}

.input-wrapper:focus-within .input-icon {
    color: var(--primary);
}

/* Password field needs extra right padding for the eye toggle */
#password {
    padding-right: 48px;
}

.toggle-password {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition), color var(--transition);
}

.toggle-password:hover {
    background: var(--primary-soft);
    color: var(--primary);
}

.toggle-password:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px var(--primary-ring);
}

.toggle-password svg {
    width: 20px;
    height: 20px;
    display: block;
    transition: opacity var(--transition);
}

/* Defensive: ensure the hidden eye/eye-off SVG never renders, even if a
   user-agent quirk would otherwise display it inside a flex container. */
.toggle-password svg[hidden] {
    display: none !important;
}

/* ---------- Buttons ---------- */

.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    border: none;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
    width: 100%;
    margin-top: 6px;
    transition: transform var(--transition), box-shadow var(--transition),
                filter var(--transition), opacity var(--transition);
}

.btn:active {
    transform: translateY(1px);
}

.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-2) 100%);
    box-shadow:
        0 6px 16px -4px rgba(79, 70, 229, 0.45),
        0 10px 24px -8px rgba(124, 58, 237, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.btn-primary:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
    box-shadow:
        0 10px 22px -4px rgba(79, 70, 229, 0.55),
        0 16px 32px -8px rgba(124, 58, 237, 0.45),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn-primary:focus-visible {
    outline: none;
    box-shadow:
        0 6px 16px -4px rgba(79, 70, 229, 0.45),
        0 10px 24px -8px rgba(124, 58, 237, 0.35),
        inset 0 1px 0 rgba(255, 255, 255, 0.25),
        0 0 0 4px var(--primary-ring);
}

.btn[disabled],
.btn.loading {
    opacity: 0.78;
    cursor: not-allowed;
}

.btn-spinner {
    display: none;
    width: 16px;
    height: 16px;
    margin-left: 10px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.btn.loading .btn-spinner {
    display: inline-block;
}

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

/* ---------- Error message ---------- */

.form-error {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--error-bg);
    color: var(--error-text);
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    border: 1px solid var(--error-border);
    animation: error-in 0.25s ease-out;
}

.form-error[hidden] {
    display: none;
}

@keyframes error-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Responsive ---------- */

@media (max-width: 480px) {
    body {
        padding: 20px 14px;
    }

    .login-card {
        padding: 32px 24px;
        border-radius: 18px;
    }

    h1 {
        font-size: 1.5rem;
    }

    /* Slightly tame the blobs on phones */
    .bg-blob-1 { width: 320px; height: 320px; }
    .bg-blob-2 { width: 280px; height: 280px; }
    .bg-blob-3 { width: 360px; height: 360px; }
}
