/*
 * CARE AND CURE CLINIC'S - login page (js/login.js)
 * Navy brand panel with a live heartbeat line on the left, form on the right.
 * Every class starts with "cdl-" so nothing here touches the rest of the app.
 */
.cdl-page {
    --cdl-teal: #0a9c8b;
    --cdl-navy: #021d4f;
    --cdl-navy-hover: #0a2c6b;
    --cdl-text: #0f1b33;
    --cdl-muted: #5b6678;
    --cdl-border: #d5dbe5;
    --cdl-error: #c42b2b;
    --cdl-error-bg: #fdecec;
    --cdl-info: #1f4f99;
    --cdl-info-bg: #eaf1fd;
    --cdl-ease-out: cubic-bezier(.16, 1, .3, 1);

    display: grid;
    grid-template-columns: 1.05fr 1fr;
    min-height: 100vh;
    font-family: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--cdl-text);
    background: #fff;
}

.cdl-page *, .cdl-page *::before, .cdl-page *::after { box-sizing: border-box; }

/* Left brand panel */
.cdl-brand {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 48px 56px;
    color: #e8eef9;
    background: linear-gradient(160deg, #03275f 0%, #021d4f 55%, #01143a 100%);
}

/* Slow drifting light */
.cdl-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(70px);
    opacity: .55;
    will-change: transform;
    pointer-events: none;
}

.cdl-glow-a {
    width: 520px; height: 520px;
    top: -160px; right: -140px;
    background: radial-gradient(circle, rgba(10,156,139,.85), rgba(10,156,139,0) 70%);
    animation: cdl-drift-a 18s ease-in-out infinite alternate;
}

.cdl-glow-b {
    width: 420px; height: 420px;
    bottom: -180px; left: -120px;
    background: radial-gradient(circle, rgba(64,120,220,.6), rgba(64,120,220,0) 70%);
    animation: cdl-drift-b 22s ease-in-out infinite alternate;
}

@keyframes cdl-drift-a { to { transform: translate(-90px, 70px) scale(1.08); } }
@keyframes cdl-drift-b { to { transform: translate(80px, -60px) scale(1.12); } }

