.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: all;
}

.preloader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.preloader-content {
    text-align: center;
    animation: fadeInScale 1s ease-out;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.pulsing-circle {
    width: 80px;
    height: 80px;
    position: relative;
    margin: 0 auto 1.5rem;
    border-radius: 50%;
    background: var(--brand);
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.pulsing-circle::before,
.pulsing-circle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
}

.pulsing-circle::before {
    width: 140%;
    height: 140%;
    background: var(--brand);
    opacity: 0.3;
    animation: pulse-ring 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.pulsing-circle::after {
    width: 100%;
    height: 100%;
    background: var(--brand);
    opacity: 0.7;
    animation: pulse-ring 1.5s cubic-bezier(0.4, 0, 0.6, 1) infinite 0.5s;
    box-shadow: 0 0 15px rgba(239, 75, 75, 0.3);
    transition: all 0.3s ease;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        opacity: 0.9;
    }
    50% {
        transform: scale(1);
        opacity: 0.5;
    }
    100% {
        transform: scale(0.95);
        opacity: 0.9;
    }
}

@keyframes pulse-ring {
    0% {
        transform: translate(-50%, -50%) scale(0.7);
        opacity: 0.5;
    }
    50% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0;
    }
    100% {
        transform: translate(-50%, -50%) scale(0.7);
        opacity: 0;
    }
}

@keyframes pulseText {
    0%, 100% {
        opacity: 0.8;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(0.98);
    }
}

.loading-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--med-navy);
    margin-top: 1.5rem;
    opacity: 0.8;
    letter-spacing: 0.5px;
    animation: pulseText 2s infinite;
}

.cross-horizontal {
    width: 80px;
    height: 15px;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    animation: pulseAndGlow 2s infinite;
}

.cross-vertical {
    width: 15px;
    height: 80px;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
    animation: pulseAndGlow 2s infinite 0.3s;
}

@keyframes rotateAndPulse {
    0% {
        transform: perspective(800px) rotateY(0deg) scale(1);
    }
    50% {
        transform: perspective(800px) rotateY(180deg) scale(0.9);
    }
    100% {
        transform: perspective(800px) rotateY(360deg) scale(1);
    }
}

/* Hide body content initially */
body.loading {
    overflow: hidden;
}

