/* ==========================================================================
   Right Health Care Global Ventures Limited
   Master Stylesheet — fully responsive, all devices, all browsers
   Supplements Tailwind CDN utility classes
   ========================================================================== */

/* --- CSS Custom Properties ---------------------------------------------- */
:root {
    --primary:      #0d9488;
    --primary-dark:  #0f766e;
    --primary-light: #14b8a6;
    --accent:       #16a34a;
    --gradient:     linear-gradient(135deg, #0d9488 0%, #06b6d4 100%);
    --shadow-sm:    0 1px 3px rgba(0,0,0,.06);
    --shadow-md:    0 4px 12px rgba(0,0,0,.08);
    --shadow-lg:    0 10px 30px rgba(0,0,0,.1);
    --shadow-xl:    0 20px 50px rgba(0,0,0,.12);
    --radius:       12px;
    --header-h:     64px;       /* mobile header */
    --header-h-lg:  80px;       /* desktop header */
    --nav-h:        48px;       /* desktop category nav */
    --sidebar-w:    256px;      /* admin sidebar */
    --z-dropdown:   100;
    --z-sticky:     200;
    --z-overlay:    500;
    --z-modal:      600;
    --z-toast:      700;
    --z-preloader:  9999;
}

/* --- Reset & Base ------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}
body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;          /* dynamic viewport for mobile browsers */
    overflow-x: hidden;          /* prevent horizontal scroll */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
img, video { max-width: 100%; height: auto; display: block; }
button { cursor: pointer; }

/* --- Preloader --------------------------------------------------------- */
.preloader {
    position: fixed;
    inset: 0;
    z-index: var(--z-preloader);
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    transition: opacity .5s ease, visibility .5s ease;
}
.preloader.loaded { opacity: 0; visibility: hidden; pointer-events: none; }
.preloader-spinner {
    width: 48px; height: 48px;
    border: 4px solid #e5e7eb;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Sticky Header ----------------------------------------------------- */
.header-sticky {
    transition: box-shadow .3s ease, background-color .3s ease;
    will-change: box-shadow;
}
.header-sticky.scrolled {
    box-shadow: 0 4px 20px rgba(0,0,0,.08);
    background-color: rgba(255,255,255,.98) !important;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

/* --- Hero Gradient Text ------------------------------------------------ */
.gradient-text {
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    color: transparent; /* Firefox fallback */
}

/* --- Pulse Badge ------------------------------------------------------- */
.pulse-badge { animation: pulse-ring 2s cubic-bezier(.4,0,.6,1) infinite; }
@keyframes pulse-ring { 0%,100%{opacity:1} 50%{opacity:.7} }

/* ==========================================================================
   FLASH MESSAGES — Fixed‑position floating alerts (visible on ALL screens)
   ========================================================================== */
.flash-container {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--z-toast);
    width: calc(100% - 32px);
    max-width: 520px;
    pointer-events: none;        /* let clicks pass through when empty */
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.flash-container > * { pointer-events: auto; }

.flash-alert {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    animation: flashIn .4s ease-out;
    transition: opacity .3s ease, transform .3s ease;
    font-size: 14px;
    line-height: 1.45;
}
.flash-alert .flash-body { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.flash-alert .flash-body svg { flex-shrink: 0; width: 22px; height: 22px; }
.flash-alert .flash-title { font-weight: 600; font-size: 13px; margin: 0 0 1px; }
.flash-alert .flash-text  { font-size: 13px; margin: 0; opacity: .9; word-break: break-word; }
.flash-alert .flash-close {
    background: none; border: none; cursor: pointer; padding: 4px; border-radius: 6px;
    opacity: .6; transition: opacity .2s; flex-shrink: 0;
}
.flash-alert .flash-close:hover { opacity: 1; }
.flash-alert .flash-close svg { width: 18px; height: 18px; }

@keyframes flashIn  { from { opacity:0; transform:translateY(-16px) } to { opacity:1; transform:translateY(0) } }
@keyframes flashOut { from { opacity:1; transform:translateY(0) }   to { opacity:0; transform:translateY(-16px) } }

/* ==========================================================================
   TOAST NOTIFICATION — Global toasts (success/error from AJAX)
   ========================================================================== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 360px;
    width: calc(100% - 40px);
    pointer-events: none;
}
.toast-container > * { pointer-events: auto; }

.toast {
    padding: 14px 18px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    transform: translateX(120%);
    opacity: 0;
    transition: transform .4s cubic-bezier(.34,1.56,.64,1), opacity .3s ease;
}
.toast.show { transform: translateX(0); opacity: 1; }
.toast svg, .toast i { flex-shrink: 0; }

/* Mobile toast adjustments */
@media (max-width: 639px) {
    .toast-container {
        left: 16px; right: 16px;
        max-width: none; width: auto;
    }
    .toast {
        transform: translateY(-120%);
        transition: transform .4s cubic-bezier(.34,1.56,.64,1), opacity .3s ease;
    }
    .toast.show { transform: translateY(0); }
}

/* ==========================================================================
   PRODUCT CARD — Touch-friendly on mobile, hover on desktop
   ========================================================================== */
.product-card {
    transition: transform .3s ease, box-shadow .3s ease;
    will-change: transform;
}
.product-card .card-image img {
    transition: transform .5s ease;
}

/* --- Desktop hover effects --- */
@media (hover: hover) and (pointer: fine) {
    .product-card:hover {
        transform: translateY(-6px);
        box-shadow: var(--shadow-xl);
    }
    .product-card:hover .card-image img {
        transform: scale(1.08);
    }
    .product-card .card-actions {
        opacity: 0;
        transform: translateY(8px);
        transition: all .3s ease;
    }
    .product-card:hover .card-actions {
        opacity: 1;
        transform: translateY(0);
    }
    .product-card .card-actions-right {
        opacity: 0;
        transform: translateX(8px);
        transition: all .3s ease;
    }
    .product-card:hover .card-actions-right {
        opacity: 1;
        transform: translateX(0);
    }
    .product-card .card-overlay-btn {
        transform: translateY(100%);
        transition: transform .3s ease;
    }
    .product-card:hover .card-overlay-btn {
        transform: translateY(0);
    }
}

/* --- Mobile: show actions always (no hover) --- */
@media (hover: none), (pointer: coarse) {
    .product-card .card-actions,
    .product-card .card-actions-right {
        opacity: 1 !important;
        transform: none !important;
    }
    .product-card .card-overlay-btn {
        transform: translateY(0) !important;
    }
}

/* ==========================================================================
   MOBILE MENU — Slide‑in overlay
   ========================================================================== */
.mobile-menu-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 85%;
    max-width: 360px;
    z-index: var(--z-overlay);
    background: #fff;
    transform: translateX(100%);
    transition: transform .35s cubic-bezier(.4,0,.2,1);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: -10px 0 40px rgba(0,0,0,.15);
}
.mobile-menu-panel.open { transform: translateX(0); }

.mobile-menu-overlay {
    position: fixed;
    inset: 0;
    z-index: calc(var(--z-overlay) - 1);
    background: rgba(0,0,0,.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s ease, visibility .3s ease;
}
.mobile-menu-overlay.open { opacity: 1; visibility: visible; }

/* body lock when menu is open */
body.menu-open { overflow: hidden; }

/* ==========================================================================
   MOBILE SEARCH — Slide-down from header
   ========================================================================== */
.mobile-search-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height .3s ease, padding .3s ease;
}
.mobile-search-panel.open {
    max-height: 120px;
    padding-top: 12px;
    padding-bottom: 12px;
}

/* ==========================================================================
   USER DROPDOWN
   ========================================================================== */
.user-dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 8px;
    width: 240px;
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-xl);
    border: 1px solid #f3f4f6;
    z-index: var(--z-dropdown);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px) scale(.95);
    transition: all .2s ease;
}
.user-dropdown.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* ==========================================================================
   ADMIN SIDEBAR — responsive with mobile toggle
   ========================================================================== */