/* Fine monitor grid */
.cdl-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
    background-size: 32px 32px;
    -webkit-mask-image: linear-gradient(180deg, transparent, #000 30%, #000 70%, transparent);
    mask-image: linear-gradient(180deg, transparent, #000 30%, #000 70%, transparent);
    pointer-events: none;
}

.cdl-brand-top, .cdl-brand-copy, .cdl-brand-foot { position: relative; z-index: 1; }

.cdl-brand-top {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: .02em;
    color: #fff;
}

.cdl-logo {
    width: 44px;
    height: 44px;
    padding: 5px;
    object-fit: contain;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 6px 16px -6px rgba(0,0,0,.45);
}

.cdl-brand-copy h1 {
    margin: 0 0 14px;
    font-size: clamp(30px, 3.2vw, 44px);
    line-height: 1.15;
    font-weight: 800;
    letter-spacing: -.02em;
    color: #fff;
}

.cdl-brand-copy h1 span { color: #5fd3c3; }

.cdl-brand-copy p {
    max-width: 420px;
    margin: 0;
    color: #b9c6de;
}

/* Heart-rate trace */
.cdl-ecg {
    display: block;
    width: 100%;
    height: 110px;
    margin: 36px 0 8px;
}

.cdl-ecg-base {
    fill: none;
    stroke: rgba(95,211,195,.18);
    stroke-width: 2;
}

.cdl-ecg-pen {
    fill: none;
    stroke: #5fd3c3;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 160 1400;
    stroke-dashoffset: 1560;
    filter: drop-shadow(0 0 6px rgba(95,211,195,.8));
    animation: cdl-pen 3.2s linear infinite;
}

@keyframes cdl-pen { to { stroke-dashoffset: 0; } }

.cdl-features {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 18px 0 0;
    padding: 0;
    list-style: none;
}

.cdl-features li {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 13px;
    color: #d7e1f2;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 999px;
}

.cdl-features svg { color: #5fd3c3; }

.cdl-brand-foot { font-size: 13px; color: #8ea0c2; }

/* Right form side */
.cdl-form-side {
    display: grid;
    place-items: center;
    padding: 48px 24px;
    background: #fff;
}

.cdl-card { width: 100%; max-width: 400px; }

.cdl-card h2 {
    margin: 0 0 6px;
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -.02em;
    color: var(--cdl-text);
}

.cdl-lead {
    margin: 0 0 28px;
    color: var(--cdl-muted);
}

.cdl-form { display: grid; gap: 18px; }

.cdl-field { display: grid; gap: 6px; }

.cdl-field label {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--cdl-text);
}

.cdl-control { position: relative; }

.cdl-control input {
    display: block;
    width: 100%;
    height: 48px;
    padding: 0 14px;
    font: inherit;
    color: var(--cdl-text);
    background: #fff;
    border: 1px solid var(--cdl-border);
    border-radius: 10px;
    outline: none;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.cdl-control input::placeholder { color: var(--cdl-muted); opacity: .75; }

.cdl-control input:focus {
    border-color: var(--cdl-teal);
    box-shadow: 0 0 0 4px rgba(10,156,139,.18);
}

.cdl-control input[name=password] { padding-right: 52px; }

.cdl-field.has-error input {
    border-color: var(--cdl-error);
    box-shadow: 0 0 0 4px rgba(196,43,43,.12);
}

.cdl-error-text { font-size: 13px; color: var(--cdl-error); }

/* Password show / hide */
.cdl-eye {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--cdl-muted);
    cursor: pointer;
}

.cdl-eye:hover { color: var(--cdl-text); }
.cdl-eye:focus-visible { outline: 2px solid var(--cdl-teal); outline-offset: -4px; }

.cdl-check {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    margin: 0;
    font-size: 14px;
    color: var(--cdl-muted);
    cursor: pointer;
    user-select: none;
}

.cdl-check input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--cdl-teal);
    cursor: pointer;
}

/* Messages above the form */
.cdl-alert {
    padding: 12px 14px;
    font-size: 14px;
    border-radius: 10px;
}

.cdl-alert-error { color: var(--cdl-error); background: var(--cdl-error-bg); animation: cdl-shake 380ms var(--cdl-ease-out); }
.cdl-alert-info { color: var(--cdl-info); background: var(--cdl-info-bg); }

@keyframes cdl-shake {
    20% { transform: translateX(-6px); }
    40% { transform: translateX(5px); }
    60% { transform: translateX(-3px); }
    80% { transform: translateX(2px); }
}

/* Sign in button: idle -> loading -> success */
.cdl-submit {
    position: relative;
    height: 50px;
    border: 0;
    border-radius: 10px;
    font: inherit;
    font-weight: 700;
    color: #fff;
    background: var(--cdl-navy);
    cursor: pointer;
    overflow: hidden;
    transition: background-color 160ms ease, transform 160ms ease;
}

.cdl-submit:hover { background: var(--cdl-navy-hover); }
.cdl-submit:active { transform: scale(.98); }
.cdl-submit:focus-visible { outline: 3px solid var(--cdl-teal); outline-offset: 3px; }
.cdl-submit:disabled { cursor: default; }

.cdl-submit-label,
.cdl-spinner,
.cdl-done {
    transition: opacity 160ms ease, transform 280ms var(--cdl-ease-out);
}

.cdl-spinner,
.cdl-done {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    opacity: 0;
    transform: translateY(8px);
}

.cdl-spinner::before {
    content: "";
    width: 20px;
    height: 20px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: cdl-spin .7s linear infinite;
}

.cdl-submit.is-loading .cdl-submit-label,
.cdl-submit.is-success .cdl-submit-label { opacity: 0; transform: translateY(-8px); }

.cdl-submit.is-loading .cdl-spinner { opacity: 1; transform: none; }

.cdl-submit.is-success { background: var(--cdl-teal); }
.cdl-submit.is-success .cdl-done { opacity: 1; transform: none; }

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

.cdl-footnote {
    margin: 28px 0 0;
    font-size: 13px;
    text-align: center;
    color: var(--cdl-muted);
}

/* Entrance: brand copy rises in, then the form */
.cdl-rise { opacity: 0; transform: translateY(14px); animation: cdl-rise 700ms var(--cdl-ease-out) forwards; }
.cdl-d1 { animation-delay: 80ms; }
.cdl-d2 { animation-delay: 160ms; }
.cdl-d3 { animation-delay: 240ms; }
.cdl-d4 { animation-delay: 320ms; }
.cdl-d5 { animation-delay: 400ms; }

@keyframes cdl-rise { to { opacity: 1; transform: none; } }

/* Phones and small tablets: brand panel becomes a short band on top */
@media (max-width: 900px) {
    .cdl-page { grid-template-columns: 1fr; }
    .cdl-brand { padding: 24px 16px; }
    .cdl-brand-top { font-size: 16px; }
    .cdl-brand-copy h1 { margin-top: 18px; font-size: 26px; }
    .cdl-brand-copy p, .cdl-features, .cdl-brand-foot { display: none; }
    .cdl-ecg { height: 70px; margin: 12px 0 0; }
    .cdl-form-side { padding: 32px 16px 48px; place-items: start center; }
}

/* Respect "reduce motion" */
@media (prefers-reduced-motion: reduce) {
    .cdl-page *, .cdl-page *::before, .cdl-page *::after {
        animation-duration: 1ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 1ms !important;
    }
}
