/*
 * APS Features Made — site-wide overrides for the Platform theme.
 * Dark mode uses [data-scheme=dark] on <body> (Platform theme convention).
 * Loaded at priority 999, last in cascade.
 */

/* ── CLS prevention: aspect-ratio reserves space before images load ── */
/* Product thumbnails (index / archive / category pages) */
.aps-product-thumb          { overflow: hidden; }
.aps-product-thumb img      { aspect-ratio: 1; width: 100%; height: auto; display: block; }

/* Main gallery image on single-product page */
.aps-image-zoom             { aspect-ratio: 1; width: 100%; height: auto; display: block; }

/* Compare page: product image rows */
.aps-comp-thumb             { aspect-ratio: 1; height: auto; display: block; }

/* Brands list — text-only (no logos): full-width rows, name left, mkopo right */
.aps-brands-box             { margin-bottom: 30px; background: var(--cs-layout-background); }
[data-scheme=dark] .aps-brands-head { background: #333333; }
.aps-brands-body li         { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 6px 10px; box-sizing: border-box; }
.aps-brands-body li > a:first-child { flex: 1; text-align: left; font-weight: 600; }
.aps-brands-body li > a:first-child span { font-weight: inherit; }

/* Comparison index cards — fixed card height prevents grid reflow */
.aps-comparison-card        { contain: layout style; }
.aps-comp-img               { display: block; aspect-ratio: 1; object-fit: cover; }

/* Widget thumbs */
.aps-wd-thumb img           { aspect-ratio: 1; width: 100%; height: auto; }

/* ── Layout & backgrounds ── */
.aps-products       { background: var(--cs-layout-background); }
.aps-main-features  { background: var(--cs-layout-background); }
.aps-comps-overlay  { background: var(--cs-layout-background); }
.aps-comps-handle   { background: var(--cs-layout-background); }
.aps-product-box    { background: var(--cs-layout-background); border: none; }
.aps-rd-box         { border: none; }
.aps-comps-list li  { border: none; }
.aps-video-box      { background: inherit; border: none; }

.cs-container .aps-content {
    background: var(--cs-layout-background);
    overflow: hidden;
    padding: 11px;
    border-radius: 10px;
}
.aps-content { width: 100%; }

.entry-content {
    background: var(--cs-layout-background);
    border-radius: var(--cs-layout-elements-border-radius);
    padding: 12px;
}

:root { --cs-entry-content-medium-width: 100%; }

/* ── Eliminate layout shift (CLS) ── */
/*
 * Mirror Owl's responsive config BEFORE JS runs:
 *   mobile  (<768px): items=3, margin=10px
 *   desktop (≥768px): items=4, margin=10px
 * Once Owl adds .owl-loaded these rules stop applying.
 */
.aps-thumb-carousel:not(.owl-loaded) {
    display: flex;
    flex-wrap: nowrap;
    overflow: hidden;
    gap: 10px;
    padding: 10px 0;
}
.aps-thumb-carousel:not(.owl-loaded) > .aps-thumb-item {
    /* mobile: 3 items */
    flex: 0 0 calc((100% - 20px) / 3);
    float: none;
    box-sizing: border-box;
    min-width: 0;
}
@media (min-width: 768px) {
    .aps-thumb-carousel:not(.owl-loaded) > .aps-thumb-item {
        /* desktop: 4 items */
        flex: 0 0 calc((100% - 30px) / 4);
    }
}
.aps-thumb-carousel:not(.owl-loaded) > .aps-thumb-item img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 10px;
}
/* Reserve thumbnail row height so nothing jumps */
.aps-image-gallery {
    min-height: 132px;
    overflow: hidden;
}
/* Reserve main image space before the image loads */
.aps-main-image {
    min-height: 200px;
}

/* ── Border radius ── */
.aps-main-image,
.aps-thumb-item.active-thumb img,
.aps-thumb-carousel .owl-item img { border-radius: 10px; }

.aps-product-thumb img,
.aps-product-pic img,
.aps-gallery-image img,
.aps-wd-thumb img { border-radius: 10px; }

.aps-container img,
.aps-comps-list ul li a img { border-radius: 5px; }

.aps-product-pic img { border: none; }

/* ── Typography & links ── */
a { text-decoration: none !important; }
.aps-price-value, .aps-btn-iconic:hover { color: var(--cs-light-accent-color); }

