/* ============================================================
   AFFARINORO QUOTAZIONI — CSS v2.1
   Tema blu / stile orofirst.it
   ============================================================ */

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

.afn-quotazioni-wrap {
    --afn-gold:         #f5c842;
    --afn-gold-dark:    #d4a820;
    --afn-silver-accent:#a8c4e0;
    --afn-silver-btn:   #6c8fad;
    --afn-text:         #ffffff;
    --afn-text-muted:   rgba(255,255,255,0.45);
    --afn-surface:      rgba(255,255,255,0.07);
    --afn-surface-h:    rgba(255,255,255,0.13);
    --afn-border:       rgba(255,255,255,0.15);
    --afn-radius-sm:    10px;

    font-family: 'Poppins', sans-serif;
    background: linear-gradient(155deg, #1b3d7a 0%, #0f2547 55%, #162f65 100%);
    border-radius: 20px;
    overflow: hidden;
    max-width: 860px;
    margin: 0 auto;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.10), 0 30px 80px rgba(10,20,60,0.55);
}

/* ── Metal blocks ─────────────────────────── */
.afn-metal-block       { padding: 28px 32px 24px; }
.afn-gold-block        { border-bottom: 1px solid rgba(255,255,255,0.10); }

/* ── Header ───────────────────────────────── */
.afn-metal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}
.afn-metal-title {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 0.12em;
    display: flex;
    align-items: center;
    gap: 9px;
    color: #fff;
    text-transform: uppercase;
}
.afn-gold-title   .afn-metal-icon { color: var(--afn-gold); }
.afn-silver-title .afn-metal-icon { color: var(--afn-silver-accent); }

/* ── Spot badge ───────────────────────────── */
.afn-spot-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 500;
    background: rgba(255,255,255,0.10);
    border: 1px solid rgba(255,255,255,0.20);
    color: rgba(255,255,255,0.75);
}
.afn-spot-icon { font-size: 9px; opacity: 0.7; }
.afn-spot-karat {
    background: rgba(255,255,255,0.15);
    border-radius: 20px;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
}
.afn-gold-spot   .afn-spot-price { color: var(--afn-gold); font-weight: 700; font-size: 13px; }
.afn-silver-spot .afn-spot-price { color: var(--afn-silver-accent); font-weight: 700; font-size: 13px; }

/* ── Karat cards ──────────────────────────── */
.afn-karats-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 22px;
}
.afn-karat-card {
    flex: 1 1 120px;
    min-width: 90px;
    padding: 12px 14px;
    border-radius: var(--afn-radius-sm);
    cursor: pointer;
    text-align: center;
    transition: all 0.20s cubic-bezier(0.34,1.56,0.64,1);
    background: var(--afn-surface);
    border: 1px solid var(--afn-border);
    color: #fff;
}
.afn-karat-card:hover {
    background: var(--afn-surface-h);
    border-color: rgba(255,255,255,0.45);
    transform: translateY(-2px);
}
.afn-gold-block .afn-karat-card.afn-active {
    background: rgba(245,200,66,0.15);
    border-color: var(--afn-gold);
    box-shadow: 0 0 0 1px var(--afn-gold), 0 6px 20px rgba(245,200,66,0.20);
    transform: translateY(-2px);
}
.afn-gold-block .afn-karat-card.afn-active .afn-karat-price,
.afn-gold-block .afn-karat-card.afn-active .afn-karat-label { color: var(--afn-gold); opacity: 1; }

.afn-silver-block .afn-karat-card.afn-active {
    background: rgba(168,196,224,0.15);
    border-color: var(--afn-silver-accent);
    box-shadow: 0 0 0 1px var(--afn-silver-accent), 0 6px 20px rgba(168,196,224,0.20);
    transform: translateY(-2px);
}
.afn-silver-block .afn-karat-card.afn-active .afn-karat-price,
.afn-silver-block .afn-karat-card.afn-active .afn-karat-label { color: var(--afn-silver-accent); opacity: 1; }

.afn-karat-price { font-size: 14px; font-weight: 600; margin-bottom: 5px; white-space: nowrap; }
.afn-karat-label { font-size: 11px; font-weight: 500; letter-spacing: 0.06em; opacity: 0.55; text-transform: uppercase; }

/* ── Calculator ───────────────────────────── */
.afn-calculator {
    display: flex;
    align-items: stretch;
    border-radius: var(--afn-radius-sm);
    overflow: hidden;
    height: 58px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.afn-calc-input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 18px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-right: none;
    border-radius: var(--afn-radius-sm) 0 0 var(--afn-radius-sm);
    min-width: 140px;
    flex: 0 0 auto;
}
.afn-gram-input {
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    font-family: 'Poppins', sans-serif;
    font-size: 22px;
    font-weight: 600;
    width: 70px;
    -moz-appearance: textfield;
}
.afn-gram-input::-webkit-outer-spin-button,
.afn-gram-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.afn-gram-unit { color: rgba(255,255,255,0.5); font-size: 14px; }
.afn-arrows    { color: rgba(255,255,255,0.4); font-size: 16px; }

