/* ==========================================================================
   EloSaúde - Dynamic & Interactive Medical Loading Screen Styles
   ========================================================================== */

:root {
    --loader-primary: #0B4F9A;
    --loader-primary-light: #256BBA;
    --loader-primary-dark: #083B75;
    --loader-secondary: #00BFA5;
    --loader-secondary-light: #33CCB7;
    --loader-accent: #38bdf8;
    --loader-bg-light: #F4F7FA;
    --loader-card-bg: rgba(255, 255, 255, 0.94);
    --loader-text-dark: #1A2533;
    --loader-text-muted: #5A6A80;
    --loader-border: rgba(226, 232, 240, 0.85);
    --blazor-load-percentage: 0%;
    --blazor-load-percentage-text: "0%";
}

/* Base Wrapper */
.elosaude-loader-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 50% 15%, #ebf4ff 0%, #F4F7FA 65%, #e2effd 100%);
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--loader-text-dark);
    padding: 1.25rem;
    box-sizing: border-box;
    overflow: hidden;
    z-index: 10000;
}

/* Background Animated Medical Elements */
.loader-bg-mesh {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 1;
}

.mesh-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(60px);
    opacity: 0.45;
    animation: orbFloat 10s ease-in-out infinite alternate;
}

.orb-1 {
    width: 320px;
    height: 320px;
    background: radial-gradient(circle, rgba(0, 191, 165, 0.35) 0%, rgba(0, 191, 165, 0) 70%);
    top: -40px;
    right: 10%;
    animation-duration: 12s;
}

.orb-2 {
    width: 380px;
    height: 380px;
    background: radial-gradient(circle, rgba(11, 79, 154, 0.3) 0%, rgba(11, 79, 154, 0) 70%);
    bottom: -60px;
    left: 8%;
    animation-duration: 14s;
    animation-delay: -3s;
}

.mesh-cross {
    position: absolute;
    font-weight: 700;
    color: rgba(11, 79, 154, 0.08);
    user-select: none;
    animation: crossDrift 16s ease-in-out infinite alternate;
}

.cross-1 { font-size: 3.5rem; top: 12%; left: 15%; animation-duration: 18s; }
.cross-2 { font-size: 2.5rem; bottom: 18%; right: 12%; animation-duration: 15s; animation-delay: -4s; }
.cross-3 { font-size: 4rem; top: 70%; left: 18%; animation-duration: 20s; animation-delay: -8s; }
.cross-4 { font-size: 2rem; top: 25%; right: 22%; animation-duration: 13s; animation-delay: -2s; }

@keyframes orbFloat {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(30px, 40px) scale(1.12); }
}

@keyframes crossDrift {
    0% { transform: translateY(0) rotate(0deg); opacity: 0.06; }
    50% { opacity: 0.14; }
    100% { transform: translateY(-25px) rotate(45deg); opacity: 0.06; }
}

/* Main Loading Card */
.elosaude-loader-card {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 460px;
    background: var(--loader-card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 28px;
    border: 1px solid rgba(255, 255, 255, 0.85);
    box-shadow: 0 25px 60px -15px rgba(11, 79, 154, 0.18), 0 10px 24px -6px rgba(0, 191, 165, 0.1);
    padding: 2.2rem 1.85rem;
    box-sizing: border-box;
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    animation: cardAppear 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes cardAppear {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Security Badge */
.loader-security-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: rgba(0, 191, 165, 0.08);
    border: 1px solid rgba(0, 191, 165, 0.25);
    border-radius: 9999px;
    padding: 5px 14px;
    margin-bottom: 1.4rem;
}

.security-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background-color: var(--loader-secondary);
    box-shadow: 0 0 8px var(--loader-secondary);
    animation: securityBlink 2s infinite ease-in-out;
}

.security-text {
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.4px;
    color: #00796B;
    text-transform: uppercase;
}

@keyframes securityBlink {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.85); }
}

/* ==========================================================================
   Logo Stage & Dynamic Rotating Rings
   ========================================================================== */
.elosaude-logo-stage {
    position: relative;
    width: 136px;
    height: 136px;
    margin: 0 auto 1.25rem auto;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    user-select: none;
    touch-action: manipulation;
}

/* Outer Orbital Ring - Clockwise */
.orbital-ring.ring-outer {
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 1.5px dashed rgba(0, 191, 165, 0.45);
    animation: rotateClockwise 8.5s linear infinite;
    pointer-events: none;
    transition: border-color 0.3s ease;
}

.orbital-ring.ring-outer .orbital-node.node-teal {
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--loader-secondary);
    box-shadow: 0 0 10px var(--loader-secondary), 0 0 18px rgba(0, 191, 165, 0.8);
}

