/* ================================================================
 * Gigafix Card Tracker — Frontend
 * Aesthetic: clean modern, coerente con titoli del sito
 * Display + Body: Poppins (rounded geometric sans)
 * ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&display=swap');

.gct-card-widget,
.gct-card-widget * {
    box-sizing: border-box;
}

.gct-widget {
    --gct-bg: #fafaf7;
    --gct-bg-card: #ffffff;
    --gct-ink: #0f1e3d;
    --gct-ink-soft: #334466;
    --gct-ink-muted: #6b7a99;
    --gct-line: #e5e9f0;
    --gct-line-soft: #f4f6fa;
    --gct-accent: #0f1e3d;
    --gct-foil: #b8954b;
    --gct-foil-soft: #f7f0db;
    --gct-up: #16a34a;
    --gct-up-soft: #ecfdf5;
    --gct-down: #dc2626;
    --gct-down-soft: #fef2f2;
    --gct-flat: #64748b;
    --gct-flat-soft: #f1f5f9;
    --gct-radius: 16px;
    --gct-radius-sm: 10px;

    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--gct-bg-card);
    border: 1px solid var(--gct-line);
    border-radius: var(--gct-radius);
    padding: 28px;
    margin: 24px 0;
    color: var(--gct-ink);
    position: relative;
    overflow: hidden;
}

/* texture sottile sul background */
.gct-widget::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 1px 1px, rgba(0,0,0,0.025) 1px, transparent 0);
    background-size: 18px 18px;
    pointer-events: none;
    opacity: 0.5;
}

.gct-widget > * {
    position: relative;
    z-index: 1;
}

/* === LOADING / ERROR STATES === */
.gct-loader {
    padding: 32px 16px;
    text-align: center;
    color: var(--gct-ink-muted);
    font-size: 14px;
    letter-spacing: 0.02em;
}

.gct-loader::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid var(--gct-line);
    border-top-color: var(--gct-ink);
    border-radius: 50%;
    margin-right: 10px;
    vertical-align: -2px;
    animation: gct-spin 0.8s linear infinite;
}

@keyframes gct-spin {
    to { transform: rotate(360deg); }
}

.gct-error {
    padding: 16px 18px;
    color: var(--gct-down);
    background: var(--gct-down-soft);
    border: 1px solid #fecaca;
    border-radius: var(--gct-radius-sm);
    margin: 12px 0;
    font-size: 14px;
}

.gct-empty {
    padding: 18px;
    color: var(--gct-ink-muted);
    background: var(--gct-line-soft);
    border: 1px dashed var(--gct-line);
    border-radius: var(--gct-radius-sm);
    text-align: center;
    margin: 16px 0;
    font-size: 13px;
}

/* === HEADER === */
.gct-header {
    display: flex;
    align-items: flex-start;
    gap: 22px;
    margin-bottom: 28px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--gct-line);
    animation: gct-fadeIn 0.5s ease-out;
}

@keyframes gct-fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

.gct-image-wrap {
    flex-shrink: 0;
    position: relative;
}

.gct-image {
    width: 110px;
    height: auto;
    border-radius: 8px;
    box-shadow:
        0 1px 2px rgba(0,0,0,0.06),
        0 8px 24px -6px rgba(0,0,0,0.18),
        0 0 0 1px rgba(0,0,0,0.04);
    display: block;
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.gct-image-wrap:hover .gct-image {
    transform: translateY(-2px) rotate(-1deg);
}

.gct-image-wrap::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(255,255,255,0.4) 0%, transparent 40%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.gct-image-wrap:hover::after {
    opacity: 1;
}

.gct-image-placeholder {
    width: 110px;
    height: 154px;
    background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    border: 1px dashed #cbd5e1;
}

.gct-image-placeholder svg {
    opacity: 0.6;
}

.gct-info {
    flex: 1;
    min-width: 0;
    padding-top: 4px;
}

.gct-eyebrow {
    font-family: 'Poppins', sans-serif;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--gct-foil);
    margin: 0 0 8px 0;
}

.gct-title {
    font-family: 'Poppins', sans-serif;
    font-weight: 800;
    font-size: 34px;
    line-height: 1;
    color: var(--gct-ink);
    margin: 0 0 14px 0 !important;
    letter-spacing: -0.025em;
}

