.apt-section {
    --apt-primary: #1c71ad;
    --apt-primary-text: #fff;
    --apt-accent: #e30c14;
    --apt-title: #1f1f1f;
    --apt-text: #1f1f1f;
    --apt-card-bg: #fff;
    --apt-card-border: #e6e6e6;
    --apt-section-bg: transparent;
    --apt-radius: 8px;
    background: var(--apt-section-bg);
    color: var(--apt-text);
    box-sizing: border-box;
    padding: 16px 0;
}

.apt-section *,
.apt-section *::before,
.apt-section *::after {
    box-sizing: border-box;
}

.apt-section__title {
    color: var(--apt-title);
    font-size: 24px;
    line-height: 1.3;
    margin: 0 0 16px;
}

.apt-scroller {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
    padding-bottom: 6px;
}

.apt-scroller > * {
    flex: 0 0 auto;
    scroll-snap-align: start;
}

.apt-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.apt-card {
    display: block;
    background: var(--apt-card-bg);
    border: 1px solid var(--apt-card-border);
    border-radius: var(--apt-radius);
    color: var(--apt-text);
    text-decoration: none;
    overflow: hidden;
}

.apt-card__title {
    color: var(--apt-title);
    font-size: 18px;
    margin: 0 0 8px;
}

.apt-card__text,
.apt-card__text p {
    margin: 0;
}

/* Hero */
.apt-hero .apt-scroller {
    gap: 0;
}

.apt-hero__slide {
    width: 100%;
    border-radius: var(--apt-radius);
    overflow: hidden;
}

.apt-hero__slide img {
    display: block;
    width: 100%;
    height: auto;
}

/* Chips */
/* Elementor's widget element is a flex item sized by its content; cap it to the parent */
.elementor-widget-apteka-category-chips {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    flex: 0 1 auto;
}

.elementor-widget-apteka-category-chips > .elementor-widget-container {
    max-width: 100%;
    min-width: 0;
}

.apteka-elementor-widget--category-chips {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    contain: inline-size;
}

.apt-chips {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.apt-chips .apt-scroller {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    gap: 12px;
}

.apt-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    padding: 10px 18px;
    border: 1px solid var(--apt-primary);
    border-radius: 999px;
    color: var(--apt-primary);
    background: var(--apt-card-bg);
    text-decoration: none;
    font-weight: 500;
}

.apt-chip:hover {
    background: var(--apt-primary);
    color: var(--apt-primary-text);
}

.apt-chip img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

/* Services */
.apt-tile {
    padding: 20px;
    text-align: center;
}

.apt-tile img {
    max-height: 64px;
    width: auto;
    margin: 0 auto 12px;
    display: block;
}

/* Topics */
.apt-topic__media img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.apt-topic__body {
    padding: 16px;
}

/* Advantages */
.apt-advantage {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 280px;
    padding: 16px;
}

.apt-advantage img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    flex: 0 0 auto;
}

.apt-advantage strong {
    color: var(--apt-primary);
}

/* Brands */
.apt-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 140px;
    height: 80px;
    padding: 12px;
}

.apt-brand img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Newsletter */
.apt-newsletter__box {
    background: var(--apt-card-bg);
    border: 1px solid var(--apt-card-border);
    border-radius: var(--apt-radius);
    padding: 24px;
    text-align: center;
}

.apt-newsletter__form {
    display: flex;
    gap: 8px;
    max-width: 520px;
    margin: 16px auto 0;
}

.apt-newsletter__form input {
    flex: 1 1 auto;
    min-width: 0;
    padding: 12px 14px;
    border: 1px solid var(--apt-card-border);
    border-radius: var(--apt-radius);
}

.apt-button {
    padding: 12px 22px;
    border: 1px solid var(--apt-primary);
    border-radius: var(--apt-radius);
    background: var(--apt-primary);
    color: var(--apt-primary-text);
    cursor: pointer;
    font-weight: 600;
}

.apt-button:hover {
    opacity: 0.9;
}

.apt-newsletter__privacy {
    margin-top: 12px;
    font-size: 12px;
}

@media (max-width: 767px) {
    .apt-section__title { font-size: 20px; }
    .apt-newsletter__form { flex-direction: column; }
}
/* Chips: bar layout */
.apt-chips--bar {
    --apt-bar-bg: #f1f1f1;
    --apt-bar-text: #1f1f1f;
    --apt-bar-hover: var(--apt-primary);
    --apt-bar-divider: #d6d6d6;
}

.apt-chips--bar .apt-scroller {
    background: var(--apt-bar-bg);
    border-radius: var(--apt-radius);
    padding: 14px 16px;
    gap: 20px;
    align-items: center;
}

.apt-chips--bar .apt-chip {
    border: 0;
    border-radius: 0;
    padding: 0;
    background: transparent;
    color: var(--apt-bar-text);
    font-weight: 700;
}

.apt-chips--bar .apt-chip:hover {
    background: transparent;
    color: var(--apt-bar-hover);
}

.apt-chips--bar .apt-chip--last {
    margin-left: auto;
    padding-left: 24px;
    border-left: 1px solid var(--apt-bar-divider);
}

/* Chips: mobile dropdown (toggle hidden on desktop) */
.apt-chips__toggle {
    display: none;
}

@media (max-width: 767px) {
    .apt-chips__toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 8px;
        width: 100%;
        padding: 14px 16px;
        border: 0;
        border-radius: var(--apt-radius);
        background: var(--apt-bar-bg, var(--apt-card-bg));
        color: var(--apt-bar-text, var(--apt-primary));
        font: inherit;
        font-weight: 700;
        text-align: left;
        cursor: pointer;
    }

    .apt-chips__arrow {
        flex: 0 0 auto;
        transition: transform 0.2s;
    }

    .apt-chips.is-open .apt-chips__arrow {
        transform: rotate(180deg);
    }

    .apt-chips .apt-scroller {
        display: none;
        flex-direction: column;
        align-items: stretch;
        overflow: visible;
        gap: 4px;
        margin-top: 6px;
        padding: 4px 0;
    }

    .apt-chips.is-open .apt-scroller {
        display: flex;
    }

    .apt-chips .apt-chip {
        width: 100%;
        white-space: normal;
        padding: 12px 16px;
    }

    .apt-chips--bar .apt-chip {
        padding: 12px 16px;
    }

    .apt-chips--bar .apt-chip--last {
        margin-left: 0;
        padding-left: 16px;
        border-left: 0;
        border-top: 1px solid var(--apt-bar-divider);
    }
}

