/*
 * Theme Name:  Astra Child
 * Theme URI:   https://uneyo.com
 * Description: Astra Child Theme for Uneyo Water Experts
 * Author:      Uneyo
 * Author URI:  https://uneyo.com
 * Template:    astra
 * Version:     1.0.0
 * License:     GNU General Public License v2 or later
 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
 * Text Domain: astra-child
*/

/* =============================================================================
   TABLE OF CONTENTS
   1. Top Contact Bar
   2. Floating WhatsApp Button
   3. Water Softener Best Seller Badge
   4. Responsive Overrides (top bar + floating button)
   5. Auto-Scrolling Gallery
   ============================================================================= */


/* =============================================================================
   1. TOP CONTACT BAR
   ============================================================================= */

#uneyo-top-bar {
    background-color: #003E8A;
    color: #ffffff;
    font-size: 13px;
    font-family: inherit;
    padding: 7px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    line-height: 1.4;
    z-index: 9998;
    position: relative;
}

/* Left side: contact info items */
.uneyo-top-bar__left {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.uneyo-top-bar__item {
    display: flex;
    align-items: center;
    gap: 5px;
    color: #ffffff;
    text-decoration: none;
    white-space: nowrap;
    transition: color 0.2s ease;
}

.uneyo-top-bar__item:hover {
    color: #25D366;
    text-decoration: none;
}

.uneyo-top-bar__item svg {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    fill: currentColor;
}

/* Divider between contact items */
.uneyo-top-bar__divider {
    color: rgba(255, 255, 255, 0.35);
    font-size: 11px;
}

/* Right side: WhatsApp CTA button */
.uneyo-top-bar__right {
    display: flex;
    align-items: center;
}

.uneyo-top-bar__wa-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: #25D366;
    color: #ffffff !important;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none !important;
    padding: 5px 14px;
    border-radius: 20px;
    line-height: 1.4;
    transition: background-color 0.2s ease, transform 0.15s ease;
    white-space: nowrap;
}

.uneyo-top-bar__wa-btn:hover {
    background-color: #1ebe5d;
    transform: translateY(-1px);
    color: #ffffff !important;
}

.uneyo-top-bar__wa-btn svg {
    width: 14px;
    height: 14px;
    fill: #ffffff;
    flex-shrink: 0;
}


/* =============================================================================
   2. FLOATING WHATSAPP BUTTON
   ============================================================================= */

#uneyo-wa-float {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background-color: #25D366;
    border-radius: 50%;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    text-decoration: none !important;
    transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

#uneyo-wa-float:hover {
    background-color: #1ebe5d;
    transform: scale(1.08);
    box-shadow: 0 6px 24px rgba(37, 211, 102, 0.45);
}

#uneyo-wa-float svg {
    width: 30px;
    height: 30px;
    fill: #ffffff;
}

/* Pulse ring animation to draw attention */
#uneyo-wa-float::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background-color: #25D366;
    animation: uneyo-wa-pulse 2.2s ease-out infinite;
    z-index: -1;
}

@keyframes uneyo-wa-pulse {
    0%   { transform: scale(1);   opacity: 0.7; }
    70%  { transform: scale(1.55); opacity: 0; }
    100% { transform: scale(1.55); opacity: 0; }
}

/* Tooltip label on hover */
#uneyo-wa-float .uneyo-wa-float__label {
    position: absolute;
    right: calc(100% + 12px);
    background-color: #1a1a1a;
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    padding: 5px 10px;
    border-radius: 4px;
    pointer-events: none;
    opacity: 0;
    transform: translateX(6px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

#uneyo-wa-float .uneyo-wa-float__label::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 100%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-left-color: #1a1a1a;
}

#uneyo-wa-float:hover .uneyo-wa-float__label {
    opacity: 1;
    transform: translateX(0);
}


/* =============================================================================
   3. WATER SOFTENER BEST SELLER BADGE
   Applies to any element with class .water-softener-card
   ============================================================================= */

.water-softener-card {
    position: relative;
}

/* The badge itself — injected via ::before pseudo-element */
.water-softener-card::before {
    content: "\2B50 Best Seller";   /* ⭐ Best Seller */
    position: absolute;
    top: 12px;
    left: 0;
    background: linear-gradient(135deg, #F59E0B, #D97706);
    color: #ffffff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.4px;
    padding: 4px 12px 4px 10px;
    border-radius: 0 20px 20px 0;
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.4);
    z-index: 10;
    line-height: 1.5;
    pointer-events: none;
    white-space: nowrap;
}

/* Optional: subtle highlight ring on the card */
.water-softener-card:hover {
    outline: 2px solid #F59E0B;
    outline-offset: 3px;
    border-radius: 4px;
}


/* =============================================================================
   5. AUTO-SCROLLING GALLERY  [uneyo_gallery]
   ============================================================================= */

/* Outer wrapper — provides the heading and centres everything */
.uneyo-gallery-wrap {
    width: 100%;
    overflow: hidden;
    position: relative;
    padding: 20px 0 16px;
}

.uneyo-gallery-wrap__heading {
    text-align: center;
    margin-bottom: 24px;
}