.main-content {
    visibility: hidden;
    opacity: 0;
    position: relative;
    z-index: 1;
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

.main-content.loaded {
    visibility: visible;
    opacity: 1;
}

:root {
    --brand: #EF4B4B;
    /* aksen utama yang kamu minta */
    --med-teal: #0fb9b1;
    /* nuansa medis (sekunder) */
    --med-navy: #0f2940;
    /* judul */
    --med-slate: #495a6b;
    --med-cloud: #f6f9fb;
    --soft-shadow: 0 10px 30px rgba(15, 41, 64, .08);
    --ring: 0 0 0 3px rgba(239, 75, 75, .18);
}

.bg-hero {
    background:
        radial-gradient(1100px 500px at 90% -10%, rgba(239, 75, 75, .06), transparent 70%),
        radial-gradient(1200px 700px at -10% 10%, rgba(15, 41, 64, .06), transparent 60%),
        #ffffff;
}

.section-title {
    font-weight: 800;
    color: var(--med-navy);
    letter-spacing: .2px;
}

.section-subtitle {
    color: #718096;
    max-width: 720px;
    margin-inline: auto;
}

.ornament {
    width: 82px;
    height: 5px;
    border-radius: 999px;
    background: linear-gradient(90deg, transparent, var(--brand), transparent);
    margin: .6rem auto 1.2rem;
}

/* Sambutan */
.welcome-card {
    border-radius: 20px;
    background: linear-gradient(180deg, #ffffffd9, #ffffffef);
    box-shadow: var(--soft-shadow);
    overflow: hidden;
    border: 1px solid #eef2f6;
}

.welcome-photo {
    object-fit: cover;
    width: 100%;
    height: 100%;
}

.welcome-badge {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .35rem .75rem;
    border-radius: 999px;
    background: #ffe9e9;
    color: #7a1d1d;
    font-weight: 700;
    font-size: .85rem;
}

.welcome-badge i {
    color: var(--brand);
}

/* Tombol brand (ganti semua btn-royal -> btn-brand) */
.btn-brand {
    background: var(--brand);
    color: #fff;
    font-weight: 800;
    border: 0;
    box-shadow: 0 6px 18px rgba(239, 75, 75, .35);
}

.btn-brand:hover {
    filter: brightness(.95);
    color: #fff;
}

/* Statistik – strip kiri pakai brand, DOT sesuai warna awalmu */
.stat-card {
    position: relative;
    border-radius: 16px;
    padding: 1.2rem 1rem 1.1rem;
    background: #fff;
    border: 1px solid #e7edf3;
    box-shadow: var(--soft-shadow);
    transition: transform .18s ease, box-shadow .18s ease;
    overflow: hidden;
}

.stat-card:before {
    content: "";
    position: absolute;
    inset: 0 0 0 auto;
    width: 6px;
    left: 0;
    right: auto;
    background: var(--brand);
    opacity: .85;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 34px rgba(15, 41, 64, .12);
}

.stat-title {
    font-weight: 700;
    color: var(--med-slate);
    font-size: 1.1rem;
    margin-bottom: .35rem;
}

.stat-value {
    font-size: 1.9rem;
    font-weight: 800;
    color: var(--med-navy);
    margin: 0;
}

.stat-dot {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    margin: 10px auto 10px;
    color: #fff;
    font-size: 28px;
    box-shadow: inset var(--ring);
}

/* warna DOT kembali seperti awal */
.stat--pasien .stat-dot {
    background: #1d74f2;
}

/* biru */
.stat--periksa .stat-dot {
    background: #f4a100;
}

/* oranye */
.stat--dokter .stat-dot {
    background: #43c165;
}

/* hijau */
.stat--residen .stat-dot {
    background: #ff5b3d;
}

/* merah */
.stat--rs .stat-dot {
    background: #06aed5;
}

/* cyan */

/* Berita & FAQ kecil */
.news-card {
    border-radius: 14px;
    border: 1px solid #eef2f6;
    overflow: hidden;
    box-shadow: var(--soft-shadow);
}

.news-card img {
    height: 11rem;
    object-fit: cover;
}

.accordion-button {
    font-weight: 600;
    color: var(--med-navy);
}

.accordion-button:focus {
    box-shadow: var(--ring);
}

.accordion-item {
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 14px rgba(15, 41, 64, .06);
    border: 0;
}

.accordion-item+.accordion-item {
    margin-top: .8rem;
}

.btn-royal,
.btn-brand {
    background: var(--brand);
    color: #fff !important;
    font-weight: 800;
    border: 0;
    box-shadow: 0 6px 18px rgba(239, 75, 75, .35);
}

.btn-royal:hover,
.btn-brand:hover {
    filter: brightness(.95);
    color: var(--brand) !important;
}

/* Outline merah (untuk Berita Terbaru) */
.btn-outline-brand {
    border: 1px solid var(--brand);
    color: var(--brand) !important;
    background: transparent;
    font-weight: 700;
}

.btn-outline-brand:hover {
    background: var(--brand);
    color: #fff !important;
    box-shadow: 0 6px 18px rgba(239, 75, 75, .25);
}

/* Fokus aksesibel */
.btn-royal:focus,
.btn-brand:focus,
.btn-outline-brand:focus {
    box-shadow: 0 0 0 0.25rem rgba(239, 75, 75, .25);
}

/* Footer – set ke EF4B4B */
/* .site-footer{ background: var(--brand); color:#fff; }
        .site-footer a{ color:#fff; text-decoration:underline; } */

/* ===================== ANIMASI PROFESIONAL ===================== */

/* Keyframes untuk animasi */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes pulseGlow {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(239, 75, 75, 0.7);
    }

    50% {
        box-shadow: 0 0 0 10px rgba(239, 75, 75, 0);
    }
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-100px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Kelas animasi untuk elemen */
.animate-fade-in-up {
    animation: fadeInUp 0.8s ease-out forwards;
}

.animate-fade-in-left {
    animation: fadeInLeft 0.8s ease-out forwards;
}

.animate-fade-in-right {
    animation: fadeInRight 0.8s ease-out forwards;
}

.animate-fade-in {
    animation: fadeIn 0.6s ease-out forwards;
}

.animate-scale-in {
    animation: scaleIn 0.6s ease-out forwards;
}

.animate-slide-in-down {
    animation: slideInDown 0.8s ease-out forwards;
}

/* Delay untuk animasi berurutan */
.delay-100 {
    animation-delay: 0.1s;
}

.delay-200 {
    animation-delay: 0.2s;
}

.delay-300 {
    animation-delay: 0.3s;
}

.delay-400 {
    animation-delay: 0.4s;
}

.delay-500 {
    animation-delay: 0.5s;
}

.delay-600 {
    animation-delay: 0.6s;
}

.delay-700 {
    animation-delay: 0.7s;
}

/* State awal untuk animasi (hidden) */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease-out;
}

.animate-on-scroll.animated {
    opacity: 1;
    transform: translateY(0);
}

/* Enhanced hover effects */
.stat-card {
    position: relative;
    border-radius: 16px;
    padding: 1.2rem 1rem 1.1rem;
    background: #fff;
    border: 1px solid #e7edf3;
    box-shadow: var(--soft-shadow);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px rgba(15, 41, 64, 0.15);
}

.stat-card:hover .stat-dot {
    transform: scale(1.1) rotate(5deg);
    animation: pulseGlow 2s infinite;
}

.stat-dot {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Enhanced button animations */
.btn-brand,
.btn-royal {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn-brand:before,
.btn-royal:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn-brand:hover:before,
.btn-royal:hover:before {
    left: 100%;
}

.btn-brand:hover,
.btn-royal:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(239, 75, 75, 0.4);
}

/* News card animations */
.news-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.news-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(15, 41, 64, 0.1);
}

.news-card img {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.news-card:hover img {
    transform: scale(1.05);
}

/* Welcome card animation */
.welcome-card {
    transition: all 0.3s ease-out;
}

.welcome-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 25px 50px rgba(15, 41, 64, 0.1);
}

/* Accordion enhanced animation */
.accordion-button {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.accordion-button:hover {
    background-color: rgba(239, 75, 75, 0.05);
    transform: translateX(5px);
}

/* Carousel enhanced animations */
.carousel-item {
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.carousel-caption {
    animation: fadeInUp 1s ease-out 0.3s both;
}

/* Floating animation untuk badge */
.welcome-badge {
    animation: float 3s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-5px);
    }
}

/* Loading skeleton untuk progressive enhancement */
.loading-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

/* Smooth scroll behavior */
html {
    scroll-behavior: smooth;
}

/* Responsive animations - disable on mobile untuk performance */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .animate-on-scroll {
        animation-duration: 0.5s;
    }

    .stat-card:hover {
        transform: translateY(-4px) scale(1.01);
    }

    .parallax-disabled {
        transform: none !important;
    }

    .welcome-badge {
        animation: none;
    }

    .preloader {
        background: #ffffff;
    }

    .back-to-top {
        bottom: 1rem;
        right: 1rem;
        width: 2.5rem;
        height: 2.5rem;
    }
}

