/* ==========================================================================
   AL-MARVA Virtual Homepage — Scoped Styles
   All rules scoped to body.almarva-homepage
   ========================================================================== */

/* ---- CSS Custom Properties ---- */
body.almarva-homepage {
    --ah-primary: #00A859;
    --ah-primary-hover: #00914D;
    --ah-primary-light: #e6f7ef;
    --ah-primary-dark: #007A3E;
    --ah-bg: #f5f6f8;
    --ah-card-bg: #ffffff;
    --ah-text: #1a1a1a;
    --ah-text-secondary: #666666;
    --ah-text-muted: #999999;
    --ah-border: #e8e8e8;
    --ah-radius-card: 16px;
    --ah-radius-btn: 12px;
    --ah-radius-sm: 8px;
    --ah-shadow-sm: 0 1px 4px rgba(0,0,0,0.06);
    --ah-shadow-md: 0 4px 16px rgba(0,0,0,0.10);
    --ah-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    --ah-pan-speed: 30s;
}

/* ---- Global Reset for Homepage ---- */
body.almarva-homepage {
    background: var(--ah-bg) !important;
    font-family: var(--ah-font);
}

body.almarva-homepage .ah-wrapper {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 0 40px;
}

/* ---- SEO H1 (visually hidden) ---- */
body.almarva-homepage .ah-seo-title {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

/* ==========================================================================
   HEADER
   ========================================================================== */
body.almarva-homepage .ah-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--ah-primary);
    padding: 10px 16px;
}

body.almarva-homepage .ah-header-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 1280px;
    margin: 0 auto;
}

body.almarva-homepage .ah-search-wrap {
    flex: 1;
}

body.almarva-homepage .ah-search-form {
    position: relative;
    display: flex;
    align-items: center;
}

body.almarva-homepage .ah-search-icon {
    position: absolute;
    left: 12px;
    color: var(--ah-text-muted);
    pointer-events: none;
}

body.almarva-homepage .ah-search-input {
    width: 100%;
    height: 42px;
    padding: 0 16px 0 40px;
    border: none;
    border-radius: 12px;
    background: #fff;
    font-size: 14px;
    color: var(--ah-text);
    outline: none;
    transition: box-shadow 0.2s;
}

body.almarva-homepage .ah-search-input:focus {
    box-shadow: 0 0 0 2px rgba(0,168,89,0.3);
}

body.almarva-homepage .ah-search-input::placeholder {
    color: var(--ah-text-muted);
}

body.almarva-homepage .ah-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

body.almarva-homepage .ah-header-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(255,255,255,0.15);
    color: #fff;
    text-decoration: none;
    transition: background 0.2s;
}

body.almarva-homepage .ah-header-btn:hover {
    background: rgba(255,255,255,0.25);
    color: #fff;
    text-decoration: none;
}

body.almarva-homepage .ah-wallet-link {
    width: auto;
    padding: 0 14px;
    font-weight: 600;
    font-size: 14px;
    gap: 4px;
}

body.almarva-homepage .ah-wallet-text {
    white-space: nowrap;
}

/* ==========================================================================
   HERO BANNER
   ========================================================================== */
body.almarva-homepage .ah-hero {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
    border-radius: 0 0 var(--ah-radius-card) var(--ah-radius-card);
}

body.almarva-homepage .ah-hero-banner {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body.almarva-homepage .ah-hero-img {
    display: block;
    width: auto;
    height: 100%;
    min-width: 100%;
    object-fit: cover;
    animation: ahPanLR var(--ah-pan-speed, 30s) ease-in-out infinite alternate;
}

@keyframes ahPanLR {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(calc(-100% + 100vw));
    }
}

body.almarva-homepage .ah-hero-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 24px 20px;
    background: linear-gradient(transparent, rgba(0,0,0,0.55));
    color: #fff;
}

body.almarva-homepage .ah-hero-title {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 8px;
    color: #fff;
    text-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

body.almarva-homepage .ah-hero-cta {
    display: inline-block;
    padding: 10px 24px;
    background: var(--ah-primary);
    color: #fff;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s;
}

body.almarva-homepage .ah-hero-cta:hover {
    background: var(--ah-primary-hover);
    color: #fff;
    text-decoration: none;
}

/* PHASE 7 FIX: Fallback gradient banner when no image is set */
body.almarva-homepage .ah-hero-fallback {
    position: relative;
    width: 100%;
    height: 100%;
}

body.almarva-homepage .ah-hero-fallback .ah-hero-fallback-bg {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #00A859 0%, #007A3E 40%, #005A2E 70%, #003D1F 100%);
    animation: ahFallbackShift 8s ease-in-out infinite alternate;
}

@keyframes ahFallbackShift {
    0% {
        background-position: 0% 50%;
    }
    100% {
        background-position: 100% 50%;
    }
}

/* ==========================================================================
   SECTION HEADERS
   ========================================================================== */
body.almarva-homepage .ah-section {
    padding: 0 16px;
    margin-top: 24px;
}

body.almarva-homepage .ah-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

body.almarva-homepage .ah-section-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--ah-text);
    margin: 0;
}