/* Viewport: clips the track and adds the left/right fade edges */
.uneyo-gallery-viewport {
    position: relative;
    overflow: hidden;
    width: 100%;
}

/* Left fade — masks cards as they scroll off-screen */
.uneyo-gallery-viewport::before,
.uneyo-gallery-viewport::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 80px;
    z-index: 2;
    pointer-events: none;
}

.uneyo-gallery-viewport::before {
    left: 0;
    background: linear-gradient( to right, #ffffff 0%, transparent 100% );
}

.uneyo-gallery-viewport::after {
    right: 0;
    background: linear-gradient( to left, #ffffff 0%, transparent 100% );
}

/* The scrolling track */
.uneyo-gallery-track {
    display: flex;
    align-items: center;
    gap: 20px;
    width: max-content;          /* grows to fit all cards side by side */
    animation: uneyo-marquee var( --uneyo-gallery-speed, 30s ) linear infinite;
}

/* Pause on hover — CSS handles it; JS syncs the button icon */
.uneyo-gallery-track:hover {
    animation-play-state: paused;
}

@keyframes uneyo-marquee {
    0%   { transform: translateX( 0 ); }
    100% { transform: translateX( -50% ); } /* -50% scrolls exactly one set (half of doubled track) */
}

/* Individual image cards */
.uneyo-gallery-card {
    flex-shrink: 0;
    width: 280px;
    height: 200px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba( 0, 0, 0, 0.12 );
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    background-color: #f0f4f8;  /* fallback while image loads */
}

.uneyo-gallery-card:hover {
    transform: scale( 1.04 );
    box-shadow: 0 8px 28px rgba( 0, 0, 0, 0.2 );
    /* Card-level hover does NOT pause the track — track hover does.
       The scale still fires because the track freezes in place on hover. */
}

.uneyo-gallery-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 12px;
}

/* Play / Pause control bar */
.uneyo-gallery-controls {
    display: flex;
    justify-content: center;
    margin-top: 14px;
}

.uneyo-gallery-controls__btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: 2px solid #003E8A;
    color: #003E8A;
    font-size: 13px;
    font-weight: 600;
    padding: 6px 18px;
    border-radius: 20px;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
    line-height: 1.4;
}

.uneyo-gallery-controls__btn:hover {
    background-color: #003E8A;
    color: #ffffff;
}

.uneyo-gallery-controls__btn:hover svg {
    fill: #ffffff;
}

.uneyo-gallery-controls__btn svg {
    width: 16px;
    height: 16px;
    fill: #003E8A;
    flex-shrink: 0;
    transition: fill 0.2s ease;
}

/* Placeholder (no images) */
.uneyo-gallery-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: #003E8A;
    color: #ffffff;
    border-radius: 12px;
    padding: 48px 24px;
    text-align: center;
    min-height: 200px;
    margin: 0 20px;
}

.uneyo-gallery-placeholder__icon svg {
    width: 56px;
    height: 56px;
    fill: rgba( 255, 255, 255, 0.6 );
    margin-bottom: 16px;
}

.uneyo-gallery-placeholder__text {
    font-size: 15px;
    font-weight: 600;
    margin: 0 0 8px;
    color: #ffffff;
}

.uneyo-gallery-placeholder__text code {
    background: rgba( 255, 255, 255, 0.15 );
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
}

.uneyo-gallery-placeholder__sub {
    font-size: 13px;
    color: rgba( 255, 255, 255, 0.7 );
    margin: 0;
}


/* =============================================================================
   4. RESPONSIVE OVERRIDES
   ============================================================================= */

/* Tablet: tighten spacing */
@media (max-width: 768px) {
    #uneyo-top-bar {
        padding: 6px 14px;
        font-size: 12px;
    }

    /* Hide email on mobile to save space */
    .uneyo-top-bar__item--email {
        display: none;
    }

    .uneyo-top-bar__left {
        gap: 10px;
    }
}

/* Small mobile: stack bar vertically */
@media (max-width: 480px) {
    #uneyo-top-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        padding: 8px 14px;
    }

    .uneyo-top-bar__left {
        flex-wrap: wrap;
        gap: 8px;
    }

    /* Also hide the dividers when stacked */
    .uneyo-top-bar__divider {
        display: none;
    }

    /* Floating button: slightly smaller on mobile */
    #uneyo-wa-float {
        width: 48px;
        height: 48px;
        bottom: 20px;
        right: 16px;
    }

    #uneyo-wa-float svg {
        width: 26px;
        height: 26px;
    }
}

/* ── Gallery responsive ──────────────────────────────────────────────────── */

/* Tablet (≤768px): show ~2 cards — narrow cards slightly */
@media (max-width: 768px) {
    .uneyo-gallery-card {
        width: 220px;
        height: 160px;
    }

    .uneyo-gallery-viewport::before,
    .uneyo-gallery-viewport::after {
        width: 40px;
    }
}

/* Mobile (≤480px): show ~1 card — make them near full-width */
@media (max-width: 480px) {
    .uneyo-gallery-card {
        width: 80vw;
        height: 140px;
    }

    .uneyo-gallery-viewport::before,
    .uneyo-gallery-viewport::after {
        width: 20px;
    }

    .uneyo-gallery-track {
        gap: 12px;
    }
}