.gct-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.gct-tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    border-radius: 4px;
    background: var(--gct-line-soft);
    color: var(--gct-ink-soft);
    border: 1px solid var(--gct-line);
    line-height: 1.4;
}

.gct-tag-num {
    font-variant-numeric: tabular-nums;
    background: var(--gct-ink);
    color: #fff;
    border-color: var(--gct-ink);
}

.gct-tag-rarity {
    background: var(--gct-foil-soft);
    color: var(--gct-foil);
    border-color: #e8d9b0;
}

.gct-tag-exp {
    background: transparent;
}

/* === STATS GRID === */
.gct-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr) repeat(2, 1fr);
    gap: 1px;
    background: var(--gct-line);
    border: 1px solid var(--gct-line);
    border-radius: var(--gct-radius-sm);
    overflow: hidden;
    margin-bottom: 28px;
}

.gct-stat {
    background: var(--gct-bg-card);
    padding: 16px 18px;
    transition: background 0.2s;
}

.gct-stat:hover {
    background: var(--gct-line-soft);
}

.gct-stat-min {
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
    grid-column: span 2;
}

.gct-stat-min:hover {
    background: linear-gradient(135deg, #ecfdf5 0%, #dcfce7 100%);
}

.gct-stat-label {
    font-size: 10px;
    color: var(--gct-ink-muted);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    margin-bottom: 6px;
    font-weight: 600;
}

.gct-stat-value {
    font-family: 'Poppins', sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: var(--gct-ink);
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.gct-stat-min .gct-stat-value {
    font-size: 30px;
    font-weight: 800;
    color: var(--gct-up);
}

.gct-stat-min .gct-stat-label {
    color: var(--gct-up);
}

/* === SECTIONS === */
.gct-section {
    margin: 32px 0;
}

.gct-section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 16px;
}

.gct-section-title {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    font-size: 17px;
    color: var(--gct-ink);
    margin: 0 !important;
    letter-spacing: -0.01em;
}

.gct-section-meta {
    font-size: 11px;
    color: var(--gct-ink-muted);
    font-weight: 500;
    letter-spacing: 0.04em;
}

.gct-chart-wrap {
    position: relative;
    height: 280px;
    width: 100%;
    background: var(--gct-bg-card);
    border: 1px solid var(--gct-line);
    border-radius: var(--gct-radius-sm);
    padding: 16px;
}

.gct-chart-small {
    height: 180px;
}

.gct-note {
    font-size: 11px;
    color: var(--gct-ink-muted);
    margin: 10px 0 0 0;
    font-style: italic;
}

/* === PREDICTION === */
.gct-prediction {
    padding: 22px 24px;
    border-radius: var(--gct-radius);
    margin: 32px 0;
    background: var(--gct-flat-soft);
    border: 1px solid var(--gct-line);
    position: relative;
    overflow: hidden;
}

.gct-prediction::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--gct-flat);
}

