/**
 * NDX Affiliate – Frontend Styles
 * Covers all block types + 5 templates + 5 color themes
 */

/* ============================================================
   CSS Custom Properties / Tokens
   ============================================================ */
:root {
    --ndxa-primary:    #FF9900;
    --ndxa-primary-dk: #e68900;
    --ndxa-accent:     #232F3E;
    --ndxa-text:       #1a1a1a;
    --ndxa-text-muted: #666;
    --ndxa-bg:         #ffffff;
    --ndxa-bg-alt:     #f8f9fa;
    --ndxa-border:     #e2e4e7;
    --ndxa-radius:     10px;
    --ndxa-shadow:     0 2px 12px rgba(0,0,0,.10);
    --ndxa-shadow-lg:  0 8px 32px rgba(0,0,0,.15);
    --ndxa-btn-bg:     #FF9900;
    --ndxa-btn-color:  #000000;
    --ndxa-transition: 0.2s ease;
    --ndxa-font-size:  15px;
}

/* ============================================================
   Base reset for all blocks
   ============================================================ */
.ndxa-product-box,
.ndxa-product-list,
.ndxa-comparison-table,
.ndxa-bestseller,
.ndxa-text-link {
    box-sizing: border-box;
    font-family: inherit;
    line-height: 1.5;
    color: var(--ndxa-text);
    font-size: var(--ndxa-font-size);
}

.ndxa-product-box *,
.ndxa-product-list *,
.ndxa-comparison-table *,
.ndxa-bestseller * {
    box-sizing: border-box;
}

/* ============================================================
   PRODUCT BOX – Base
   ============================================================ */
.ndxa-product-box {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    background: var(--ndxa-bg);
    border: 1px solid var(--ndxa-border);
    border-radius: var(--ndxa-radius);
    padding: 20px;
    box-shadow: var(--ndxa-shadow);
    margin: 1.5em 0;
    overflow: hidden;
    position: relative;
}

.ndxa-product-box__image-wrap {
    flex: 0 0 220px;
    max-width: 220px;
    position: relative;
    align-self: flex-start;
}

.ndxa-product-box__img-link {
    display: block;
    text-decoration: none;
}

.ndxa-product-box__image {
    width: 100%;
    height: auto;
    object-fit: contain;
    max-height: 280px;
    display: block;
    transition: transform var(--ndxa-transition);
}

.ndxa-product-box__image:hover {
    transform: scale(1.04);
}

.ndxa-product-box__content {
    flex: 1 1 280px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ndxa-product-box__brand {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ndxa-text-muted);
    margin: 0;
}

.ndxa-product-box__title {
    font-size: 1.15em;
    font-weight: 700;
    line-height: 1.3;
    margin: 0;
}

.ndxa-product-box__title a {
    color: var(--ndxa-text);
    text-decoration: none;
    transition: color var(--ndxa-transition);
}

.ndxa-product-box__title a:hover {
    color: var(--ndxa-primary);
}

.ndxa-product-box__description {
    font-size: 0.9em;
    color: var(--ndxa-text-muted);
    margin: 0;
}

.ndxa-product-box__features {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.ndxa-product-box__feature-item {
    padding-left: 18px;
    position: relative;
    font-size: 0.88em;
    color: var(--ndxa-text-muted);
    line-height: 1.4;
}

.ndxa-product-box__feature-item::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--ndxa-primary);
    font-weight: 700;
}

.ndxa-product-box__footer {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px solid var(--ndxa-border);
}

/* ============================================================
   Pricing
   ============================================================ */
.ndxa-product-box__pricing {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.ndxa-price {
    font-weight: 700;
}

.ndxa-price--current {
    font-size: 1.35em;
    color: var(--ndxa-primary);
}

.ndxa-price--original {
    font-size: 0.9em;
    color: var(--ndxa-text-muted);
    text-decoration: line-through;
}

/* ============================================================
   Buttons
   ============================================================ */
.ndxa-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.9em;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: filter var(--ndxa-transition), transform var(--ndxa-transition), box-shadow var(--ndxa-transition);
    white-space: nowrap;
    background: var(--ndxa-btn-bg);
    color: var(--ndxa-btn-color);
    box-shadow: 0 2px 6px rgba(0,0,0,.15);
}