.orbital-ring.ring-outer .orbital-node.node-blue {
    position: absolute;
    bottom: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--loader-primary);
    box-shadow: 0 0 10px var(--loader-primary), 0 0 18px rgba(11, 79, 154, 0.7);
}

/* Inner Orbital Ring - Counter-Clockwise */
.orbital-ring.ring-inner {
    position: absolute;
    inset: 10px;
    border-radius: 50%;
    border: 1.5px dotted rgba(11, 79, 154, 0.35);
    animation: rotateCounterClockwise 5.8s linear infinite;
    pointer-events: none;
}

.orbital-ring.ring-inner .orbital-node.node-cyan {
    position: absolute;
    top: 50%;
    right: -4px;
    transform: translateY(-50%);
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--loader-accent);
    box-shadow: 0 0 8px var(--loader-accent);
}

/* Fast spin on hover */
.elosaude-logo-stage:hover .orbital-ring.ring-outer {
    animation-duration: 4.5s;
    border-color: rgba(0, 191, 165, 0.85);
}

.elosaude-logo-stage:hover .orbital-ring.ring-inner {
    animation-duration: 3s;
    border-color: rgba(11, 79, 154, 0.7);
}

/* Legacy circle suppression to ensure only the logo with dynamic rings is shown */
svg.loading-progress,
.loading-progress circle,
.circular-progress-svg {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    stroke: none !important;
    fill: none !important;
}

/* Center Emblem Badge with Cardiac Pulse */
.elosaude-emblem-badge {
    position: relative;
    z-index: 3;
    width: 84px;
    height: 84px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 10px 24px rgba(11, 79, 154, 0.16), 0 0 0 1px rgba(0, 191, 165, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: cardiacPulse 2.8s ease-in-out infinite;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.elosaude-logo-stage:hover .elosaude-emblem-badge {
    transform: scale(1.06);
    box-shadow: 0 14px 30px rgba(0, 191, 165, 0.26), 0 0 0 2px var(--loader-secondary);
}

.elosaude-logo-stage:active .elosaude-emblem-badge {
    transform: scale(0.96);
}

.emblem-img {
    width: 52px;
    height: 52px;
    object-fit: contain;
    border-radius: 12px;
    filter: drop-shadow(0 2px 5px rgba(0,0,0,0.06));
    transition: transform 0.25s ease;
}

.emblem-pulse-ring {
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 2px solid rgba(0, 191, 165, 0.4);
    opacity: 0;
    pointer-events: none;
    animation: pulseRing 2.8s ease-out infinite;
}

/* Interactive Ripple on Click */
.ripple-wave {
    position: absolute;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 2px solid var(--loader-secondary);
    opacity: 0;
    pointer-events: none;
    z-index: 1;
}

.ripple-wave.animate-ripple {
    animation: rippleExpand 0.75s cubic-bezier(0.2, 0.8, 0.4, 1) forwards;
}

@keyframes rotateClockwise {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes rotateCounterClockwise {
    from { transform: rotate(360deg); }
    to { transform: rotate(0deg); }
}

@keyframes cardiacPulse {
    0% { transform: scale(1); }
    12% { transform: scale(1.05); }
    24% { transform: scale(1); }
    36% { transform: scale(1.03); }
    48% { transform: scale(1); }
    100% { transform: scale(1); }
}

@keyframes pulseRing {
    0% { transform: scale(0.9); opacity: 0.8; }
    50% { transform: scale(1.25); opacity: 0; }
    100% { transform: scale(1.25); opacity: 0; }
}

@keyframes rippleExpand {
    0% {
        transform: scale(0.8);
        opacity: 0.9;
        border-color: var(--loader-secondary);
    }
    100% {
        transform: scale(2.4);
        opacity: 0;
        border-color: var(--loader-primary);
    }
}

/* ==========================================================================
   Brand Header
   ========================================================================== */
.loader-brand-header {
    margin-bottom: 0.85rem;
}

.loader-brand-title {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.4px;
    line-height: 1.2;
}

.title-blue {
    color: var(--loader-primary);
}

.title-teal {
    color: var(--loader-secondary);
}

.loader-brand-sub {
    margin: 4px 0 0 0;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--loader-text-muted);
}

/* ==========================================================================
   Medical ECG Heartbeat Wave
   ========================================================================== */
.ecg-pulse-wrapper {
    width: 240px;
    height: 28px;
    margin: 0.6rem auto 1.1rem auto;
    position: relative;
    overflow: hidden;
}

.ecg-pulse-svg {
    width: 100%;
    height: 100%;
    display: block;
}

.ecg-path-bg {
    fill: none;
    stroke: rgba(226, 232, 240, 0.7);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.ecg-path-pulse {
    fill: none;
    stroke: var(--loader-secondary);
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 280;
    stroke-dashoffset: 280;
    animation: ecgFlow 2.5s ease-in-out infinite;
    filter: drop-shadow(0 0 3px rgba(0, 191, 165, 0.6));
}

@keyframes ecgFlow {
    0% { stroke-dashoffset: 280; }
    50% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -280; }
}

/* ==========================================================================
   Progress Section & Bar
   ========================================================================== */
.loader-progress-section {
    margin-bottom: 1.25rem;
}

.progress-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 0.82rem;
}

.progress-status-text {
    font-weight: 600;
    color: var(--loader-primary);
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80%;
    transition: opacity 0.2s ease;
}

.progress-percent-number {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--loader-secondary);
    font-variant-numeric: tabular-nums;
}

