/* ================================================================
   PRELOADER — Carely Health
   ================================================================ */

/* ── Overlay ──────────────────────────────────────────────────── */
#preloader {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: #020817;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition:
        opacity  0.75s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.75s cubic-bezier(0.4, 0, 0.2, 1);
}

#preloader.pl-fade-out {
    opacity: 0;
    transform: scale(1.04);
    pointer-events: none;
}

/* ── Ambient background glow ──────────────────────────────────── */
.pl-bg-glow {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 65% 55% at 50% 50%, rgba(0, 194, 255, 0.07) 0%, transparent 70%),
        radial-gradient(ellipse 40% 35% at 25% 75%, rgba(0, 212, 170, 0.05) 0%, transparent 65%),
        radial-gradient(ellipse 35% 45% at 75% 25%, rgba(18, 73, 164, 0.06) 0%, transparent 65%);
    animation: pl-glow-breathe 4s ease-in-out infinite alternate;
    pointer-events: none;
}

@keyframes pl-glow-breathe {
    from { opacity: 0.65; transform: scale(1); }
    to   { opacity: 1;    transform: scale(1.06); }
}

/* ── Floating particles ───────────────────────────────────────── */
.pl-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.pl-particle {
    position: absolute;
    border-radius: 50%;
    background: rgba(0, 194, 255, 0.55);
    animation: pl-particle-rise linear infinite;
}

.pl-particle:nth-child(3n + 1) { background: rgba(0, 212, 170, 0.55); }
.pl-particle:nth-child(5n + 2) { background: rgba(245, 197, 24,  0.35); }
.pl-particle:nth-child(7n + 3) { background: rgba(30,  106, 255, 0.45); }

@keyframes pl-particle-rise {
    0%   { transform: translateY(20px) scale(1);    opacity: 0; }
    10%  { opacity: 1; }
    85%  { opacity: 0.8; }
    100% { transform: translateY(-100vh) scale(0.4); opacity: 0; }
}

/* ── Main content block ───────────────────────────────────────── */
.pl-content {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: pl-content-enter 0.9s cubic-bezier(0.34, 1.4, 0.64, 1) both;
}

@keyframes pl-content-enter {
    from { opacity: 0; transform: translateY(28px) scale(0.94); }
    to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* ── Orbit system ─────────────────────────────────────────────── */
.pl-orbit-system {
    position: relative;
    width: 260px;
    height: 260px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 30px;
}

/* Rings */
.pl-ring {
    position: absolute;
    border-radius: 50%;
    border: 1px solid transparent;
    animation: pl-ring-spin linear infinite;
}

.pl-ring--1 {
    width: 128px;
    height: 128px;
    border-color: rgba(0, 194, 255, 0.28);
    animation-duration: 6s;
}

.pl-ring--2 {
    width: 192px;
    height: 192px;
    border-color: rgba(0, 212, 170, 0.2);
    animation-duration: 11s;
    animation-direction: reverse;
}

.pl-ring--3 {
    width: 258px;
    height: 258px;
    border-color: rgba(18, 73, 164, 0.22);
    animation-duration: 17s;
}

@keyframes pl-ring-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* Glowing orbit dot — one per ring via ::before */
.pl-ring::before {
    content: '';
    position: absolute;
    border-radius: 50%;
    width: 7px;
    height: 7px;
    top: 50%;
    left: -3.5px;
    transform: translateY(-50%);
}

.pl-ring--1::before {
    background: #00c2ff;
    box-shadow: 0 0 10px 3px rgba(0, 194, 255, 0.8);
}

.pl-ring--2::before {
    background: #00d4aa;
    box-shadow: 0 0 10px 3px rgba(0, 212, 170, 0.8);
    left: auto;
    right: -3.5px;
}

.pl-ring--3::before {
    background: #1e6aff;
    box-shadow: 0 0 10px 3px rgba(30, 106, 255, 0.8);
    top: -3.5px;
    left: 50%;
    transform: translateX(-50%);
}

/* ── Core icon ────────────────────────────────────────────────── */
.pl-core {
    position: relative;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Expanding pulse rings */
.pl-core-pulse {
    position: absolute;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    pointer-events: none;
}

.pl-core-pulse::before,
.pl-core-pulse::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 1px solid rgba(0, 194, 255, 0.35);
    animation: pl-pulse-expand 2.4s ease-out infinite;
}

.pl-core-pulse::after {
    animation-delay: 1.2s;
    border-color: rgba(0, 212, 170, 0.3);
}

@keyframes pl-pulse-expand {
    0%   { transform: scale(0.85); opacity: 1; }
    100% { transform: scale(2.8);  opacity: 0; }
}

/* Glassmorphic icon box */
.pl-core-icon {
    position: relative;
    width: 60px;
    height: 60px;
    background: rgba(2, 8, 23, 0.75);
    border-radius: 18px;
    border: 1px solid rgba(0, 194, 255, 0.32);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow:
        0 0 30px rgba(0, 194, 255, 0.22),
        0 0 70px rgba(0, 212, 170, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.12),
        inset 0 -1px 0 rgba(0, 194, 255, 0.08);
    animation: pl-icon-breathe 2s ease-in-out infinite alternate;
}

.pl-core-icon svg {
    width: 34px;
    height: 34px;
    filter: drop-shadow(0 0 8px rgba(0, 194, 255, 0.6));
}

@keyframes pl-icon-breathe {
    from {
        box-shadow:
            0 0 20px rgba(0, 194, 255, 0.18),
            0 0 50px rgba(0, 212, 170, 0.08),
            inset 0 1px 0 rgba(255, 255, 255, 0.1);
    }
    to {
        box-shadow:
            0 0 45px rgba(0, 194, 255, 0.38),
            0 0 90px rgba(0, 212, 170, 0.18),
            inset 0 1px 0 rgba(255, 255, 255, 0.18);
    }
}

/* ── Brand ────────────────────────────────────────────────────── */
.pl-brand {
    display: flex;
    align-items: baseline;
    gap: 7px;
    margin-bottom: 6px;
    animation: pl-fade-up 0.6s 0.25s ease both;
}

.pl-brand-name {
    font-family: 'Manrope', system-ui, sans-serif;
    font-size: 30px;
    font-weight: 800;
    color: #f0f6ff;
    letter-spacing: -0.5px;
    line-height: 1;
}

.pl-brand-suffix {
    font-family: 'Manrope', system-ui, sans-serif;
    font-size: 30px;
    font-weight: 400;
    background: linear-gradient(120deg, #00c2ff 0%, #00d4aa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1;
}

.pl-tagline {
    font-family: 'Manrope', system-ui, sans-serif;
    font-size: 10.5px;
    font-weight: 600;
    color: rgba(240, 246, 255, 0.35);
    letter-spacing: 3.5px;
    text-transform: uppercase;
    margin: 0 0 26px;
    animation: pl-fade-up 0.6s 0.4s ease both;
}

/* ── ECG heartbeat line ───────────────────────────────────────── */
.pl-ecg-wrap {
    width: 320px;
    height: 50px;
    margin-bottom: 22px;
    overflow: hidden;
    animation: pl-fade-up 0.6s 0.5s ease both;
}

.pl-ecg {
    width: 100%;
    height: 100%;
}

.pl-ecg-bg {
    opacity: 1;
}

.pl-ecg-path {
    stroke-dasharray: 620;
    stroke-dashoffset: 1240;
    animation: pl-ecg-scan 2.8s ease-in-out infinite;
}

@keyframes pl-ecg-scan {
    0%   { stroke-dashoffset: 1240; opacity: 0.2; }
    15%  { opacity: 1; }
    75%  { opacity: 1; }
    100% { stroke-dashoffset: -620; opacity: 0.2; }
}

/* ── Progress bar ─────────────────────────────────────────────── */
.pl-progress-wrap {
    width: 280px;
    animation: pl-fade-up 0.6s 0.6s ease both;
}

.pl-progress-track {
    height: 3px;
    background: rgba(240, 246, 255, 0.07);
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: 10px;
    position: relative;
}

/* Shimmer sweep on track */
.pl-progress-track::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.06) 50%, transparent 100%);
    animation: pl-shimmer 2s linear infinite;
}