body.almarva-homepage .ah-countdown-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    background: #ff4444;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    border-radius: 999px;
    white-space: nowrap;
}

/* ==========================================================================
   HORIZONTAL SCROLL ROW
   ========================================================================== */
body.almarva-homepage .ah-product-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
    scrollbar-width: none;
}

body.almarva-homepage .ah-product-scroll::-webkit-scrollbar {
    display: none;
}

body.almarva-homepage .ah-product-scroll .ah-card {
    flex: 0 0 152px;
    scroll-snap-align: start;
}

/* ==========================================================================
   PRODUCT GRID
   ========================================================================== */
body.almarva-homepage .ah-product-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

/* ==========================================================================
   PRODUCT CARD (Portrait 3:4, Uzum-style)
   ========================================================================== */
body.almarva-homepage .ah-card {
    background: var(--ah-card-bg);
    border-radius: var(--ah-radius-card);
    overflow: hidden;
    box-shadow: var(--ah-shadow-sm);
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s;
}

body.almarva-homepage .ah-card:hover {
    box-shadow: var(--ah-shadow-md);
}

body.almarva-homepage .ah-card-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    flex: 1;
}

body.almarva-homepage .ah-card-link:hover {
    text-decoration: none;
    color: inherit;
}

body.almarva-homepage .ah-card-img-wrap {
    position: relative;
    width: 100%;
    padding-top: 133.33%; /* 3:4 ratio */
    overflow: hidden;
    background: #f0f0f0;
}

body.almarva-homepage .ah-card-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

body.almarva-homepage .ah-card:hover .ah-card-img {
    transform: scale(1.04);
}

body.almarva-homepage .ah-card-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    background: #ff4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    z-index: 2;
}

body.almarva-homepage .ah-card-heart {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.85);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ah-text-muted);
    z-index: 2;
    transition: all 0.2s;
    padding: 0;
}

body.almarva-homepage .ah-card-heart:hover {
    background: #fff;
    color: #ff4444;
}

body.almarva-homepage .ah-card-heart.active {
    color: #ff4444;
}

body.almarva-homepage .ah-card-heart.active svg {
    fill: #ff4444;
}

