﻿/* Contenitore generale - Default Values */
.affiamsh-amazon-products {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    padding: 20px;
    background-color: #f9f9f9;
    border-radius: 10px;
    
    /* CSS Variables per temi - Default SLATE */
    --affiamsh-text:  #334155 !important;
    --affiamsh-title: #0f172a !important;
    --affiamsh-price: #0ea5e9 !important;
    --affiamsh-bg: #ffffff !important;
    --affiamsh-bg-hover: #f1f5f9 !important;
    --affiamsh-border: #cbd5e1 !important;
}

/* Stile per ogni prodotto */
.affiamsh-amazon-product {
    text-align: center;
    padding: 15px;
    background-color: var(--affiamsh-bg) !important;
    border: 1px solid var(--affiamsh-border) !important;
    border-radius: 8px;
    transition: transform 0.2s, box-shadow 0.2s, background-color 0.2s;
    color: var(--affiamsh-text) !important;
    position: relative;
    align-items:center!important;
}

.affiamsh-amazon-product a {
    text-decoration: none !important;
    color: inherit !important;
}

/* Effetto hover */
.affiamsh-amazon-product:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    background-color: var(--affiamsh-bg-hover, #f8fafc)!important;
}

/* Immagine del prodotto */
.affiamsh-amazon-product-image {
    max-width: 100%;
    border-radius: 4px;
    margin-bottom: 10px;
    display: block;
}

/* Titolo del prodotto */
.affiamsh-amazon-product-title {
    font-weight: bold;
    margin: 10px 0;
    color: var(--affiamsh-title) !important;
    line-height: 1.4;
}

.affiamsh-amazon-product-title a {
    text-decoration: none;
    color: inherit !important;
}

/* Prezzo */
.affiamsh-amazon-product-price {
    color: var(--affiamsh-price) !important;
}

