@reference "tailwindcss";
@tailwind base;
@tailwind components;
@tailwind utilities;

@layer components {
    .nav-btn {
        @apply px-5 py-2 rounded-full text-sm font-semibold
           text-slate-700 hover:text-[#1e40af]
           hover:bg-blue-50 transition whitespace-nowrap;
    }

    .dropdown-item {
        @apply w-full flex items-center gap-3
           px-6 py-3 text-sm text-slate-700
           hover:bg-blue-50 transition;
    }

    .dropdown-link {
        @apply flex items-center gap-3
           px-6 py-3 text-sm text-slate-700
           hover:bg-blue-50 transition;
    }

    .mobile-btn {
        @apply w-full text-left px-4 py-3 rounded-lg
           text-sm font-semibold text-slate-700
           hover:bg-blue-50 transition;
    }

    .dropdown-item {
        @apply block px-4 py-2 rounded-xl font-medium text-gray-700
               hover:bg-blue-50 hover:text-blue-700 transition;
    }

    .mobile-link {
        @apply block px-4 py-3 rounded-xl font-semibold text-blue-900 hover:bg-blue-50 transition;
    }

    .mobile-accordion {
        @apply w-full px-4 py-3 rounded-xl font-semibold text-blue-900
               flex items-center justify-between hover:bg-blue-50 transition;
    }

    .mobile-submenu {
        @apply hidden pl-4;
    }

    .mobile-sub {
        @apply block py-2 text-gray-700;
    }
}

.newsSwiper,
.newsSwiper .swiper-wrapper,
.newsSwiper .swiper-slide {
    height: 100% !important;
}

/* Swiper */
.contactSwiper {
    padding-bottom: 60px;
}

/* Slide luôn stretch */
.contactSwiper .swiper-slide {
    display: flex;
    height: auto;
}

/* Card */
.contact-card {
    background: #ffffff;
    border-radius: 24px;
    padding: 32px;
    width: 100%;
    box-shadow: 0 10px 25px rgba(192, 57, 43, 0.08);
    transition: all 0.35s ease;
    border: 1px solid rgba(249, 115, 22, 0.1);
}

/* Hover desktop */
@media (hover: hover) {
    .contact-card:hover {
        transform: translateY(-10px);
        box-shadow: 0 25px 50px rgba(192, 57, 43, 0.18);
        border-color: rgba(231, 76, 60, 0.2);
    }
}

/* Icon */
.contact-icon {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(192, 57, 43, 0.12), rgba(249, 115, 22, 0.18));
    color: #c0392b;
    font-size: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    transition: all 0.3s ease;
}