.progress-bar-track {
    width: 100%;
    height: 8px;
    background: #E2E8F0;
    border-radius: 9999px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
}

.progress-bar-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #0B4F9A 0%, #00BFA5 60%, #38bdf8 100%);
    border-radius: 9999px;
    position: relative;
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 12px rgba(0, 191, 165, 0.45);
}

.progress-shimmer {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.65) 50%, transparent 100%);
    transform: translateX(-100%);
    animation: shimmerGlide 1.8s infinite;
}

@keyframes shimmerGlide {
    100% { transform: translateX(100%); }
}

/* 4 Stage Clinical Milestones */
.loader-milestones {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
    padding: 0 4px;
}

.milestone-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.68rem;
    font-weight: 600;
    color: #94A3B8;
    transition: color 0.3s ease;
}

.milestone-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #E2E8F0;
    color: #64748B;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 700;
    transition: all 0.3s ease;
}

.milestone-item.active {
    color: var(--loader-primary);
}

.milestone-item.active .milestone-dot {
    background: var(--loader-secondary);
    color: #ffffff;
    box-shadow: 0 0 8px rgba(0, 191, 165, 0.6);
}

/* ==========================================================================
   Interactive Health & Clinical Tip Card
   ========================================================================== */
.loader-tip-card {
    background: linear-gradient(145deg, #f0fdf9 0%, #f4f8fc 100%);
    border: 1px solid rgba(0, 191, 165, 0.25);
    border-radius: 18px;
    padding: 12px 14px;
    text-align: left;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    user-select: none;
    box-shadow: 0 4px 12px rgba(11, 79, 154, 0.04);
}

.loader-tip-card:hover {
    transform: translateY(-2px);
    border-color: var(--loader-secondary);
    box-shadow: 0 8px 20px rgba(0, 191, 165, 0.12);
}

.loader-tip-card:active {
    transform: translateY(0);
}

.tip-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.tip-tag {
    font-size: 0.64rem;
    font-weight: 700;
    color: #00796B;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.tip-next-hint {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--loader-primary);
    background: rgba(11, 79, 154, 0.08);
    padding: 2px 8px;
    border-radius: 9999px;
    transition: background 0.2s ease;
}

.loader-tip-card:hover .tip-next-hint {
    background: var(--loader-primary);
    color: #ffffff;
}

.tip-card-content {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    min-height: 44px;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.tip-card-content.fade-out {
    opacity: 0;
    transform: translateY(-4px);
}

.tip-icon {
    font-size: 1.15rem;
    line-height: 1.2;
    flex-shrink: 0;
}

.tip-text {
    margin: 0;
    font-size: 0.74rem;
    line-height: 1.38;
    color: var(--loader-text-dark);
}

.tip-text strong {
    color: var(--loader-primary-dark);
}

.tip-card-dots {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 8px;
}

.tip-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #CBD5E1;
    transition: all 0.3s ease;
}

.tip-dot.active {
    width: 14px;
    border-radius: 9999px;
    background: var(--loader-secondary);
}

/* ==========================================================================
   Interaction Toast & Footer
   ========================================================================== */
.loader-toast {
    position: absolute;
    bottom: 50px;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: #0F172A;
    color: #ffffff;
    font-size: 0.74rem;
    font-weight: 600;
    padding: 6px 16px;
    border-radius: 9999px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    z-index: 10;
    white-space: nowrap;
}

.loader-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.loader-footer {
    margin-top: 1.1rem;
    font-size: 0.65rem;
    color: #94A3B8;
    font-weight: 500;
    letter-spacing: 0.2px;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .elosaude-loader-card {
        padding: 1.75rem 1.25rem;
        border-radius: 22px;
    }

    .elosaude-logo-stage {
        width: 120px;
        height: 120px;
        margin-bottom: 1rem;
    }

    .elosaude-emblem-badge {
        width: 72px;
        height: 72px;
    }

    .emblem-img {
        width: 44px;
        height: 44px;
    }

    .loader-brand-title {
        font-size: 1.55rem;
    }

    .ecg-pulse-wrapper {
        width: 200px;
        height: 24px;
    }

    .milestone-label {
        display: none;
    }
}
