/* Custom CSS for Desa Website */

/* Root Variables */
:root {
    --primary-red: #dc2626;
    --dark-red: #991b1b;
    --light-red: #fef2f2;
    --text-dark: #111827;
    --text-gray: #6b7280;
}

/* Smooth Scrolling */
html,
body {
    scroll-behavior: smooth;
    max-width: 100%;
    overflow-x: hidden;
}

* {
    box-sizing: border-box;
}

img,
video,
iframe {
    max-width: 100%;
    height: auto;
}

/* Loading Animation */
.loader {
    border-top-color: var(--primary-red);
    -webkit-animation: spinner 1.5s linear infinite;
    animation: spinner 1.5s linear infinite;
}

@-webkit-keyframes spinner {
    0% {
        -webkit-transform: rotate(0deg);
    }
    100% {
        -webkit-transform: rotate(360deg);
    }
}

@keyframes spinner {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-red);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--dark-red);
}

/* Navigation Dropdown Animation */
.group:hover .group-hover\:opacity-100 {
    transition: all 0.3s ease-in-out;
}

/* Hero Section Overlay */
.hero-overlay {
    background: linear-gradient(
        135deg,
        rgba(220, 38, 38, 0.9) 0%,
        rgba(153, 27, 27, 0.9) 100%
    );
}

/* Card Hover Effects */
.card-hover {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

/* Counter Animation */
@keyframes countUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.counter-animate {
    animation: countUp 0.5s ease-out;
}

/* Service Card Icon Animation */
.service-card:hover i {
    animation: bounce 0.5s ease;
}

@keyframes bounce {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Gallery Hover Effect */
.gallery-item {
    position: relative;
    overflow: hidden;
}

.gallery-item img {
    transition: transform 0.3s ease;
}

.gallery-item:hover img {
    transform: scale(1.1);
}

.gallery-item .overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-item:hover .overlay {
    opacity: 1;
}

/* Button Ripple Effect */
.btn-ripple {
    position: relative;
    overflow: hidden;
}

.btn-ripple:before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-ripple:hover:before {
    width: 300px;
    height: 300px;
}

/* News Card Date Badge */
.date-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--primary-red);
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 12px;
}

/* Footer Social Icons */
.social-icon {
    transition: transform 0.3s ease, background-color 0.3s ease;
}

.social-icon:hover {
    transform: translateY(-3px);
}

/* Mobile Menu Animation */
.mobile-menu-enter {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Dropdown Menu */
.mobile-dropdown-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.mobile-dropdown-content:not(.hidden) {
    max-height: 500px;
    transition: max-height 0.5s ease-in;
}

.mobile-dropdown-btn i {
    transition: transform 0.3s ease;
}

.mobile-dropdown-btn[aria-expanded="true"] i {
    transform: rotate(180deg);
}

/* Mobile Menu Scrollbar */

#mobile-menu > div {
    scrollbar-width: thin;
    scrollbar-color: var(--primary-red) #f1f1f1;
}

#mobile-menu::-webkit-scrollbar {
    width: 6px;
}

#mobile-menu::-webkit-scrollbar-track {
    background: #f1f1f1;
}

#mobile-menu::-webkit-scrollbar-thumb {
    background: var(--primary-red);
    border-radius: 3px;
}

nav {
    width: 100%;
    max-width: 100vw;
}

#mobile-menu {
    top: 100%;
    z-index: 40;
}

body.mobile-menu-open {
    overflow: hidden;
}

/* Progress Bar Animation */
.progress-bar {
    position: relative;
    overflow: hidden;
}

.progress-bar:after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background-image: linear-gradient(
        -45deg,
        rgba(255, 255, 255, 0.2) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0.2) 75%,
        transparent 75%,
        transparent
    );
    animation: move 2s linear infinite;
    background-size: 50px 50px;
}

@keyframes move {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 50px 50px;
    }
}

/* Notification Badge */
.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--primary-red);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(220, 38, 38, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(220, 38, 38, 0);
    }
}

/* Form Input Focus */
input:focus,
textarea:focus,
select:focus {
    border-color: var(--primary-red);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

/* Table Responsive */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Print Styles */
@media print {
    .no-print {
        display: none !important;
    }

    .print-break {
        page-break-after: always;
    }
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Dark Mode Support (Optional) */
@media (prefers-color-scheme: dark) {
    /* Add dark mode styles here if needed */
}

/* Custom Animations */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.slide-up {
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Typography */
@media (max-width: 640px) {
    h1 {
        font-size: 1.875rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.25rem;
    }
}

/* Kustomisasi Navigasi Swiper */
.hero-slider-main .swiper-button-prev,
.hero-slider-main .swiper-button-next {
    color: white; /* Warna panah */
    background-color: rgba(
        220,
        38,
        38,
        0.5
    ); /* Merah transparan (sesuai tema) */
    width: 44px;
    height: 44px;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.hero-slider-main .swiper-button-prev:hover,
.hero-slider-main .swiper-button-next:hover {
    background-color: rgba(
        220,
        38,
        38,
        0.8
    ); /* Merah lebih pekat saat di-hover */
}

/* Ukuran ikon panah di dalam */
.hero-slider-main .swiper-button-prev::after,
.hero-slider-main .swiper-button-next::after {
    font-size: 18px;
    font-weight: bold;
}

/* Kustomisasi Paginasi Swiper (Titik-titik) */
.hero-slider-main .swiper-pagination-bullet {
    background: rgba(255, 255, 255, 0.5); /* Titik non-aktif */
    opacity: 1;
    transition: background-color 0.3s ease, width 0.3s ease;
}

.hero-slider-main .swiper-pagination-bullet-active {
    background: #dc2626; /* Warna merah (sesuai tema) */
    width: 20px;
    border-radius: 5px;
}

/* Animasi teks masuk (jika belum ada di style.css) */
.animate-slide-up {
    /* Menerapkan animasi HANYA saat slide aktif */
    .swiper-slide-active & {
        animation: slideUp 0.6s ease-out forwards;
    }

    /* Sembunyikan elemen di slide non-aktif */
    opacity: 0;
}

/* ===== Animasi Ticker Informasi ===== */
.ticker-wrap {
    overflow: hidden;
}

.ticker-tape {
    display: flex; /* Menggunakan flexbox */
    width: fit-content; /* Lebar sesuai konten */
    animation: scroll-horizontal 40s linear infinite;
}

.ticker-item {
    flex-shrink: 0; /* Mencegah item menyusut */
    white-space: nowrap; /* Teks tetap satu baris */
    padding: 0 1.5rem; /* Jarak antar item */
}

@keyframes scroll-horizontal {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    } /* Bergerak 50% (lebar list asli) */
}

/* Jeda animasi saat kursor mouse di atasnya */
.ticker-wrap:hover .ticker-tape {
    animation-play-state: paused;
}

#map {
    position: relative;
    z-index: 10;
}

#map .leaflet-container {
    z-index: 10 !important;
}

#map .leaflet-pane {
    z-index: 10 !important;
}

#map .leaflet-marker-pane,
#map .leaflet-popup-pane {
    z-index: 20 !important;
}

/* Hero Background Slider Fix */
.hero-background-slider {
    width: 100%;
    height: 100%;
}

.hero-background-slider .swiper-wrapper {
    height: 100%;
}

.hero-background-slider .swiper-slide {
    width: 100%;
    height: 100%;
    background-repeat: no-repeat;
}

/* Pastikan section slider memiliki height yang tepat */
section.relative.h-\[500px\],
section.relative.h-\[600px\],
section.relative.h-\[700px\] {
    position: relative;
    overflow: hidden;
}