.admin-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-w);
    z-index: var(--z-overlay);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transition: transform .3s ease;
}
.admin-sidebar a.active { background: rgba(255,255,255,.12); }

/* Mobile: sidebar hidden by default */
@media (max-width: 1023px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }
    .admin-sidebar.open {
        transform: translateX(0);
    }
    .admin-content { margin-left: 0 !important; }
}
/* Desktop: sidebar always visible, content offset */
@media (min-width: 1024px) {
    .admin-sidebar {
        transform: translateX(0);
    }
    .admin-content {
        margin-left: var(--sidebar-w);
    }
}

.admin-sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: calc(var(--z-overlay) - 1);
    background: rgba(0,0,0,.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s ease, visibility .3s ease;
}
.admin-sidebar-overlay.open { opacity: 1; visibility: visible; }

/* ==========================================================================
   QUICK VIEW MODAL
   ========================================================================== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s ease, visibility .3s ease;
}
.modal-backdrop.active { opacity: 1; visibility: visible; }

.modal-content {
    background: #fff;
    border-radius: 16px;
    max-width: 720px;
    width: 100%;
    max-height: 90vh;
    max-height: 90dvh;
    overflow-y: auto;
    transform: scale(.9) translateY(20px);
    transition: transform .3s ease;
}
.modal-backdrop.active .modal-content {
    transform: scale(1) translateY(0);
}

/* ==========================================================================
   FAQ ACCORDION
   ========================================================================== */
.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height .35s ease, padding .35s ease;
}
.faq-answer.open { max-height: 600px; }

/* ==========================================================================
   COUNTER & STAT ANIMATIONS
   ========================================================================== */
.stat-counter { font-variant-numeric: tabular-nums; }