.ndxa-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0,0,0,.2);
}

.ndxa-btn:active {
    transform: translateY(0);
}

.ndxa-btn--sm {
    padding: 7px 14px;
    font-size: 0.82em;
}

.ndxa-btn__arrow {
    flex-shrink: 0;
    transition: transform var(--ndxa-transition);
}

.ndxa-btn:hover .ndxa-btn__arrow {
    transform: translateX(3px);
}

/* ============================================================
   Badges
   ============================================================ */
.ndxa-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.ndxa-badge--discount {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #e02020;
    color: #fff;
}

.ndxa-badge--best {
    background: var(--ndxa-primary);
    color: #000;
    display: block;
    text-align: center;
    margin-bottom: 6px;
    border-radius: 4px;
}

.ndxa-prime-badge svg {
    vertical-align: middle;
    display: inline-block;
}

.ndxa-prime-badge-sm {
    display: inline-block;
    background: #00A8E0;
    color: #fff;
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 3px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

/* ============================================================
   Disclosure
   ============================================================ */
.ndxa-disclosure {
    font-size: 11px;
    color: var(--ndxa-text-muted);
    margin: 8px 0 0;
    font-style: italic;
    width: 100%;
}

/* ============================================================
   TEMPLATE: Standard (default — flex horizontal)
   ============================================================ */
.ndxa-product-box--standard {
    /* base styles already horizontal */
}

/* ============================================================
   TEMPLATE: Compact
   ============================================================ */
.ndxa-product-box--compact {
    flex-direction: column;
    padding: 14px;
    gap: 12px;
}

.ndxa-product-box--compact .ndxa-product-box__image-wrap {
    flex: none;
    max-width: 140px;
    margin: 0 auto;
}

.ndxa-product-box--compact .ndxa-product-box__title {
    font-size: 0.95em;
}

.ndxa-product-box--compact .ndxa-price--current {
    font-size: 1.1em;
}

/* ============================================================
   TEMPLATE: Wide
   ============================================================ */
.ndxa-product-box--wide {
    flex-direction: column;
    padding: 0;
    gap: 0;
    border-radius: var(--ndxa-radius);
    overflow: hidden;
}

.ndxa-product-box--wide .ndxa-product-box__image-wrap {
    flex: none;
    max-width: 100%;
    width: 100%;
    max-height: 340px;
    overflow: hidden;
    background: var(--ndxa-bg-alt);
}

.ndxa-product-box--wide .ndxa-product-box__image {
    width: 100%;
    max-height: 340px;
    object-fit: contain;
}

.ndxa-product-box--wide .ndxa-product-box__content {
    padding: 24px;
    flex: 1 1 auto;
}

/* ============================================================
   TEMPLATE: Card
   ============================================================ */
.ndxa-product-box--card {
    flex-direction: column;
    padding: 0;
    gap: 0;
    border-radius: 14px;
    box-shadow: var(--ndxa-shadow-lg);
    border: none;
    max-width: 360px;
    margin-left: auto;
    margin-right: auto;
}

.ndxa-product-box--card .ndxa-product-box__image-wrap {
    flex: none;
    max-width: 100%;
    background: var(--ndxa-bg-alt);
    padding: 20px;
    border-radius: 14px 14px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 220px;
}

.ndxa-product-box--card .ndxa-product-box__image {
    max-height: 200px;
    object-fit: contain;
}

.ndxa-product-box--card .ndxa-product-box__content {
    padding: 20px;
}

/* ============================================================
   TEMPLATE: Minimal
   ============================================================ */
.ndxa-product-box--minimal {
    border: none;
    box-shadow: none;
    background: transparent;
    padding: 12px 0;
    border-bottom: 1px solid var(--ndxa-border);
    border-radius: 0;
}

.ndxa-product-box--minimal .ndxa-product-box__image-wrap {
    flex: 0 0 80px;
    max-width: 80px;
}

.ndxa-product-box--minimal .ndxa-product-box__image {
    max-height: 80px;
}

.ndxa-product-box--minimal .ndxa-product-box__features {
    display: none;
}

/* ============================================================
   Image position variants
   ============================================================ */
.ndxa-product-box--img-right .ndxa-product-box__image-wrap {
    order: 2;
}

.ndxa-product-box--img-right .ndxa-product-box__content {
    order: 1;
}

/* ============================================================
   COLOR THEMES
   ============================================================ */

/* Dark */
.ndxa-theme--dark {
    --ndxa-bg:         #1a1a2e;
    --ndxa-bg-alt:     #16213e;
    --ndxa-text:       #e0e0e0;
    --ndxa-text-muted: #a0a0b8;
    --ndxa-border:     #2d2d4a;
    --ndxa-primary:    #FFD700;
    --ndxa-btn-bg:     #FFD700;
    --ndxa-btn-color:  #1a1a2e;
    background: var(--ndxa-bg);
    color: var(--ndxa-text);
    border-color: var(--ndxa-border);
}

.ndxa-theme--dark .ndxa-product-box__title a { color: var(--ndxa-text); }
.ndxa-theme--dark .ndxa-product-box__footer  { border-top-color: var(--ndxa-border); }

/* Elegant */
.ndxa-theme--elegant {
    --ndxa-bg:         #fafafa;
    --ndxa-bg-alt:     #f0f0f0;
    --ndxa-text:       #2c2c2c;
    --ndxa-text-muted: #888;
    --ndxa-border:     #ddd;
    --ndxa-primary:    #555;
    --ndxa-btn-bg:     #2c2c2c;
    --ndxa-btn-color:  #ffffff;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
}

/* Fresh */
.ndxa-theme--fresh {
    --ndxa-primary:    #2ecc71;
    --ndxa-btn-bg:     #2ecc71;
    --ndxa-btn-color:  #ffffff;
    border-top: 4px solid #2ecc71;
}

/* Warm */
.ndxa-theme--warm {
    --ndxa-bg:         #fffdf8;
    --ndxa-primary:    #f39c12;
    --ndxa-btn-bg:     #f39c12;
    --ndxa-btn-color:  #ffffff;
    --ndxa-border:     #f0e0c0;
    border-top: 4px solid #f39c12;
}

/* ============================================================
   PRODUCT LIST – Grid / List / Horizontal
   ============================================================ */
.ndxa-product-list {
    margin: 1.5em 0;
}

.ndxa-product-list--grid {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(var(--ndxa-cols, 3), 1fr);
}

.ndxa-product-list--cols-1 { --ndxa-cols: 1; }
.ndxa-product-list--cols-2 { --ndxa-cols: 2; }
.ndxa-product-list--cols-3 { --ndxa-cols: 3; }
.ndxa-product-list--cols-4 { --ndxa-cols: 4; }
.ndxa-product-list--cols-5 { --ndxa-cols: 5; }
.ndxa-product-list--cols-6 { --ndxa-cols: 6; }

.ndxa-product-list--list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ndxa-product-list--horizontal {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 16px;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
}

.ndxa-product-list--horizontal .ndxa-product-list__item {
    flex: 0 0 220px;
}

/* Product Card */
.ndxa-product-card {
    background: var(--ndxa-bg, #fff);
    border: 1px solid var(--ndxa-border, #e2e4e7);
    border-radius: var(--ndxa-radius, 10px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow var(--ndxa-transition), transform var(--ndxa-transition);
}

.ndxa-product-card:hover {
    box-shadow: var(--ndxa-shadow-lg, 0 8px 32px rgba(0,0,0,.15));
    transform: translateY(-3px);
}

.ndxa-product-card__number {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 28px;
    height: 28px;
    background: var(--ndxa-primary, #FF9900);
    color: #000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    z-index: 2;
}

.ndxa-product-card__img-wrap {
    position: relative;
    background: var(--ndxa-bg-alt, #f8f9fa);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    min-height: 180px;
}

.ndxa-product-card__img {
    max-height: 160px;
    width: auto;
    object-fit: contain;
    transition: transform var(--ndxa-transition);
}

.ndxa-product-card:hover .ndxa-product-card__img {
    transform: scale(1.05);
}

.ndxa-product-card__body {
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.ndxa-product-card__brand {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ndxa-text-muted, #666);
    margin: 0;
}

.ndxa-product-card__title {
    font-size: 0.9em;
    font-weight: 600;
    line-height: 1.3;
    margin: 0;
    flex: 1;
}

.ndxa-product-card__title a {
    color: inherit;
    text-decoration: none;
}

.ndxa-product-card__title a:hover {
    color: var(--ndxa-primary);
}

.ndxa-product-card__price {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

/* ============================================================
   COMPARISON TABLE
   ============================================================ */
.ndxa-comparison-table {
    margin: 1.5em 0;
}

.ndxa-comparison-table__title {
    font-size: 1.4em;
    font-weight: 700;
    margin: 0 0 16px;
    color: var(--ndxa-text, #1a1a1a);
}

.ndxa-comparison-table__scroll-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--ndxa-radius, 10px);
    box-shadow: var(--ndxa-shadow, 0 2px 12px rgba(0,0,0,.10));
}

.ndxa-comparison-table__table {
    width: 100%;
    border-collapse: collapse;
    background: var(--ndxa-bg, #fff);
    min-width: 480px;
}

.ndxa-comparison-table__feature-col {
    width: 160px;
    min-width: 120px;
    background: var(--ndxa-bg-alt, #f8f9fa);
    font-weight: 700;
    font-size: 0.85em;
    padding: 14px 16px;
    text-align: left;
    color: var(--ndxa-text, #1a1a1a);
    border-bottom: 1px solid var(--ndxa-border, #e2e4e7);
}

.ndxa-comparison-table__product-col {
    padding: 16px 14px;
    text-align: center;
    border-bottom: 1px solid var(--ndxa-border, #e2e4e7);
    vertical-align: top;
    background: var(--ndxa-bg, #fff);
    transition: background var(--ndxa-transition);
}

.ndxa-comparison-table__product-col--best {
    background: #fffbf0;
    border-left: 3px solid var(--ndxa-primary, #FF9900);
    border-right: 3px solid var(--ndxa-primary, #FF9900);
}

.ndxa-comparison-table__img {
    width: 90px;
    height: 90px;
    object-fit: contain;
    margin: 0 auto 8px;
    display: block;
}

.ndxa-comparison-table__product-title {
    font-size: 0.82em;
    font-weight: 600;
    line-height: 1.3;
    margin: 0;
}

.ndxa-comparison-table__product-title a {
    color: inherit;
    text-decoration: none;
}

.ndxa-comparison-table__product-title a:hover {
    color: var(--ndxa-primary);
}

.ndxa-comparison-table__label {
    padding: 12px 16px;
    background: var(--ndxa-bg-alt, #f8f9fa);
    font-size: 0.85em;
    font-weight: 600;
    color: var(--ndxa-text-muted, #666);
    border-bottom: 1px solid var(--ndxa-border, #e2e4e7);
}

.ndxa-comparison-table__value {
    padding: 12px 14px;
    text-align: center;
    font-size: 0.88em;
    border-bottom: 1px solid var(--ndxa-border, #e2e4e7);
    vertical-align: middle;
}

.ndxa-comparison-table__value--best {
    background: #fffbf0;
    border-left: 3px solid var(--ndxa-primary, #FF9900);
    border-right: 3px solid var(--ndxa-primary, #FF9900);
    font-weight: 600;
}

.ndxa-comparison-table__row--price .ndxa-comparison-table__value {
    background: var(--ndxa-bg-alt, #f8f9fa);
}

.ndxa-comparison-table__row--actions .ndxa-comparison-table__value {
    padding: 16px 14px;
}

.ndxa-check--yes { color: #27ae60; font-size: 1.2em; font-weight: 700; }
.ndxa-check--no  { color: #e02020; font-size: 1.2em; font-weight: 700; }

/* ============================================================
   BESTSELLER LIST
   ============================================================ */
.ndxa-bestseller {
    margin: 1.5em 0;
    background: var(--ndxa-bg, #fff);
    border: 1px solid var(--ndxa-border, #e2e4e7);
    border-radius: var(--ndxa-radius, 10px);
    overflow: hidden;
    box-shadow: var(--ndxa-shadow, 0 2px 12px rgba(0,0,0,.10));
}

.ndxa-bestseller__title {
    background: var(--ndxa-accent, #232F3E);
    color: #fff;
    margin: 0;
    padding: 16px 20px;
    font-size: 1.15em;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ndxa-bestseller__title-icon {
    color: var(--ndxa-primary, #FF9900);
    font-size: 1.2em;
}

.ndxa-bestseller__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ndxa-bestseller__item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--ndxa-border, #e2e4e7);
    transition: background var(--ndxa-transition);
}

.ndxa-bestseller__item:last-child {
    border-bottom: none;
}

.ndxa-bestseller__item:hover {
    background: var(--ndxa-bg-alt, #f8f9fa);
}

.ndxa-bestseller__rank {
    flex: 0 0 36px;
    text-align: center;
    font-size: 1.4em;
    line-height: 1;
}

.ndxa-bestseller__img-link {
    flex: 0 0 60px;
    display: block;
}

.ndxa-bestseller__img {
    width: 60px;
    height: 60px;
    object-fit: contain;
}

.ndxa-bestseller__info {
    flex: 1;
    min-width: 0;
}

.ndxa-bestseller__brand {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--ndxa-text-muted, #666);
    margin: 0 0 3px;
}

.ndxa-bestseller__product-title {
    font-size: 0.88em;
    font-weight: 600;
    margin: 0 0 4px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ndxa-bestseller__product-title a {
    color: inherit;
    text-decoration: none;
}

.ndxa-bestseller__product-title a:hover {
    color: var(--ndxa-primary);
}

.ndxa-bestseller__price {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ============================================================
   TEXT LINK
   ============================================================ */
.ndxa-text-link {
    color: var(--ndxa-primary, #FF9900);
    text-decoration: underline;
    font-weight: 600;
    transition: color var(--ndxa-transition);
}

.ndxa-text-link:hover {
    color: var(--ndxa-primary-dk, #e68900);
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.ndxa-empty-block {
    padding: 24px;
    text-align: center;
    color: var(--ndxa-text-muted, #666);
    border: 1px dashed var(--ndxa-border, #e2e4e7);
    border-radius: var(--ndxa-radius, 10px);
    margin: 1.5em 0;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
    .ndxa-product-box {
        flex-direction: column;
    }

    .ndxa-product-box__image-wrap {
        flex: none;
        max-width: 160px;
        margin: 0 auto;
    }

    .ndxa-product-box--img-right .ndxa-product-box__image-wrap,
    .ndxa-product-box--img-right .ndxa-product-box__content {
        order: unset;
    }

    .ndxa-product-list--grid {
        grid-template-columns: repeat(min(var(--ndxa-cols, 3), 2), 1fr);
    }

    .ndxa-comparison-table__feature-col,
    .ndxa-comparison-table__product-col {
        min-width: 120px;
    }

    .ndxa-bestseller__item {
        flex-wrap: wrap;
    }

    .ndxa-bestseller__item .ndxa-btn {
        width: 100%;
        justify-content: center;
        margin-top: 6px;
    }
}

@media (max-width: 480px) {
    .ndxa-product-list--grid {
        grid-template-columns: 1fr;
    }

    .ndxa-bestseller__product-title {
        white-space: normal;
    }
}

/* ============================================================
   Dark theme: comparison table
   ============================================================ */
.ndxa-theme--dark .ndxa-comparison-table__table,
.ndxa-theme--dark .ndxa-comparison-table__label,
.ndxa-theme--dark .ndxa-comparison-table__feature-col,
.ndxa-theme--dark .ndxa-comparison-table__product-col,
.ndxa-theme--dark .ndxa-comparison-table__value {
    background: var(--ndxa-bg);
    color: var(--ndxa-text);
    border-color: var(--ndxa-border);
}

.ndxa-theme--dark .ndxa-bestseller {
    background: var(--ndxa-bg);
    border-color: var(--ndxa-border);
}

.ndxa-theme--dark .ndxa-bestseller__item:hover {
    background: var(--ndxa-bg-alt);
}

/* ============================================================
   Disclosure / Accessibility
   ============================================================ */
.ndxa-disclosure--list {
    grid-column: 1 / -1;
    padding-top: 8px;
    border-top: 1px solid var(--ndxa-border, #e2e4e7);
}

/* ============================================================
   Print
   ============================================================ */
@media print {
    .ndxa-btn { display: none !important; }
    .ndxa-product-box { box-shadow: none; border: 1px solid #ccc; }
}