/* ── Brand colour overrides: green → blue ── */
.flip-front, .aps-gallery-zoom, .aps-total-score, .aps-btn-skin,
.aps-pagination a.page-numbers, .aps-range-slider-value,
.aps-display-controls ul li a.selected, .aps-dropdown:hover .aps-current-dp,
.aps-brands-list li a span, .aps-cats-list li a span,
.aps-filter-cb:checked + .aps-cb-holder, .aps-search-btn:hover,
.aps-pd-search:hover, .aps-features-list li, .aps-filters li a.selected-filter { background: var(--cs-light-accent-color); }
.flip-back, .aps-btn-skin:hover, .aps-pagination a.page-numbers:hover,
.aps-list-icon, .aps-on-sale, .aps-comps-num, .aps-comps-nav span { background: var(--cs-light-accent-color); }
.aps-btn-skin, .aps-pagination a.page-numbers, .aps-dropdown:hover .aps-current-dp,
.aps-filter-cb:checked + .aps-cb-holder, .aps-search-btn:hover,
.aps-pd-search:hover, .aps-btn-boxed:hover { border-color: var(--cs-light-accent-color); }
.aps-search-item-title a:hover { color: var(--cs-light-accent-color); text-decoration: none; }

h1, h2, h3, h4, h5, h6 { font-weight: 400; color: #222; }

/* ── Widget / list overrides ── */
.aps-wd-products li a { border: none; }
.aps-list-icon { background: none; }
.aps-comps-list li { border: none; }
.aps-comps-thumb { float: initial; padding: 0; margin-right: 0; border: none; }
.aps-on-sale { display: none; }
.aps-btn-iconic.aps-add-compare.aps-in-compare { padding: 10px; border-radius: 4px; }

/* ── Mini row card ── */
.aps-row-mini {
    margin-left: -5px;
    margin-right: -5px;
    grid-template-columns: 72px minmax(0,1fr);
    gap: 1rem;
    padding: 1rem;
    background: var(--cs-layout-background);
    border-radius: var(--cs-layout-elements-border-radius);
    text-decoration: none;
}

/* ── Archive page header ── */
.archive .cs-page__header { max-width: 100%; }

/* ── Table of contents ── */
#toc_container { width: 100% !important; background: inherit; }

/* ── Footer logo ── */
.cs-footer__logo img { height: 50px; }

/* ── Hide share bar on single product ── */
.cs-entry__metabar .cs-share { display: none; }

/* ── Inverse header: hide dark logo ── */
[data-scheme=inverse] .cs-header__logo.cs-logo-dark { display: none; }

/* ── Offcanvas burger icon ── */
.cs-offcanvas__header .cs-header__burger-icon i { background: #000; }

/* ── Mobile header ── */
@media (max-width: 1199.98px) {
    .cs-header__inner-mobile {
        display: flex;
        position: relative;
        z-index: 10;
        background: var(--cs-header-background, var(--cs-site-background));
    }
}

/* ── Sticky header scheme toggle ── */
.cs-navbar-sticky-enabled .cs-site-scheme-toggle .cs-icon-light-mode {
    background: #161616;
}
.cs-navbar-sticky-enabled .cs-site-scheme-toggle .cs-header__scheme-toggle-icons {
    background: rgba(0,0,0,0.15);
}

/* ── Desktop search bar appearance ── */
.cs-header-search__inner {
    background: var(--cs-light-accent-color);
    border: 1px solid rgba(255,255,255,0.25);
}
.cs-search__input::placeholder { color: rgba(255,255,255,0.7) !important; }
.cs-search__form .cs-icon  { color: rgba(255,255,255,0.8); }

/* ── Mobile search: let full-screen overlay handle it ── */
.cs-search-active .cs-header-mobile-search { width: 100%; }

/* ── Product search box ── */
.aps-pd-search {
    height: 100%;
    padding: 10px;
    color: #ccc;
    font-size: 20px;
    line-height: 1;
    position: absolute;
    top: 0;
    right: 0;
    border-bottom-right-radius: 20px;
    border-top-right-radius: 20px;
    border: 1px solid var(--cs-layout-border, #e8e9ea);
    background: var(--cs-layout-background, #f9fafb);
    cursor: pointer;
}

/* ── Container ── */
.aps-container {
    padding: 20px 0 10px;
    margin: 0 auto;
    font-size: 15px;
    color: #727374;
}

/* ── Video play button ── */
.aps-video-play {
    width: 60px !important; height: 60px !important;
    min-width: 60px !important; min-height: 60px !important;
    max-width: 60px !important; max-height: 60px !important;
    position: absolute; top: 50%; left: 50%;
    margin: -30px 0 0 -30px;
    background: var(--cs-light-accent-color);
    opacity: 0.8;
    border-radius: 50% !important;
    transition: opacity 0.3s;
    box-sizing: border-box !important;
    overflow: hidden; padding: 0 !important;
    border: none !important; transform: none !important;
    flex: none !important;
}
.aps-video-play::before {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-40%, -50%);
    width: 0; height: 0;
    border-left: 18px solid #fff;
    border-top: 11px solid transparent;
    border-bottom: 11px solid transparent;
}
.aps-video-play:hover { opacity: 1; }

/* ── Filter / sort controls ── */
.aps-column h3, .aps-widget-title, .title {
    position: relative;
    border-bottom: 1px solid #00a43d;
    padding-bottom: 15px;
    font-weight: 400;
    font-size: 17px;
    line-height: 22px;
    color: #111;
    margin: 0 0 22px;
}

.aps-column {
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 0;
    margin-bottom: 20px;
    padding: 0;
    background: 0 0;
    border-radius: 0;
    box-shadow: none;
}
.aps-brands-controls,
.aps-category-controls,
.aps-price-controls  { flex: 1; min-width: 0; margin-right: 0; border-right: 1px solid #ddd; }
.aps-sort-controls   { flex: 1; min-width: 0; border-right: none; }

.aps-dropdown { position: relative; height: 100%; }
.aps-current-dp {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 0;
    background: var(--cs-light-accent-color);
    color: #fff;
    font-weight: 500;
    transition: 0.3s;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    height: 48px;
    line-height: 1.2;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
}
.aps-current-dp:hover { border-color: #1a40cc; box-shadow: 0 2px 8px rgba(41,88,255,0.3); z-index: 1; position: relative; }
.aps-category-controls .aps-current-dp { border-right: none; border-radius: 6px 0 0 6px; }
.aps-brands-controls  .aps-current-dp,
.aps-price-controls   .aps-current-dp { border-right: none; border-left: none; border-radius: 0; }
.aps-sort-controls    .aps-current-dp { border-left: none; border-radius: 0 6px 6px 0; }

.aps-dropdown ul {
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--cs-layout-background, #fff);
    border: 1px solid var(--cs-layout-border, #ddd);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000; display: none;
    max-height: 300px; overflow-y: auto;
}
.aps-dropdown:hover ul { display: block; }
.aps-dropdown ul li { list-style: none; margin: 0; }
.aps-dropdown ul li a {
    display: block;
    padding: 10px 15px;
    text-decoration: none;
    color: var(--cs-color-text, #333);
    transition: background 0.2s;
    border-bottom: 1px solid var(--cs-layout-border, #f0f0f0);
}
.aps-dropdown ul li:last-child a { border-bottom: none; }
.aps-dropdown ul li a:hover,
.aps-dropdown ul li a.selected { background: var(--cs-light-accent-color); color: #fff; }
.aps-dropdown ul li a.selected { font-weight: 700; }

.aps-clear-filters-section {
    margin: 15px 0; padding: 12px 15px;
    background: var(--cs-layout-background, #e8f5e8);
    border-radius: 6px;
    display: flex; align-items: center; gap: 15px;
    border-left: 4px solid var(--cs-light-accent-color);
}
.aps-filter-tag {
    background: var(--cs-light-accent-color); color: #fff;
    padding: 4px 10px; font-size: 12px;
    border-radius: 4px; font-weight: 500; margin-right: 6px;
}
.aps-active-filters { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.aps-button {
    text-align: center; padding: 8px 16px;
    text-decoration: none; transition: 0.3s;
    display: inline-flex; align-items: center; gap: 6px;
    border-radius: 4px; font-weight: 500;
}
.aps-btn-secondary { background: #6c757d; color: #fff; border: 1px solid #6c757d; }
.aps-btn-secondary:hover { background: #5a6268; border-color: #5a6268; }

@media (max-width: 1200px) { .aps-current-dp { padding: 10px 12px; font-size: 13px; } }
@media (max-width: 992px)  { .aps-current-dp { padding: 8px 10px; font-size: 12px; } }
@media (max-width: 768px) {
    .aps-column { flex-direction: column; gap: 0; }
    .aps-brands-controls,
    .aps-category-controls,
    .aps-price-controls,
    .aps-sort-controls { width: 100%; min-width: unset; margin-right: 0; margin-bottom: 0; border-right: none; border-bottom: 1px solid #ddd; }
    .aps-category-controls .aps-current-dp { border-radius: 6px 6px 0 0; border-right: 2px solid #ddd; border-bottom: none; }
    .aps-brands-controls  .aps-current-dp,
    .aps-price-controls   .aps-current-dp { border-radius: 0; border-left: 2px solid #ddd; border-right: 2px solid #ddd; border-bottom: none; }
    .aps-sort-controls    .aps-current-dp { border-radius: 0 0 6px 6px; border-left: 2px solid #ddd; border-right: 2px solid #ddd; }
    .aps-sort-controls { border-bottom: none; }
    .aps-current-dp { text-align: center; height: 44px; }
    .aps-clear-filters-section { flex-direction: column; align-items: flex-start; gap: 10px; }
}
@media (max-width: 480px) {
    .aps-current-dp { padding: 8px 12px; font-size: 14px; height: 42px; }
    .aps-clear-filters-section { padding: 10px; }
}

/* ── Price info card ── */
.aps-price-info-card { background: var(--cs-layout-background); }

/* ── Spec sheet rows ── */
.aps-ss-row:nth-child(odd)  { background: var(--cs-layout-background); }
.aps-ss-row:nth-child(even) { background: var(--cs-layout-background); }

/* ── FAQ section ── */
.aps-device-specs-faq.aps-faq-section { background: var(--cs-layout-background); }

/* ── Compare column separators ── */
.aps-2co, .aps-3co, .aps-4co { border-right: 1px solid var(--cs-layout-background); }

/* ── Details content / feature items ── */
.aps-details-content { background: var(--cs-layout-background); }
.aps-feature-item    { background: var(--cs-layout-background); }

/* ── Hidden elements ── */
.aps-brands-body li a img,
.aps-filters-sw,
.aps-item-buttons,
.aps-comp-list-author,
.aps-display-controls,
.aps-on-sale,
.aps-view-info,
.aps-btn-view { display: none; }

/* ── Product grid responsive ── */
@media (max-width: 628px) { .aps-products-grid.aps-grid-col4 > li { width: 50%; } }

/* ── Iframe responsive ── */
.aps-content iframe,
.aps-column iframe,
.aps-diff-content iframe,
iframe[src*="youtube.com"],
iframe[src*="youtu.be"],
iframe[src*="youtube-nocookie.com"] {
    max-width: 100% !important;
    width: 100% !important;
    border: none !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* ── Video lightbox overrides ── */

/* Close button: replace broken 16px image with visible 44px circle + X */
.nivo-lightbox-theme-default .nivo-lightbox-close {
    position: absolute;
    top: 16px !important;
    right: 16px !important;
    width: 44px !important;
    height: 44px !important;
    padding: 0 !important;
    text-indent: 0 !important;
    font-size: 0 !important;
    background: rgba(0,0,0,0.65) !important;
    background-image: none !important;
    border-radius: 50% !important;
    opacity: 1 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 99999;
    cursor: pointer;
}
.nivo-lightbox-theme-default .nivo-lightbox-close::before,
.nivo-lightbox-theme-default .nivo-lightbox-close::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    top: 50%;
    left: 50%;
}
.nivo-lightbox-theme-default .nivo-lightbox-close::before {
    transform: translate(-50%, -50%) rotate(45deg);
}
.nivo-lightbox-theme-default .nivo-lightbox-close::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}
.nivo-lightbox-theme-default .nivo-lightbox-close:hover {
    background: rgba(0,0,0,0.9) !important;
    opacity: 1 !important;
}

/* Mobile: full-screen video lightbox */
@media (max-width: 767px) {
    .nivo-lightbox-overlay {
        background: #000 !important;
    }
    .nivo-lightbox-wrap {
        top: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        border-radius: 0;
    }
    .nivo-lightbox-content {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .nivo-lightbox-content iframe {
        width: 100vw !important;
        height: 56.25vw !important; /* 16:9 */
        max-height: 100vh;
    }
    /* Swipe hint: show subtle arrows */
    .nivo-lightbox-nav {
        display: block !important;
        width: 44px !important;
        height: 44px !important;
        background: rgba(255,255,255,0.15) !important;
        border-radius: 50% !important;
        top: auto !important;
        opacity: 0.7;
    }
    .nivo-lightbox-prev {
        bottom: 80px;
        top: auto !important;
        left: 50% !important;
        transform: translateX(-50%) rotate(90deg);
    }
    .nivo-lightbox-next {
        bottom: 20px;
        top: auto !important;
        right: 50% !important;
        transform: translateX(50%) rotate(90deg);
    }
}

/* ── Feature animation ── */
.aps-feature-anim {
    background: linear-gradient(to right, var(--cs-light-accent-color), var(--cs-light-accent-color)) !important;
    box-shadow: 0 4px 4px 0 rgba(0,0,0,0.1), 0 0 0 1px rgba(0,0,0,0.09);
}

/* ============================================================
   DARK MODE  — [data-scheme=dark] on <body>
   ============================================================ */
[data-scheme=dark] .aps-product-box    { background: var(--cs-layout-background); border: none; }
[data-scheme=dark] .aps-main-title     { color: #fff; }
[data-scheme=dark] .aps-wd-products li a { background: inherit; }
[data-scheme=dark] .cs-offcanvas__header .cs-header__burger-icon i { background: #fff; }

[data-scheme=dark] h1,
[data-scheme=dark] h2,
[data-scheme=dark] h3,
[data-scheme=dark] h4,
[data-scheme=dark] h5,
[data-scheme=dark] h6 { font-weight: 400; color: #fff; }

[data-scheme=dark] .aps-products-grid .aps-product-title a { color: #fff; }
[data-scheme=dark] .aps-product-thumb img,
[data-scheme=dark] .aps-product-pic img,
[data-scheme=dark] .aps-gallery-image img,
[data-scheme=dark] .aps-wd-thumb img { border-radius: 10px; }

[data-scheme=dark] .aps-container img,
[data-scheme=dark] .aps-comps-list ul li a img { border-radius: 5px; }

[data-scheme=dark] .aps-comps-list li      { border: none; }
[data-scheme=dark] .aps-details-content    { background: var(--cs-layout-background); }
[data-scheme=dark] .aps-feature-item       { background: var(--cs-layout-background); }
[data-scheme=dark] .aps-feature-value      { color: #fff; }
[data-scheme=dark] .aps-feature-name       { color: #fff; }
[data-scheme=dark] .aps-rd-box             { border: none; background: var(--cs-layout-background); }
[data-scheme=dark] .aps-2co,
[data-scheme=dark] .aps-3co,
[data-scheme=dark] .aps-4co               { border-right: 1px solid var(--cs-layout-background); }
[data-scheme=dark] .aps-price-info-card   { background: var(--cs-layout-background); }
[data-scheme=dark] .aps-container p       { color: #e0e0e0; }
[data-scheme=dark] .aps-ss-heading-text   { color: #fff; }
[data-scheme=dark] .aps-ss-row:nth-child(odd),
[data-scheme=dark] .aps-ss-row:nth-child(even) { background: var(--cs-layout-background); }
[data-scheme=dark] .aps-ss-value         { color: #fff; }
[data-scheme=dark] .aps-ss-label         { color: #cdcdcd; }
[data-scheme=dark] .aps-ss-label.has-tip::after { background: #161616; }
[data-scheme=dark] .aps-btn-iconic       { color: #fff; }
[data-scheme=dark] .aps-device-specs-faq.aps-faq-section { background: var(--cs-layout-background); }
[data-scheme=dark] .aps-device-specs-faq .aps-faq-answer p { color: #e0e0e0; }
[data-scheme=dark] .aps-comps-list h4    { color: #fff; }
[data-scheme=dark] .aps-column h3,
[data-scheme=dark] .aps-widget-title,
[data-scheme=dark] .title { border-bottom: 1px solid rgba(255,255,255,0.2); color: #fff; }
[data-scheme=dark] .aps-comps-list ul li a { background: var(--cs-layout-background); }

/* Dark mode — filter dropdowns */
[data-scheme=dark] .aps-dropdown ul { background: var(--cs-layout-background); border-color: rgba(255,255,255,0.1); }
[data-scheme=dark] .aps-dropdown ul li a { color: #e0e0e0; border-bottom-color: rgba(255,255,255,0.08); }
[data-scheme=dark] .aps-dropdown ul li a:hover,
[data-scheme=dark] .aps-dropdown ul li a.selected { background: var(--cs-light-accent-color); color: #fff; }
[data-scheme=dark] .aps-clear-filters-section { background: var(--cs-layout-background); }

/* Dark mode — product search box */
[data-scheme=dark] .aps-pd-search {
    border-color: rgba(255,255,255,0.1);
    background: var(--cs-layout-background);
    color: #aaa;
}

/* Dark mode — sc_card */
[data-scheme=dark] .sc_card { background: var(--cs-layout-background); box-shadow: 0 4px 4px 0 rgba(0,0,0,0.3); }