/* ==========================================================================
   STAR RATING
   ========================================================================== */
.star-rating i, .star-rating svg { color: #fbbf24; }
.star-rating .empty { color: #d1d5db; }

/* ==========================================================================
   CHECKOUT PROGRESS & ORDER STATUS
   ========================================================================== */
.step-item.active .step-circle { background: var(--gradient); color: #fff; }
.step-item.completed .step-circle { background: var(--accent); color: #fff; }
.order-progress-bar { height: 4px; background: #e5e7eb; border-radius: 4px; overflow: hidden; }
.order-progress-bar .bar { height: 100%; background: var(--gradient); border-radius: 4px; transition: width .6s ease; }

/* ==========================================================================
   IMAGE GALLERY THUMBNAIL
   ========================================================================== */
.thumb-active {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-color: var(--primary) !important;
}

/* ==========================================================================
   FORM FOCUS
   ========================================================================== */
input:focus, textarea:focus, select:focus { outline: none; }

/* ==========================================================================
   SKELETON LOADER
   ========================================================================== */
.skeleton {
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* ==========================================================================
   BADGE SHIMMER
   ========================================================================== */
.badge-shine { position: relative; overflow: hidden; }
.badge-shine::after {
    content: '';
    position: absolute;
    top: 0; left: -100%; width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.3), transparent);
    animation: badge-shine 3s ease-in-out infinite;
}
@keyframes badge-shine { 0%{left:-100%} 50%,100%{left:100%} }

/* ==========================================================================
   WHATSAPP FLOAT & SCROLL‑TOP
   ========================================================================== */
.whatsapp-float {
    position: fixed;
    bottom: 24px; right: 24px;
    z-index: 40;
    animation: floatBounce 2s ease-in-out infinite;
}
.scroll-top-btn {
    position: fixed;
    bottom: 24px; left: 24px;
    z-index: 40;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all .3s ease;
}
.scroll-top-btn.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
@keyframes floatBounce { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-6px)} }

@media (max-width: 639px) {
    .whatsapp-float { bottom: 16px; right: 16px; }
    .scroll-top-btn { bottom: 16px; left: 16px; }
}

/* ==========================================================================
   CUSTOM SCROLLBAR
   ========================================================================== */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #f9fafb; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ==========================================================================
   UTILITY HELPERS
   ========================================================================== */
.line-clamp-1 { display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;overflow:hidden; }
.line-clamp-2 { display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden; }
.line-clamp-3 { display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden; }

/* Hide scrollbar but keep scrolling */
.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}
.scrollbar-hide::-webkit-scrollbar { display: none; }

/* ==========================================================================
   PRODUCT FILTER SIDEBAR — Mobile toggle
   ========================================================================== */
#filter-toggle-icon {
    transition: transform .3s ease;
}
#filter-toggle-icon.rotate {
    transform: rotate(180deg);
}

/* ==========================================================================
   COMPARE TABLE — scroll hint shadow
   ========================================================================== */
.compare-table-wrapper {
    position: relative;
}
@media (max-width: 639px) {
    .compare-table-wrapper::after {
        content: '';
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        width: 30px;
        background: linear-gradient(to left, rgba(255,255,255,.9), transparent);
        pointer-events: none;
        z-index: 1;
    }
}

/* ==========================================================================
   DASHBOARD MOBILE NAV — horizontal scrolling nav
   ========================================================================== */
@media (max-width: 1023px) {
    .dashboard-mobile-nav {
        scroll-snap-type: x mandatory;
    }
    .dashboard-mobile-nav a {
        scroll-snap-align: start;
    }
}

/* safe-area padding for iOS notch */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .safe-bottom { padding-bottom: env(safe-area-inset-bottom); }
}

/* ==========================================================================
   ADMIN TOAST CONTAINER
   ========================================================================== */
#admin-toast-container {
    position: fixed; top: 20px; right: 20px;
    z-index: var(--z-toast);
    display: flex; flex-direction: column; gap: 10px;
    max-width: 400px; width: calc(100% - 40px);
    pointer-events: none;
}
#admin-toast-container > * { pointer-events: auto; }
@keyframes adminToastIn  { from{opacity:0;transform:translateX(20px)} to{opacity:1;transform:translateX(0)} }
@keyframes adminToastOut { from{opacity:1;transform:translateX(0)}   to{opacity:0;transform:translateX(20px)} }

/* ==========================================================================
   RESPONSIVE TABLE WRAPPERS (admin pages)
   ========================================================================== */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.table-wrapper table { min-width: 640px; }

/* ==========================================================================
   PRINT
   ========================================================================== */
@media print {
    .preloader, nav, footer, .whatsapp-float, .scroll-top-btn,
    .toast-container, .flash-container, .mobile-menu-panel,
    .mobile-menu-overlay, .admin-sidebar, #admin-toast-container { display: none !important; }
    body { overflow: visible !important; }
}