body.almarva-homepage .ah-card-body {
    padding: 10px 12px 6px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

body.almarva-homepage .ah-card-price {
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
}

body.almarva-homepage .ah-card-sale-price {
    font-size: 15px;
    font-weight: 700;
    color: #ff4444;
}

body.almarva-homepage .ah-card-old-price {
    font-size: 12px;
    color: var(--ah-text-muted);
    text-decoration: line-through;
}

body.almarva-homepage .ah-card-current-price {
    font-size: 15px;
    font-weight: 700;
    color: var(--ah-text);
}

body.almarva-homepage .ah-card-title {
    font-size: 13px;
    font-weight: 400;
    color: var(--ah-text-secondary);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

body.almarva-homepage .ah-card-btn {
    display: block;
    text-align: center;
    padding: 8px 12px;
    margin: 6px 10px 10px;
    background: var(--ah-primary);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--ah-radius-btn);
    text-decoration: none;
    transition: background 0.2s;
}

body.almarva-homepage .ah-card-btn:hover {
    background: var(--ah-primary-hover);
    color: #fff;
    text-decoration: none;
}

/* ==========================================================================
   WALLET PROMO
   ========================================================================== */
body.almarva-homepage .ah-promo-card {
    background: linear-gradient(135deg, var(--ah-primary-dark), var(--ah-primary));
    border-radius: var(--ah-radius-card);
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    color: #fff;
}

body.almarva-homepage .ah-promo-icon {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}

body.almarva-homepage .ah-promo-text {
    flex: 1;
}

body.almarva-homepage .ah-promo-text h2 {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 4px;
    color: #fff;
}

body.almarva-homepage .ah-promo-text p {
    font-size: 13px;
    margin: 0;
    opacity: 0.85;
    color: #fff;
}

body.almarva-homepage .ah-promo-btn {
    flex-shrink: 0;
    padding: 10px 20px;
    background: #fff;
    color: var(--ah-primary-dark);
    font-size: 13px;
    font-weight: 700;
    border-radius: 999px;
    text-decoration: none;
    transition: opacity 0.2s;
}

body.almarva-homepage .ah-promo-btn:hover {
    opacity: 0.9;
    color: var(--ah-primary-dark);
    text-decoration: none;
}

/* ==========================================================================
   FAQ
   ========================================================================== */
body.almarva-homepage .ah-faq-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

body.almarva-homepage .ah-faq-item {
    background: var(--ah-card-bg);
    border-radius: var(--ah-radius-btn);
    overflow: hidden;
    box-shadow: var(--ah-shadow-sm);
}

body.almarva-homepage .ah-faq-q {
    width: 100%;
    padding: 14px 16px;
    border: none;
    background: transparent;
    text-align: left;
    font-size: 14px;
    font-weight: 600;
    color: var(--ah-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: var(--ah-font);
}

body.almarva-homepage .ah-faq-q::after {
    content: '+';
    font-size: 20px;
    font-weight: 400;
    color: var(--ah-text-muted);
    transition: transform 0.2s;
}

body.almarva-homepage .ah-faq-item.open .ah-faq-q::after {
    content: '−';
}

body.almarva-homepage .ah-faq-a {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    padding: 0 16px;
}

body.almarva-homepage .ah-faq-item.open .ah-faq-a {
    max-height: 200px;
    padding: 0 16px 14px;
}

body.almarva-homepage .ah-faq-a p {
    margin: 0;
    font-size: 13px;
    color: var(--ah-text-secondary);
    line-height: 1.5;
}

/* ==========================================================================
   ICON ROW
   ========================================================================== */
body.almarva-homepage .ah-icon-scroll {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
    scrollbar-width: none;
}

body.almarva-homepage .ah-icon-scroll::-webkit-scrollbar {
    display: none;
}

body.almarva-homepage .ah-icon-item {
    flex: 0 0 72px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    color: var(--ah-text);
}

body.almarva-homepage .ah-icon-item:hover {
    text-decoration: none;
    color: var(--ah-primary);
}

body.almarva-homepage .ah-icon-img {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    object-fit: cover;
    background: var(--ah-primary-light);
}

body.almarva-homepage .ah-icon-placeholder {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: var(--ah-primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ah-primary);
}

body.almarva-homepage .ah-icon-label {
    font-size: 11px;
    font-weight: 500;
    text-align: center;
    line-height: 1.2;
    max-width: 72px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ==========================================================================
   RESPONSIVE: Desktop (768px+)
   ========================================================================== */
@media (min-width: 768px) {
    body.almarva-homepage .ah-hero {
        height: 320px;
        border-radius: 0 0 20px 20px;
    }

    body.almarva-homepage .ah-hero-title {
        font-size: 30px;
    }

    body.almarva-homepage .ah-section {
        padding: 0 24px;
        margin-top: 32px;
    }

    body.almarva-homepage .ah-section-title {
        font-size: 22px;
    }

    body.almarva-homepage .ah-product-scroll .ah-card {
        flex: 0 0 200px;
    }

    body.almarva-homepage .ah-product-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 16px;
    }

    body.almarva-homepage .ah-card-title {
        font-size: 14px;
    }

    body.almarva-homepage .ah-card-sale-price,
    body.almarva-homepage .ah-card-current-price {
        font-size: 16px;
    }

    body.almarva-homepage .ah-header {
        padding: 12px 24px;
    }

    body.almarva-homepage .ah-search-input {
        height: 46px;
        font-size: 15px;
    }

    body.almarva-homepage .ah-promo-card {
        padding: 32px 28px;
    }

    body.almarva-homepage .ah-promo-text h2 {
        font-size: 20px;
    }
}

/* ==========================================================================
   RESPONSIVE: Large Desktop (1024px+)
   ========================================================================== */
@media (min-width: 1024px) {
    body.almarva-homepage .ah-hero {
        height: 400px;
    }

    body.almarva-homepage .ah-product-scroll .ah-card {
        flex: 0 0 230px;
    }

    body.almarva-homepage .ah-product-grid {
        grid-template-columns: repeat(5, 1fr);
    }

    body.almarva-homepage .ah-wrapper {
        padding: 0 0 60px;
    }
}

/* ==========================================================================
   RESPONSIVE: Small Mobile (max 374px)
   ========================================================================== */
@media (max-width: 374px) {
    body.almarva-homepage .ah-product-scroll .ah-card {
        flex: 0 0 130px;
    }

    body.almarva-homepage .ah-card-body {
        padding: 8px 8px 4px;
    }

    body.almarva-homepage .ah-card-sale-price,
    body.almarva-homepage .ah-card-current-price {
        font-size: 13px;
    }

    body.almarva-homepage .ah-card-title {
        font-size: 12px;
    }

    body.almarva-homepage .ah-card-btn {
        padding: 6px 8px;
        font-size: 12px;
        margin: 4px 8px 8px;
    }

    body.almarva-homepage .ah-hero {
        height: 160px;
    }
}

/* ==========================================================================
   ADMIN BAR OFFSET (when logged in)
   ========================================================================== */
body.almarva-homepage.admin-bar .ah-header {
    top: 32px;
}

@media (max-width: 782px) {
    body.almarva-homepage.admin-bar .ah-header {
        top: 46px;
    }
}