/* Touch device optimizations */
@media (hover: none) {

    .stat-card:hover,
    .news-card:hover,
    .btn:hover {
        transform: none;
    }

    .stat-card:active,
    .news-card:active {
        transform: scale(0.98);
    }
}

/* Navbar with glassmorphism effect */
.navbar {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px) saturate(180%);
    -webkit-backdrop-filter: blur(10px) saturate(180%);
    border-bottom: 1px solid rgba(209, 213, 219, 0.3);
    transition: all 0.3s ease-in-out;
}

.navbar.scrolled {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

/* Enhanced navbar elements */
.navbar-brand {
    position: relative;
    z-index: 2;
}

.nav-link {
    position: relative;
    transition: color 0.3s ease;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--brand);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.btn-login {
    background: rgba(239, 75, 75, 0.1);
    color: var(--brand);
    border: 1px solid rgba(239, 75, 75, 0.2);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    transition: all 0.3s ease;
}

.btn-login:hover {
    background: var(--brand);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(239, 75, 75, 0.2);
}

/* Mobile menu enhancements */
.navbar-toggler {
    border: none;
    background: rgba(239, 75, 75, 0.1);
    padding: 0.5rem;
}

.navbar-toggler:focus {
    box-shadow: none;
    outline: 2px solid rgba(239, 75, 75, 0.2);
}

@media (max-width: 991.98px) {
    .navbar-collapse {
        background: rgba(255, 255, 255, 0.9);
        backdrop-filter: blur(10px) saturate(180%);
        -webkit-backdrop-filter: blur(10px) saturate(180%);
        border-radius: 1rem;
        margin-top: 1rem;
        padding: 1rem;
        border: 1px solid rgba(209, 213, 219, 0.3);
    }
}