/* 
 * RS Galeri Candra - Custom Styles
 * Homepage Template Styles
 */

/* Custom Scrollbar */
::-webkit-scrollbar { width: 3px; height: 3px; }
::-webkit-scrollbar-track { background: rgba(148, 163, 184, 0.1); }
::-webkit-scrollbar-thumb { 
    background: linear-gradient(45deg, #be123c, #881337); 
    border-radius: 10px; 
}

/* Selective transitions - avoid * selector conflicts */
.nav-button, 
.service-card, 
.category-card, 
.btn, 
button, 
a {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Utility Classes */
.shadow-modern {
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.slide-in {
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.nav-button {
    transition: all 0.2s ease;
}

.nav-button:hover {
    transform: scale(1.05);
}

.nav-button:active {
    transform: scale(0.95);
}

body {
    overscroll-behavior: none;
}

.gradient-text {
    background: linear-gradient(135deg, #9f1239, #be123c);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Swiper Customizations */
.swiper-pagination-bullet-active {
    background: #9f1239 !important;
}

/* Prevent layout shift before Swiper initialization */
[class*="doctorSwiper-"]:not(.swiper-initialized) .swiper-wrapper,
.roomSwiper:not(.swiper-initialized) .swiper-wrapper {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

[class*="doctorSwiper-"]:not(.swiper-initialized) .swiper-slide,
.roomSwiper:not(.swiper-initialized) .swiper-slide {
    flex: 0 0 auto;
    width: 50% !important;
    margin-right: 12px;
    scroll-snap-align: start;
}

@media (min-width: 640px) {
    [class*="doctorSwiper-"]:not(.swiper-initialized) .swiper-slide {
        width: 33.333% !important;
        margin-right: 16px;
    }
    .roomSwiper:not(.swiper-initialized) .swiper-slide {
        width: 50% !important;
        margin-right: 16px;
    }
}

@media (min-width: 1024px) {
    [class*="doctorSwiper-"]:not(.swiper-initialized) .swiper-slide {
        width: 25% !important;
        margin-right: 20px;
    }
    .roomSwiper:not(.swiper-initialized) .swiper-slide {
        width: 33.333% !important;
        margin-right: 20px;
    }
}

@media (min-width: 1280px) {
    .roomSwiper:not(.swiper-initialized) .swiper-slide {
        width: 28.571% !important; /* Approximately 3.5 slides visible */
        margin-right: 24px;
    }
}

/* Hide overflow until initialized */
[class*="doctorSwiper-"]:not(.swiper-initialized),
.roomSwiper:not(.swiper-initialized) {
    overflow: hidden;
}

/* Hide content until Swiper is fully initialized to prevent single card flash */
[class*="doctorSwiper-"]:not(.swiper-initialized) .swiper-wrapper,
.roomSwiper:not(.swiper-initialized) .swiper-wrapper {
    opacity: 0;
    transition: opacity 0.1s ease;
}

[class*="doctorSwiper-"].swiper-initialized .swiper-wrapper,
.roomSwiper.swiper-initialized .swiper-wrapper {
    opacity: 1;
}

/* Smooth transition when Swiper initializes */
.swiper-wrapper {
    transition: transform 0.3s ease;
}

/* Loading state - minimal height to prevent layout shift */
.swiper:not(.swiper-initialized) {
    min-height: 280px;
}

/* Prevent flash of content - show slides immediately before initialization */
[class*="doctorSwiper-"]:not(.swiper-initialized) .swiper-slide,
.roomSwiper:not(.swiper-initialized) .swiper-slide {
    opacity: 1 !important;
    animation: none !important;
}

/* Only apply fade animation after Swiper is initialized */
.swiper-initialized .swiper-slide {
    opacity: 1;
    animation: none;
}

/* Hero Carousel Styling */
.hero-carousel .swiper-pagination {
    bottom: 20px;
}

.hero-carousel .swiper-pagination-bullet {
    width: 12px;
    height: 12px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 1;
    transition: all 0.3s ease;
}

.hero-carousel .swiper-pagination-bullet-active {
    background: white !important;
    transform: scale(1.2);
}

/* Modal & Overlay Styles */
.location-modal {
    backdrop-filter: blur(8px);
}

.service-unavailable {
    opacity: 0.5;
    pointer-events: none;
}

/* Text & Layout Utilities */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.safe-top { 
    padding-top: env(safe-area-inset-top); 
}

.safe-bottom { 
    padding-bottom: env(safe-area-inset-bottom); 
}

/* Fixed Header Styles */
header, 
[class*="top-0"], 
[class*="top-10"] {
    background-color: white !important;
}

body {
    background-color: white !important;
}

/* Sticky floating header */
.floating-header {
    position: sticky;
    top: 64px;
    z-index: 40;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.5);
    transition: all 0.3s ease;
}

.floating-header.scrolled {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* Categories Carousel Styling */
.categories-swiper .swiper-slide {
    height: auto;
    min-height: 200px;
}

.categories-swiper .swiper-pagination {
    display: none !important;
}

@media (min-width: 1024px) {
    .categories-swiper .swiper-slide {
        min-height: 220px;
    }
}

/* Article & News Section - Redesigned */
.article-card {
    background: white;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    height: 100%;
    display: flex;
    flex-direction: column;
    border: 1px solid #f1f5f9;
    position: relative;
}

.article-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #AC4335, #be123c);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s ease;
}

.article-card:hover::before {
    transform: scaleX(1);
}

.article-card:hover {
    box-shadow: 0 12px 28px rgba(172, 67, 53, 0.15);
    transform: translateY(-8px);
    border-color: rgba(172, 67, 53, 0.2);
}

.article-image {
    width: 100%;
    height: 220px;
    object-fit: cover;
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    transition: transform 0.4s ease;
}

.article-card:hover .article-image {
    transform: scale(1.05);
}

.article-category {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    color: #AC4335;
    font-size: 11px;
    font-weight: 700;
    border-radius: 20px;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: 1px solid rgba(172, 67, 53, 0.1);
}

.article-title {
    font-size: 17px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 10px;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.3s ease;
}

.article-card:hover .article-title {
    color: #AC4335;
}

.article-excerpt {
    font-size: 14px;
    color: #64748b;
    line-height: 1.7;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1;
    margin-bottom: 16px;
}

.article-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    font-size: 12px;
    color: #94a3b8;
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid #f1f5f9;
}

.article-meta > span {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.article-meta i {
    color: #AC4335;
    opacity: 0.7;
}

.article-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.article-swiper {
    padding-bottom: 50px !important;
}

.article-swiper .swiper-pagination {
    bottom: 20px !important;
}

.article-swiper .swiper-pagination-bullet {
    width: 8px;
    height: 8px;
    background: #cbd5e1;
    opacity: 1;
    transition: all 0.3s ease;
}

.article-swiper .swiper-pagination-bullet-active {
    background: #AC4335;
    width: 28px;
    border-radius: 4px;
}

@media (min-width: 1024px) {
    .article-image {
        height: 240px;
    }

    .article-title {
        font-size: 18px;
    }

    .article-excerpt {
        font-size: 15px;
    }

    .article-content {
        padding: 24px;
    }
    
    .article-meta {
        font-size: 13px;
    }
}

.article-content {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.article-swiper {
    padding-bottom: 50px !important;
}

.article-swiper .swiper-pagination {
    bottom: 20px !important;
}

.article-swiper .swiper-pagination-bullet {
    width: 8px;
    height: 8px;
    background: #cbd5e1;
    opacity: 1;
}

.article-swiper .swiper-pagination-bullet-active {
    background: #9f1239;
    width: 24px;
    border-radius: 4px;
}

/* CSS Conflict Prevention */
.choices__inner {
    box-sizing: border-box !important;
}

.swiper-container {
    box-sizing: border-box !important;
}

/* Prevent Tailwind conflicts */
.choices__list--dropdown .choices__item--selectable {
    box-shadow: none !important;
}

@media (min-width: 1024px) {
    .article-image {
        height: 220px;
    }

    .article-title {
        font-size: 18px;
    }

    .article-excerpt {
        font-size: 15px;
    }

    .article-content {
        padding: 20px;
    }
}

/* Service catalog styling */
.service-swiper .swiper-slide {
    width: calc(66.666% - 8px) !important;
}

.service-swiper .swiper-slide:first-child {
    width: calc(100% - 16px) !important;
}

.service-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    grid-auto-rows: 1fr;
    grid-auto-flow: dense;
}

@media (min-width: 768px) {
    .service-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
}

@media (min-width: 1024px) {
    .service-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 12px;
    }
}

@media (min-width: 1536px) {
    .service-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 16px;
    }
}

.service-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.service-card .relative {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.service-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.service-card .p-3 {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
}

/* Featured Services Carousel Styling */
.featured-services-swiper {
    padding: 20px 0 60px 0;
    margin: 0 -20px;
}

.featured-services-swiper .swiper-slide {
    height: auto;
    min-height: 220px;
}

/* Mobile: 1.5 cards visible */
.featured-services-swiper .swiper-slide {
    width: 66.666% !important;
    margin-right: 16px;
}

/* Desktop: 4.5 cards visible */
@media (min-width: 1024px) {
    .featured-services-swiper .swiper-slide {
        width: 22% !important;
        margin-right: 20px;
    }
}

.featured-services-swiper .swiper-button-next,
.featured-services-swiper .swiper-button-prev {
    color: #AC4335;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.featured-services-swiper .swiper-button-next:hover,
.featured-services-swiper .swiper-button-prev:hover {
    background: #AC4335;
    color: white;
    box-shadow: 0 6px 20px rgba(172, 67, 53, 0.3);
}

.featured-services-swiper .swiper-button-next {
    right: -10px;
}

.featured-services-swiper .swiper-button-prev {
    left: -10px;
}

.featured-services-swiper .swiper-pagination {
    bottom: 20px !important;
}

.featured-services-swiper .swiper-pagination-bullet {
    width: 8px;
    height: 8px;
    background: #cbd5e1;
    opacity: 1;
    transition: all 0.3s ease;
}

.featured-services-swiper .swiper-pagination-bullet-active {
    background: #AC4335;
    width: 24px;
    border-radius: 4px;
}

/* Hide navigation on mobile */
@media (max-width: 1023px) {
    .featured-services-swiper .swiper-button-next,
    .featured-services-swiper .swiper-button-prev {
        display: none;
    }
}

/* Unit Layanan Swiper Styles */
.unit-layanan-swiper {
    border-radius: 16px;
    overflow: hidden;
}

.unit-layanan-swiper .swiper-slide {
    height: auto;
}

.unit-layanan-swiper .swiper-pagination {
    bottom: 24px !important;
    z-index: 10;
}

.unit-layanan-swiper .swiper-pagination-bullet {
    width: 12px;
    height: 12px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 1;
    transition: all 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.3);
    margin: 0 6px;
}

.unit-layanan-swiper .swiper-pagination-bullet-active {
    background: white;
    width: 32px;
    border-radius: 6px;
    border-color: white;
}

/* Unit Layanan Cards Enhancement */
.unit-layanan-swiper ~ div .bg-white {
    border: 1px solid rgba(229, 231, 235, 0.5);
    backdrop-filter: blur(10px);
}

.unit-layanan-swiper ~ div .bg-white:hover {
    border-color: #AC4335;
    box-shadow: 0 20px 25px -5px rgba(172, 67, 53, 0.1), 0 10px 10px -5px rgba(172, 67, 53, 0.04);
} 
 
/* Mobile Typography - Optimized Font Sizes */
@media (max-width: 767px) {
    /* Paragraphs - 12px on mobile */
    p {
        font-size: 12px !important;
        line-height: 1.6;
    }
    
    /* Headings - Mobile optimized sizes */
    h1 {
        font-size: 24px !important;
        line-height: 1.3;
    }
    
    h2 {
        font-size: 20px !important;
        line-height: 1.3;
    }
    
    h3 {
        font-size: 16px !important;
        line-height: 1.4;
    }
    
    h4 {
        font-size: 14px !important;
        line-height: 1.4;
    }
    
    h5, h6 {
        font-size: 13px !important;
        line-height: 1.4;
    }
    
    /* Article & Card Text on Mobile */
    .article-title {
        font-size: 14px !important;
    }
    
    .article-excerpt {
        font-size: 12px !important;
    }
    
    .article-meta {
        font-size: 11px !important;
    }
    
    /* Service Card Text */
    .service-card h3,
    .service-card .text-lg {
        font-size: 14px !important;
    }
    
    .service-card p,
    .service-card .text-sm {
        font-size: 12px !important;
    }
    
    /* Button Text */
    button,
    .btn,
    a.btn {
        font-size: 13px !important;
    }
    
    /* Tailwind Text Utilities */
    .text-xs {
        font-size: 10px !important;
    }
    
    .text-sm {
        font-size: 12px !important;
    }
    
    .text-base {
        font-size: 12px !important;
    }
    
    .text-lg {
        font-size: 14px !important;
    }
    
    .text-xl {
        font-size: 16px !important;
    }
    
    .text-2xl {
        font-size: 18px !important;
    }
    
    .text-3xl {
        font-size: 20px !important;
    }
    
    .text-4xl {
        font-size: 24px !important;
    }
}