.contact-card:hover .contact-icon {
    background: linear-gradient(135deg, #c0392b, #f97316);
    color: #fff;
    transform: scale(1.15);
}

/* Text */
.contact-title {
    font-size: 20px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 6px;
}

.contact-value {
    font-weight: 700;
    color: #d9480f;
    word-break: break-word;
}

.contact-desc {
    font-size: 14px;
    color: #6b7280;
    margin-top: auto; /* ĐẨY DESC XUỐNG → BẰNG CHIỀU CAO */
}

/* Pagination */
.contactSwiper .swiper-pagination-bullet {
    background: #fdba74;
    opacity: 1;
}

.contactSwiper .swiper-pagination-bullet-active {
    background: #c0392b;
}

/* Swiper */
.bookingStepSwiper {
    padding-bottom: 60px;
}

.bookingStepSwiper .swiper-slide {
    display: flex;
}

/* Card */
.step-card {
    width: 100%;
    background: #f9fafb;
    border-radius: 24px;
    padding: 40px 24px;
    transition: all 0.35s ease;
    border: 1px solid #e5e7eb;
}

/* Hover desktop */
@media (hover: hover) {
    .step-card:hover {
        transform: translateY(-8px);
        background: #ffffff;
        box-shadow: 0 20px 40px rgba(192, 57, 43, 0.15);
    }
}

/* Number */
.step-number {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #c0392b, #f97316);
    color: #fff;
    font-weight: 800;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

/* Icon */
.step-icon {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(192, 57, 43, 0.12), rgba(249, 115, 22, 0.18));
    color: #c0392b;
    font-size: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.step-card:hover .step-icon {
    background: linear-gradient(135deg, #c0392b, #f97316);
    color: #ffffff;
    transform: scale(1.1);
}

/* Text */
.step-text {
    font-weight: 600;
    color: #374151;
    font-size: 16px;
    line-height: 1.5;
}

/* Pagination */
.bookingStepSwiper .swiper-pagination-bullet {
    background: #fdba74;
    opacity: 1;
}

.bookingStepSwiper .swiper-pagination-bullet-active {
    background: #c0392b;
}

/* Khi active */
.faq-item.active {
    box-shadow: 0 20px 40px rgba(192, 57, 43, 0.12);
    border-left: 4px solid #c0392b;
}

/* Icon khi mở */
.faq-item.active .faq-icon {
    transform: rotate(45deg);
    color: #dc2626;
}

/* Nội dung mở */
.faq-item.active .faq-answer {
    max-height: 300px;
}

/* =====================================================
   BASE CONTACT BUTTON
===================================================== */
.contact-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;

    width: 56px;
    height: 56px;
    border-radius: 9999px;

    text-decoration: none;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);

    transition:
        transform 0.25s ease,
        box-shadow 0.25s ease;
    overflow: visible;
}

.contact-btn:hover {
    transform: scale(1.1);
}

/* =====================================================
   ICON / TEXT ANIMATION
===================================================== */
.contact-btn i,
.contact-btn span {
    transition: transform 0.25s ease;
}

.contact-btn:hover i,
.contact-btn:hover span {
    transform: scale(1.15) rotate(-4deg);
}

/* =====================================================
   MESSENGER
===================================================== */
.messenger {
    background: #0084ff;
    animation: pulse-blue 2.6s infinite;
}

.messenger i {
    font-size: 26px;
    color: #fff;
}

/* =====================================================
   ZALO — sóng tóe kép + đập nhẹ glow
===================================================== */
.zalo {
    isolation: isolate;
    background: #0068ff;
    animation: zalo-glow-breathe 2.4s ease-in-out infinite;
}

/* Tắt ripple ::after cho Zalo (dùng .ripple / .spark) */
.zalo::after {
    display: none;
}

/* Hai vòng sóng lan ra ngoài liên tục */
.zalo .ripple,
.zalo .spark {
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    border: 2px solid rgba(255, 255, 255, 0.55);
    box-shadow: 0 0 10px rgba(147, 197, 253, 0.45);
    animation: contact-spark-wave 2.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite;
    will-change: transform, opacity;
}

.zalo .spark {
    border-color: rgba(186, 230, 253, 0.75);
    animation-delay: 1.2s;
    box-shadow: 0 0 14px rgba(255, 255, 255, 0.35);
}

.zalo .zalo-text {
    position: relative;
    z-index: 2;
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: #fff;
    transform-origin: center center;
    animation: zalo-text-wiggle 0.42s ease-in-out infinite;
    will-change: transform;
}

/* =====================================================
   HOTLINE — sóng viên thuốc + glow đỏ
===================================================== */
.hotline {
    position: relative;
    isolation: isolate;
    width: auto;
    height: auto;
    padding: 8px 20px;
    gap: 12px;

    background: linear-gradient(135deg, #b91c1c, #7f1d1d);
    border-radius: 9999px;
    animation: hotline-glow-breathe 2.6s ease-in-out infinite;
}

/* Hotline dùng vòng .hotline-ring riêng, không dùng ::after ripple */
.hotline::after {
    display: none;
}

.hotline .hotline-ring {
    position: absolute;
    inset: -5px;
    border-radius: 9999px;
    pointer-events: none;
    z-index: 0;
    border: 2px solid rgba(252, 165, 165, 0.65);
    animation: hotline-spark-wave 2.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite;
    will-change: transform, opacity;
}

.hotline .hotline-ring--delay {
    border-color: rgba(248, 113, 113, 0.45);
    animation-delay: 1.3s;
}

.hotline .hotline-icon {
    position: relative;
    z-index: 2;
}

.hotline i {
    font-size: 16px;
    color: #fff;

    background: rgba(255, 255, 255, 0.15);
    padding: 10px;
    border-radius: 9999px;

    display: inline-block;
    transform-origin: center center;
    animation: hotline-icon-wiggle 0.48s ease-in-out infinite;
    will-change: transform;
}

.hotline-text {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    line-height: 1;
}

.hotline-text strong {
    font-size: 18px;
    color: #fff;
    letter-spacing: 0.15em;
}

/* =====================================================
   RIPPLE EFFECT (SÓNG LAN) — messenger & nút tròn khác
===================================================== */
.contact-btn::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 9999px;
    background: currentColor;
    opacity: 0.35;
    z-index: -1;

    animation: ripple 2.8s infinite;
}

.messenger::after {
    background: rgba(0, 132, 255, 0.6);
}

/* =====================================================
   SPARK (TÓE NHẸ KHI HOVER)
===================================================== */
.contact-btn::before {
    content: "";
    position: absolute;
    width: 6px;
    height: 6px;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 50%;

    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
}

.contact-btn:hover::before {
    animation: spark 0.6s ease-out;
}

/* =====================================================
   KEYFRAMES
===================================================== */
@keyframes pulse-blue {
    0% {
        box-shadow: 0 0 0 rgba(0, 132, 255, 0);
    }
    50% {
        box-shadow: 0 0 22px rgba(0, 132, 255, 0.55);
    }
    100% {
        box-shadow: 0 0 0 rgba(0, 132, 255, 0);
    }
}

@keyframes pulse-zalo {
    0% {
        box-shadow: 0 0 0 rgba(0, 104, 255, 0);
    }
    50% {
        box-shadow: 0 0 22px rgba(0, 104, 255, 0.55);
    }
    100% {
        box-shadow: 0 0 0 rgba(0, 104, 255, 0);
    }
}

/* Sóng tóe liên tục — Zalo (tròn) */
@keyframes contact-spark-wave {
    0% {
        transform: scale(0.88);
        opacity: 0.95;
    }
    70% {
        opacity: 0.25;
    }
    100% {
        transform: scale(1.65);
        opacity: 0;
    }
}

@keyframes zalo-glow-breathe {
    0%,
    100% {
        box-shadow:
            0 8px 24px rgba(0, 0, 0, 0.22),
            0 0 0 0 rgba(0, 104, 255, 0.5);
    }
    50% {
        box-shadow:
            0 10px 30px rgba(0, 0, 0, 0.28),
            0 0 0 12px rgba(0, 104, 255, 0);
    }
}

/* Sóng tóe — Hotline (viên thuốc) */
@keyframes hotline-spark-wave {
    0% {
        transform: scale(0.94);
        opacity: 0.9;
    }
    75% {
        opacity: 0.2;
    }
    100% {
        transform: scale(1.12);
        opacity: 0;
    }
}

@keyframes hotline-glow-breathe {
    0%,
    100% {
        box-shadow:
            0 8px 24px rgba(0, 0, 0, 0.25),
            0 0 0 0 rgba(248, 113, 113, 0.45);
    }
    50% {
        box-shadow:
            0 10px 32px rgba(0, 0, 0, 0.3),
            0 0 0 14px rgba(248, 113, 113, 0);
    }
}

@keyframes ripple {
    0% {
        transform: scale(1);
        opacity: 0.4;
    }
    70% {
        transform: scale(1.7);
        opacity: 0;
    }
    100% {
        opacity: 0;
    }
}

@keyframes spark {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 1;
    }
    50% {
        transform: translate(-50%, -80%) scale(1.2);
        opacity: 0.8;
    }
    100% {
        transform: translate(-50%, -120%) scale(0);
        opacity: 0;
    }
}