@keyframes pl-shimmer {
    from { transform: translateX(-100%); }
    to   { transform: translateX(200%); }
}

.pl-progress-fill {
    height: 100%;
    width: 0%;
    border-radius: 99px;
    background: linear-gradient(90deg, #1249A4 0%, #00c2ff 50%, #00d4aa 100%);
    box-shadow: 0 0 10px rgba(0, 194, 255, 0.5);
    transition: width 0.22s ease;
    position: relative;
}

/* Leading glow dot */
.pl-progress-fill::after {
    content: '';
    position: absolute;
    right: -1px;
    top: 50%;
    transform: translateY(-50%);
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #00c2ff;
    box-shadow:
        0 0 8px  4px rgba(0, 194, 255, 0.7),
        0 0 16px 6px rgba(0, 194, 255, 0.3);
    transition: opacity 0.2s;
}

.pl-progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pl-progress-label {
    font-family: 'Manrope', system-ui, sans-serif;
    font-size: 10px;
    font-weight: 600;
    color: rgba(240, 246, 255, 0.32);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    transition: color 0.3s ease;
}

.pl-progress-pct {
    font-family: 'Manrope', system-ui, sans-serif;
    font-size: 10px;
    font-weight: 800;
    color: rgba(0, 194, 255, 0.75);
    letter-spacing: 1px;
    font-variant-numeric: tabular-nums;
}

/* ── Shared fade-up keyframe ──────────────────────────────────── */
@keyframes pl-fade-up {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 480px) {
    .pl-orbit-system {
        width: 210px;
        height: 210px;
        margin-bottom: 22px;
    }

    .pl-ring--1 { width: 104px; height: 104px; }
    .pl-ring--2 { width: 156px; height: 156px; }
    .pl-ring--3 { width: 210px; height: 210px; }

    .pl-core-icon {
        width: 50px;
        height: 50px;
        border-radius: 14px;
    }

    .pl-core-icon svg { width: 28px; height: 28px; }

    .pl-brand-name,
    .pl-brand-suffix { font-size: 24px; }

    .pl-tagline { font-size: 9px; letter-spacing: 2.5px; }

    .pl-ecg-wrap    { width: 260px; }
    .pl-progress-wrap { width: 240px; }
}

@media (max-width: 360px) {
    .pl-orbit-system { width: 180px; height: 180px; }
    .pl-ring--1 { width: 88px;  height: 88px;  }
    .pl-ring--2 { width: 132px; height: 132px; }
    .pl-ring--3 { width: 180px; height: 180px; }

    .pl-brand-name,
    .pl-brand-suffix { font-size: 20px; }

    .pl-ecg-wrap      { width: 220px; }
    .pl-progress-wrap { width: 200px; }
}

@media (prefers-reduced-motion: reduce) {
    .pl-ring,
    .pl-core-pulse::before,
    .pl-core-pulse::after,
    .pl-core-icon,
    .pl-bg-glow,
    .pl-particle,
    .pl-ecg-path,
    .pl-progress-track::after { animation: none; }

    .pl-ecg-path { stroke-dasharray: unset; stroke-dashoffset: unset; opacity: 1; }
}