.gct-trend-rialzo {
    background: linear-gradient(135deg, #ecfdf5 0%, #f0fdf4 100%);
    border-color: #bbf7d0;
}
.gct-trend-rialzo::before { background: var(--gct-up); }

.gct-trend-ribasso {
    background: linear-gradient(135deg, #fef2f2 0%, #fff1f2 100%);
    border-color: #fecaca;
}
.gct-trend-ribasso::before { background: var(--gct-down); }

.gct-trend-stabile {
    background: linear-gradient(135deg, #fafaf9 0%, #f5f5f4 100%);
    border-color: var(--gct-line);
}

.gct-prediction-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
}

.gct-prediction-title {
    font-family: 'Poppins', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: var(--gct-ink);
    margin: 0 !important;
    letter-spacing: -0.01em;
}

.gct-trend-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.gct-trend-rialzo .gct-trend-badge {
    background: var(--gct-up);
    color: #fff;
}
.gct-trend-ribasso .gct-trend-badge {
    background: var(--gct-down);
    color: #fff;
}
.gct-trend-stabile .gct-trend-badge {
    background: var(--gct-flat);
    color: #fff;
}

.gct-pred-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
}

.gct-pred-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.gct-pred-label {
    color: var(--gct-ink-muted);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-weight: 600;
}

.gct-pred-value {
    font-family: 'Poppins', sans-serif;
    font-size: 20px;
    color: var(--gct-ink);
    font-weight: 700;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}

.gct-pred-confidence {
    height: 4px;
    width: 100%;
    background: rgba(0,0,0,0.08);
    border-radius: 999px;
    overflow: hidden;
    margin-top: 4px;
}

.gct-pred-confidence-fill {
    height: 100%;
    background: var(--gct-ink);
    border-radius: 999px;
    transition: width 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.gct-trend-rialzo .gct-pred-confidence-fill { background: var(--gct-up); }
.gct-trend-ribasso .gct-pred-confidence-fill { background: var(--gct-down); }

/* === DISCLAIMER === */
.gct-disclaimer {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--gct-line);
    font-size: 11px;
    color: var(--gct-ink-muted);
    line-height: 1.65;
    font-style: italic;
}

.gct-disclaimer strong {
    color: var(--gct-ink-soft);
    font-style: normal;
    font-weight: 600;
}

/* === RESPONSIVE === */
@media (max-width: 640px) {
    .gct-widget {
        padding: 18px;
        border-radius: 12px;
    }
    .gct-header {
        gap: 14px;
        margin-bottom: 20px;
        padding-bottom: 18px;
    }
    .gct-image {
        width: 78px;
    }
    .gct-title {
        font-size: 22px;
    }
    .gct-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    .gct-stat-min {
        grid-column: span 2;
    }
    .gct-stat-value {
        font-size: 18px;
    }
    .gct-stat-min .gct-stat-value {
        font-size: 22px;
    }
    .gct-chart-wrap {
        height: 220px;
        padding: 10px;
    }
    .gct-prediction {
        padding: 16px;
    }
    .gct-pred-value {
        font-size: 17px;
    }
}

/* =========================================================================
   Mercato + filtri (visualizzazione singola carta)
   ========================================================================= */
.gct-widget .gct-market{ margin-top:22px; }
.gct-widget .gct-market-grid{
  display:grid; grid-template-columns:240px 1fr; gap:18px; align-items:start;
}
@media (max-width:680px){
  .gct-widget .gct-market-grid{ grid-template-columns:1fr; }
}

/* Pannello filtri */
.gct-widget .gct-filters{
  background:var(--gct-bg); border:1px solid var(--gct-line);
  border-radius:var(--gct-radius-sm); padding:14px 16px; align-self:start;
}
.gct-widget .gct-filters-head{
  font-weight:700; font-size:14px; color:var(--gct-ink);
  padding-bottom:10px; margin-bottom:10px; border-bottom:1px solid var(--gct-line);
}
.gct-widget .gct-fblock{ padding:10px 0; border-bottom:1px solid var(--gct-line-soft); }
.gct-widget .gct-fblock:last-of-type{ border-bottom:0; }
.gct-widget .gct-flabel{
  font-weight:700; font-size:12px; letter-spacing:.4px; text-transform:uppercase;
  color:var(--gct-ink-soft); margin-bottom:8px;
}
.gct-widget .gct-price-row{ display:flex; gap:8px; }
.gct-widget .gct-filters input[type=number]{
  width:100%; border:1px solid var(--gct-line); border-radius:8px;
  padding:7px 9px; font-size:13px; background:#fff; color:var(--gct-ink);
  font-family:inherit;
}
.gct-widget .gct-filters input[type=number]:focus{
  outline:none; border-color:var(--gct-foil); box-shadow:0 0 0 3px rgba(184,149,75,.18);
}
.gct-widget .gct-lang-grid{ display:grid; grid-template-columns:1fr 1fr; gap:2px 12px; }
.gct-widget .gct-check{
  display:flex; align-items:center; gap:8px; cursor:pointer;
  font-size:13px; color:var(--gct-ink-soft); padding:3px 0;
}
.gct-widget .gct-check input{ width:15px; height:15px; accent-color:var(--gct-foil); margin:0; }
.gct-widget .gct-check em{ color:var(--gct-ink-muted); font-style:normal; font-size:12px; }
.gct-widget .gct-clear{
  margin-top:12px; width:100%; cursor:pointer;
  background:var(--gct-foil); color:#fff; border:0; border-radius:8px;
  padding:9px 12px; font-weight:700; font-size:13px; font-family:inherit;
  transition:filter .15s ease;
}
.gct-widget .gct-clear:hover{ filter:brightness(1.07); }

/* Lista offerte */
.gct-widget .gct-offers-list{ display:flex; flex-direction:column; gap:8px; }
.gct-widget .gct-offer{
  display:flex; flex-direction:column; gap:6px;
  background:var(--gct-bg-card); border:1px solid var(--gct-line);
  border-radius:var(--gct-radius-sm); padding:10px 14px;
  transition:border-color .15s ease, box-shadow .15s ease;
}
.gct-widget .gct-offer:hover{ border-color:var(--gct-foil); box-shadow:0 2px 10px rgba(15,30,61,.06); }
.gct-widget .gct-offer-top{ display:flex; align-items:center; justify-content:space-between; gap:12px; }
.gct-widget .gct-offer-desc{
  font-size:12px; color:var(--gct-ink-muted); font-style:italic;
  border-top:1px dashed var(--gct-line-soft); padding-top:6px; line-height:1.4;
  word-break:break-word;
}
.gct-widget .gct-offer-main{ display:flex; align-items:baseline; gap:10px; flex-wrap:wrap; min-width:0; }
.gct-widget .gct-offer-price{ font-weight:800; font-size:16px; color:var(--gct-ink); }
.gct-widget .gct-offer-cond{ font-size:13px; color:var(--gct-ink-soft); }
.gct-widget .gct-offer-lang{
  font-size:11px; font-weight:700; letter-spacing:.5px; color:var(--gct-ink-muted);
  border:1px solid var(--gct-line); border-radius:6px; padding:1px 6px;
}
.gct-widget .gct-offer-side{ display:flex; align-items:center; gap:8px; flex-shrink:0; }
.gct-widget .gct-offer-badges{ display:flex; gap:4px; flex-wrap:wrap; justify-content:flex-end; }
.gct-widget .gct-badge{
  font-size:10.5px; font-weight:700; color:#7a5e1f;
  background:var(--gct-foil-soft); border:1px solid #e9dcb6;
  border-radius:6px; padding:1px 6px; white-space:nowrap;
}
.gct-widget .gct-offer-qty{ font-size:13px; font-weight:700; color:var(--gct-ink-soft); }
.gct-widget .gct-offer-country{
  font-size:11px; font-weight:700; color:var(--gct-ink-muted);
  background:var(--gct-line-soft); border-radius:6px; padding:1px 6px;
}

/* Filtro graduazione (radio) */
.gct-widget .gct-graded-row{ display:flex; flex-direction:column; gap:2px; }
.gct-widget .gct-radio{
  display:flex; align-items:center; gap:8px; cursor:pointer;
  font-size:13px; color:var(--gct-ink-soft); padding:3px 0;
}
.gct-widget .gct-radio input{ width:15px; height:15px; accent-color:var(--gct-foil); margin:0; }
.gct-widget .gct-radio em{ color:var(--gct-ink-muted); font-style:normal; font-size:12px; }

/* === CONDIZIONI DISPONIBILI (raw) === */
.gct-conditions {
    margin-bottom: 28px;
}
.gct-cond-list {
    border: 1px solid var(--gct-line);
    border-radius: var(--gct-radius-sm);
    overflow: hidden;
}
.gct-cond-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    background: var(--gct-bg-card);
    border-top: 1px solid var(--gct-line);
}
.gct-cond-row:first-child { border-top: none; }
.gct-cond-row:hover { background: var(--gct-line-soft); }
.gct-cond-name {
    font-weight: 600;
    color: var(--gct-ink);
    font-size: 14px;
}
.gct-cond-qty {
    font-size: 12px;
    color: var(--gct-ink-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.gct-cond-price {
    font-weight: 700;
    color: var(--gct-up);
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    min-width: 80px;
    text-align: right;
    white-space: nowrap;
}
.gct-cond-graded {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}
.gct-cond-graded-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-weight: 700;
    color: var(--gct-foil);
}
.gct-cond-chip {
    font-size: 12px;
    color: var(--gct-ink-soft);
    background: var(--gct-foil-soft);
    border: 1px solid #e8dcc0;
    border-radius: 999px;
    padding: 3px 10px;
    font-variant-numeric: tabular-nums;
}
.gct-cond-chip em { font-style: normal; color: var(--gct-foil); font-weight: 700; }
