/* 
 * Unified Store Component Styles 
 * Includes: Chat Widgets, Stock Counters, and Theme Overrides
 * -----------------------------------------
 */

/* 1. Global Utilities & Animations */
[x-cloak] {
    display: none !important;
}

.bg-brand-orange {
    background-color: var(--c-primary, #ff6b00);
}

.text-c-primary {
    color: var(--c-primary, #ff6b00);
}

@keyframes pulse-green {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }

    70% {
        transform: scale(1.6);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 0;
    }
}

@keyframes pulse-blue {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }

    70% {
        transform: scale(1.6);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 0;
    }
}

/* 2. Stock Counter Component */
.stock-counter-container {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
    transition: all 0.3s ease;
}

.stock-counter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.8em;
}

.stock-counter-track {
    height: 6px;
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 9999px;
    overflow: hidden;
    width: 100%;
    position: relative;
    padding: 1px;
}

.dark .stock-counter-track {
    background-color: rgba(255, 255, 255, 0.1);
}

.stock-counter-bar {
    height: 100%;
    border-radius: 9999px;
    transition: width 1s ease-out, background-color 0.5s ease;
}


/* 3. Chat Widgets Component */
.chat-widgets-container {
    position: fixed;
    inset-inline-end: 1.5rem;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    bottom: clamp(5rem, 12vh, 8rem);
}

@media (min-width: 1024px) {
    .chat-widgets-container {
        bottom: 2rem;
    }
}

.chat-widget {
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none !important;
    position: relative;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.chat-widget:hover {
    transform: scale(1.1);
}

.chat-widget:active {
    transform: scale(0.95);
}

.chat-widget svg {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.whatsapp-pulse::before,
.messenger-pulse::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    z-index: -1;
    opacity: 0.8;
}

.whatsapp-pulse::before {
    background: #25D366;
    animation: pulse-green 2s infinite;
}

.messenger-pulse::before {
    background: #00B2FF;
    animation: pulse-blue 2s infinite;
}

/* 4. Wishlist Button Component */
.wishlist-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.05);
    color: #666;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.wishlist-btn:hover {
    transform: scale(1.1);
    background: #fef2f2;
    color: #ef4444;
}

.wishlist-btn:active {
    transform: scale(0.9);
}

.wishlist-btn.active {
    background: #fee2e2;
    color: #ef4444;
    border-color: #fca5a5;
    animation: heart-beat 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes heart-beat {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
    }

    100% {
        transform: scale(1);
    }
}


/* 5. Language Switcher Component */
.store-lang-switcher {
    position: relative;
    display: inline-flex;
}

.lang-current-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.lang-current-btn:hover {
    border-color: var(--c-primary);
    background: #fafafa;
}

.lang-flag {
    font-size: 11px;
    font-weight: 800;
    color: #111;
    letter-spacing: 0.05em;
}

.lang-arrow {
    color: #999;
    transition: transform 0.3s ease;
}

.lang-current-btn.active .lang-arrow {
    transform: rotate(180deg);
}

.lang-dropdown {
    position: absolute;
    bottom: 100%;
    inset-inline-start: 0;
    margin-bottom: 8px;
    min-width: 160px;
    z-index: 1000;
}

/* RTL specific positioning */
[dir="rtl"] .lang-dropdown {
    inset-inline-start: auto;
    inset-inline-end: 0;
}

/* LTR specific positioning */
[dir="ltr"] .lang-dropdown {
    inset-inline-start: 0;
    inset-inline-end: auto;
}

/* Header placement override */
.sidebar-header .lang-dropdown,
header .lang-dropdown {
    bottom: auto !important;
    top: 100% !important;
    margin-bottom: 0 !important;
    margin-top: 12px !important;
}

.is-desktop .lang-dropdown {
    inset-inline-start: auto;
    inset-inline-end: 0;
}

/* Desktop RTL alignment */
[dir="rtl"].is-desktop .lang-dropdown {
    inset-inline-start: auto;
    inset-inline-end: 0;
}

/* Desktop LTR alignment */
[dir="ltr"].is-desktop .lang-dropdown {
    inset-inline-start: 0;
    inset-inline-end: auto;
}

.lang-dropdown-inner {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 18px;
    padding: 8px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
    overflow: hidden;
}

.lang-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-radius: 12px;
    text-decoration: none !important;
    color: #444;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.lang-item:hover {
    background: rgba(0, 0, 0, 0.04);
    color: var(--c-primary);
}

.lang-item.is-active {
    background: rgba(var(--c-primary-rgb, 255, 107, 0), 0.1);
    color: var(--c-primary);
}

.lang-check {
    color: var(--c-primary);
    opacity: 0.8;
}


/* Mobile specific tweaks */
.is-mobile {
    width: 100%;
}

.is-mobile .lang-current-btn {
    width: 100%;
    justify-content: space-between !important;
    padding: 12px 20px !important;
    border-radius: 16px;
}

.is-mobile .lang-dropdown {
    width: 100%;
}