.afn-calc-total {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 22px;
    gap: 6px;
    flex: 1;
    background: rgba(255,255,255,0.06);
    border-top: 1px solid rgba(255,255,255,0.12);
    border-bottom: 1px solid rgba(255,255,255,0.12);
}
.afn-total-value {
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    transition: all 0.25s ease;
}
.afn-total-currency {
    font-size: 18px;
    font-weight: 600;
    color: rgba(255,255,255,0.6);
    align-self: flex-end;
    padding-bottom: 4px;
}

/* CTA */
.afn-blocca-btn {
    border: none;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0 24px;
    transition: all 0.2s ease;
    white-space: nowrap;
    border-radius: 0 var(--afn-radius-sm) var(--afn-radius-sm) 0;
    position: relative;
    overflow: hidden;
}
.afn-gold-btn {
    background: linear-gradient(135deg, #f5c842 0%, #ffd85c 50%, #d4a820 100%);
    color: #1a1200;
}
.afn-gold-btn:hover {
    background: linear-gradient(135deg, #ffd85c 0%, #ffe880 50%, #f5c842 100%);
    box-shadow: 0 0 24px rgba(245,200,66,0.5);
    transform: scale(1.02);
}
.afn-silver-btn {
    background: linear-gradient(135deg, #6c8fad 0%, #8aadcc 50%, #4e7390 100%);
    color: #fff;
}
.afn-silver-btn:hover {
    background: linear-gradient(135deg, #8aadcc 0%, #a8c8e8 50%, #6c8fad 100%);
    box-shadow: 0 0 24px rgba(108,143,173,0.45);
    transform: scale(1.02);
}
.afn-blocca-btn:active { transform: scale(0.98); }

/* shimmer */
.afn-blocca-btn::after {
    content: '';
    position: absolute;
    top: -50%; left: -75%;
    width: 50%; height: 200%;
    background: linear-gradient(to right, rgba(255,255,255,0) 0%, rgba(255,255,255,0.28) 50%, rgba(255,255,255,0) 100%);
    transform: skewX(-20deg);
    transition: left 0.5s ease;
}
.afn-blocca-btn:hover::after { left: 130%; }

/* flash */
@keyframes afn-flash {
    0%   { color: #fff; }
    30%  { color: var(--afn-gold); text-shadow: 0 0 16px rgba(245,200,66,0.5); }
    100% { color: #fff; }
}
.afn-total-value.afn-flash { animation: afn-flash 0.55s ease; }

/* ── Footer ───────────────────────────────── */
.afn-footer-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 11px 32px;
    background: rgba(0,0,0,0.20);
    border-top: 1px solid rgba(255,255,255,0.08);
    font-size: 11px;
    font-weight: 500;
    color: var(--afn-text-muted);
    letter-spacing: 0.03em;
}
.afn-live-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: #4cdb6e;
    flex-shrink: 0;
    animation: afn-pulse-dot 2s ease-in-out infinite;
}
@keyframes afn-pulse-dot {
    0%, 100% { opacity:1; box-shadow: 0 0 0 0 rgba(76,219,110,0.6); }
    50%       { opacity:0.7; box-shadow: 0 0 0 5px rgba(76,219,110,0); }
}
.afn-live-label  { flex:1; color: rgba(255,255,255,0.5); }
.afn-last-update { color: rgba(255,255,255,0.45); }
.afn-last-update strong { color: rgba(255,255,255,0.85); }

/* ── Error ────────────────────────────────── */
.afn-error-banner {
    background: rgba(220,53,69,0.15);
    border: 1px solid rgba(220,53,69,0.35);
    color: #ff8a95;
    padding: 12px 32px;
    font-size: 13px;
    text-align: center;
}

/* ── Compact ──────────────────────────────── */
.afn-compact .afn-metal-block { padding: 18px 20px 16px; }
.afn-compact .afn-metal-title { font-size: 17px; }
.afn-compact .afn-karat-card  { min-width: 70px; padding: 8px 10px; }
.afn-compact .afn-karat-price { font-size: 12px; }
.afn-compact .afn-calculator  { height: 50px; }
.afn-compact .afn-total-value { font-size: 22px; }
.afn-compact .afn-footer-bar  { padding: 9px 20px; }

/* ── Responsive ───────────────────────────── */
@media (max-width: 640px) {
    .afn-metal-block  { padding: 20px 16px 16px; }
    .afn-metal-header { flex-direction: column; align-items: flex-start; }
    .afn-karat-card   { flex: 1 1 calc(33% - 8px); min-width: 80px; }
    .afn-calculator   { flex-wrap: wrap; height: auto; }
    .afn-calc-input-wrap {
        width: 100%;
        border-right: 1px solid rgba(255,255,255,0.15);
        border-bottom: none;
        border-radius: var(--afn-radius-sm) var(--afn-radius-sm) 0 0;
        padding: 12px 18px;
        min-width: unset;
        flex: unset;
    }
    .afn-calc-total { flex:1; padding: 12px 16px; min-height: 52px; }
    .afn-blocca-btn {
        width: 100%; padding: 14px;
        border-radius: 0 0 var(--afn-radius-sm) var(--afn-radius-sm);
        font-size: 13px;
    }
    .afn-footer-bar  { padding: 10px 16px; flex-wrap: wrap; }
    .afn-total-value { font-size: 24px; }
}
@media (max-width: 400px) {
    .afn-karat-card { flex: 1 1 calc(50% - 8px); }
}