/* Rung lắc liên tục — chữ Zalo */
@keyframes zalo-text-wiggle {
    0%,
    100% {
        transform: rotate(0deg) translateX(0);
    }
    25% {
        transform: rotate(-4deg) translateX(-0.5px);
    }
    50% {
        transform: rotate(3deg) translateX(0.5px);
    }
    75% {
        transform: rotate(-3deg) translateX(0);
    }
}

/* Rung lắc liên tục — icon gọi */
@keyframes hotline-icon-wiggle {
    0%,
    100% {
        transform: rotate(0deg);
    }
    20% {
        transform: rotate(-10deg);
    }
    40% {
        transform: rotate(10deg);
    }
    60% {
        transform: rotate(-8deg);
    }
    80% {
        transform: rotate(8deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .zalo .zalo-text,
    .hotline i {
        animation: none;
    }
}

@media (max-width: 640px) {
    /* Vị trí tổng */
    .contact-floating {
        bottom: 1rem;
        left: 1rem;
        gap: 12px;
    }

    /* Nút tròn */
    .contact-btn {
        width: 48px;
        height: 48px;
    }

    /* Hotline xuống cuối + gọn */
    .hotline {
        order: 3;
        padding: 0;
        width: 48px;
        height: 48px;
        justify-content: center;
        gap: 0;
    }

    .hotline-text {
        display: none;
    }

    .hotline-icon {
        width: 100%;
        height: 100%;
        border-radius: 9999px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Zalo text nhỏ lại */
    .zalo-text {
        font-size: 10px;
        letter-spacing: 0.04em;
    }
}