/* Ticket tag per lo sconto accanto al prezzo */
.affiamsh-amazon-product-price .affiamsh-badge-off{
  position: relative;
  display: inline-block;
  padding: 2px 12px 2px 16px;
  border: 1px dashed #fda4af;     /* bordo tratteggiato */
  background: var(--affiamsh-discount-bg, #fff1f2);
  color: var(--affiamsh-discount-fg, #be123c);
  border-color: currentColor; /* segue il colore del testo */
  font-weight: 700;
  font-size: 0.9em;
  border-radius: 6px;
  vertical-align: baseline;
  margin-right: 8px;               /* spazio prima del prezzo */
  line-height: 1.1;
}

/* “Notch” (taglio) a sinistra */
.affiamsh-amazon-product-price .affiamsh-badge-off::before{
  content: "";
  position: absolute;
  left: -6px;
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
  width: 12px;
  height: 12px;
  background: #fff;                /* metti il colore di sfondo del contenitore se non è bianco */
  border-left: 1px dashed currentColor;
  border-top: 1px dashed currentColor;
  border-bottom-left-radius: 3px;
}

/* (opzionale) una piccola freccia verso il basso prima del testo */
.affiamsh-amazon-product-price .affiamsh-badge-off::after{
  content: "↘︎";
  margin-left: 6px;
  font-weight: 700;
  opacity: .9;
}



/* === TEMPLATE VARIANTS === */

/* CARD Template (default) */
.affiamsh-amazon-products.template-card {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.affiamsh-amazon-products.template-card .affiamsh-amazon-product {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 15px;
}

.affiamsh-amazon-products.template-card .affiamsh-amazon-product-image {
    flex-grow: 1;
    object-fit: contain;
}

/* COMPACT Template */
.affiamsh-amazon-products.template-compact {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    padding: 15px;
}

.affiamsh-amazon-products.template-compact .affiamsh-amazon-product {
    padding: 10px;
    border-radius: 6px;
    border: 1px solid var(--affiamsh-border);
}

.affiamsh-amazon-products.template-compact .affiamsh-amazon-product-image {
    margin-bottom: 8px;
    max-height: 150px;
}

.affiamsh-amazon-products.template-compact .affiamsh-amazon-product-title {
    font-size: 0.9em;
    margin: 8px 0;
}

/* LIST Template */




.affiamsh-amazon-products.template-list .affiamsh-amazon-product-image {
    grid-column: 1;
    max-height: 120px;
    max-width: 120px;
    margin: 0;
}

.affiamsh-amazon-products.template-list .affiamsh-amazon-product a {
    display: flex;
    align-items: center;
    grid-column: 1 / 2;
    grid-row: 1;
}

.affiamsh-amazon-products.template-list .affiamsh-amazon-product-title {
    grid-column: 2;
    grid-row: 1;
    margin: 0;
    text-align: left;
}

/* === THEME PRESETS === */

/* Slate Theme (default) */
.affiamsh-amazon-products.affiamsh-theme-slate {
    --affiamsh-text: #334155 !important;
    --affiamsh-title: #0f172a !important;
    --affiamsh-price: #0ea5e9 !important;
    --affiamsh-bg: #ffffff !important;
    --affiamsh-bg-hover: #f1f5f9 !important;
    --affiamsh-border: #cbd5e1 !important;
}

/* Blue Theme */
.affiamsh-amazon-products.affiamsh-theme-blue {
    --affiamsh-text: #1f2937 !important;
    --affiamsh-title: #0b1324 !important;
    --affiamsh-price: #2563eb !important;
    --affiamsh-bg: #eff6ff !important;
    --affiamsh-bg-hover: #dbeafe !important;
    --affiamsh-border: #bfdbfe !important;
}

/* Emerald Theme */
.affiamsh-amazon-products.affiamsh-theme-emerald {
    --affiamsh-text: #064e3b !important;
    --affiamsh-title: #022c22 !important;
    --affiamsh-price: #059669 !important;
    --affiamsh-bg: #f0fdf4 !important;
    --affiamsh-bg-hover: #dcfce7 !important;
    --affiamsh-border: #bbf7d0 !important;
}

/* Amber Theme */
.affiamsh-amazon-products.affiamsh-theme-amber {
    --affiamsh-text: #78350f !important;
    --affiamsh-title: #451a03 !important;
    --affiamsh-price: #d97706 !important;
    --affiamsh-bg: #fffbeb !important;
    --affiamsh-bg-hover: #fef3c7 !important;
    --affiamsh-border: #fcd34d !important;
}

/* Rose Theme */
.affiamsh-amazon-products.affiamsh-theme-rose {
    --affiamsh-text: #881337 !important;
    --affiamsh-title: #4c0519 !important;
    --affiamsh-price: #e11d48 !important;
    --affiamsh-bg: #fff1f2 !important;
    --affiamsh-bg-hover: #ffe4e6 !important;
    --affiamsh-border: #fbcfe8 !important;
}

/* Violet Theme */
.affiamsh-amazon-products.affiamsh-theme-violet {
    --affiamsh-text: #3b0764 !important;
    --affiamsh-title: #1e1b4b !important;
    --affiamsh-price: #7c3aed !important;
    --affiamsh-bg: #faf5ff !important;
    --affiamsh-bg-hover: #f3e8ff !important;
    --affiamsh-border: #e9d5ff !important;
}

/* Indigo Theme */
.affiamsh-amazon-products.affiamsh-theme-indigo {
    --affiamsh-text: #111827 !important;
    --affiamsh-title: #111827 !important;
    --affiamsh-price: #4f46e5 !important;
    --affiamsh-bg: #eef2ff !important;
    --affiamsh-bg-hover: #e0e7ff !important;
    --affiamsh-border: #c7d2fe !important;
}

/* Teal Theme */
.affiamsh-amazon-products.affiamsh-theme-teal {
    --affiamsh-text: #0f766e !important;
    --affiamsh-title: #134e4a !important;
    --affiamsh-price: #14b8a6 !important;
    --affiamsh-bg: #f0fdfa !important;
    --affiamsh-bg-hover: #ccfbf1 !important;
    --affiamsh-border: #99f6e4 !important;
}

/* Zinc Theme */
.affiamsh-amazon-products.affiamsh-theme-zinc {
    --affiamsh-text: #3f3f46 !important;
    --affiamsh-title: #18181b !important;
    --affiamsh-price: #71717a !important;
    --affiamsh-bg: #fafafa !important;
    --affiamsh-bg-hover: #f4f4f5 !important;
    --affiamsh-border: #e4e4e7 !important;
}

/* Custom Theme - Usa i valori inline da PHP */
.affiamsh-amazon-products.affiamsh-theme-custom {
    /* I colori vengono impostati inline dal PHP */
}

/* === WATERMARK (FREE VERSION) === */
.affiamsh-watermark {
    position: absolute;
    left: 8px;
    bottom: 2px;
    font-size: 13px;
    line-height: 1;
    background: rgba(0, 0, 0, 0.05);
    padding: 3px 6px;
    border-radius: 4px;
    color: #4b5563;
    pointer-events: none;
    z-index: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .affiamsh-amazon-products {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 15px;
        padding: 15px;
    }

    

    .affiamsh-amazon-products.template-list .affiamsh-amazon-product-image {
        max-width: 100px;
        max-height: 100px;
    }
}

@media (max-width: 480px) {
    .affiamsh-amazon-products {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 10px;
        padding: 10px;
    }

    

    .affiamsh-amazon-products.template-list .affiamsh-amazon-product-image {
        grid-column: 1;
        max-height: 150px;
    }

    .affiamsh-amazon-product-title {
        font-size: 0.9em;
    }
}

/* Center product image in Card template */
.affiamsh-amazon-products.template-card .affiamsh-amazon-product-image{
    display:block;
    margin: 0 auto;
    max-height: 220px;
    width: auto;
    object-fit: contain;
}


/* List template: one item per row (no grid on container) */
.affiamsh-amazon-products.template-list{
    display:block !important;
}
.affiamsh-amazon-products.template-list .affiamsh-amazon-product{
    display:flex;
    align-items:flex-start;
    gap:14px;
    text-align:left;
    padding:12px 8px;
    border-radius:8px;
    margin-bottom:12px;
}
.affiamsh-amazon-products.template-list .affiamsh-amazon-product-image{
    width:120px;
    max-height:120px;
    object-fit:contain;
    flex:0 0 120px;
    margin:0;
}
.affiamsh-amazon-products.template-list .affiamsh-amazon-cta{
    align-self:flex-start;
}
