/* =====================================================================
   Farmaco Digitale - Identita' grafica su Bootstrap Italia (AGID)
   Componenti AGID + palette/personalizzazione "blu salute".
   ===================================================================== */

:root {
    --fd-primary:      #0B6BB5;   /* blu salute */
    --fd-primary-dark: #075089;
    --fd-accent:       #16B8C7;   /* ciano accento */
    --fd-ink:          #15324a;
    --fd-bg-soft:      #eef6fc;
    --fd-radius:       18px;
    --fd-shadow:       0 10px 34px rgba(11, 107, 181, .14);
    --fd-shadow-hover: 0 16px 44px rgba(11, 107, 181, .22);
}

/* =====================================================================
   Header moderno Farmaco Digitale (sticky, glass, distintivo)
   ===================================================================== */
.fd-topline { height: 4px; background: linear-gradient(90deg, var(--fd-primary), var(--fd-accent)); }

.fd-header {
    position: sticky; top: 0; z-index: 1030;
    background: rgba(255, 255, 255, .88);
    -webkit-backdrop-filter: saturate(180%) blur(10px);
    backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid #e6eef6;
}
.fd-header.is-scrolled { box-shadow: 0 6px 24px rgba(21, 50, 74, .10); }
.fd-header-inner { display: flex; align-items: center; gap: 22px; min-height: 78px; }

.fd-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.fd-brand img { height: 46px; width: auto; }
.fd-brand-text { display: flex; flex-direction: column; justify-content: center; line-height: 1; }
.fd-brand .fd-brand-name {
    font-weight: 800; font-size: 1.3rem; line-height: 1.15; white-space: nowrap; margin-bottom: 2px;
    background: linear-gradient(120deg, var(--fd-primary-dark), var(--fd-accent));
    -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.fd-brand .fd-brand-sub { font-size: .72rem; line-height: 1.2; color: #6b8198; letter-spacing: .3px; white-space: nowrap; }

.fd-nav { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.fd-nav a {
    position: relative; text-decoration: none; color: var(--fd-ink); white-space: nowrap;
    font-weight: 600; font-size: .95rem; padding: 10px 12px; border-radius: 10px;
    transition: color .15s ease, background .15s ease;
}
.fd-nav a:hover { color: var(--fd-primary); background: var(--fd-bg-soft); }
.fd-nav a.active { color: var(--fd-primary); }
.fd-nav a.active::after {
    content: ""; position: absolute; left: 14px; right: 14px; bottom: 5px; height: 3px; border-radius: 3px;
    background: linear-gradient(90deg, var(--fd-primary), var(--fd-accent));
}

.fd-header-actions { display: flex; align-items: center; gap: 12px; }
.fd-mini-search {
    display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
    background: var(--fd-bg-soft); border: 1px solid #e0ebf5; color: #6b8198;
    border-radius: 999px; padding: 9px 16px; text-decoration: none; font-size: .9rem;
    transition: border-color .15s ease, color .15s ease;
}
.fd-mini-search:hover { border-color: var(--fd-primary); color: var(--fd-primary); }
.fd-mini-search .icon { fill: currentColor; }

.fd-burger {
    display: none; border: 1px solid #e0ebf5; background: #fff; border-radius: 12px;
    width: 46px; height: 46px; align-items: center; justify-content: center; cursor: pointer;
}
.fd-burger .icon { fill: var(--fd-primary); }

/* Pannello mobile */
.fd-mobile-panel {
    display: none; border-top: 1px solid #e6eef6; background: #fff;
    padding: 14px 0 22px;
}
.fd-mobile-panel.open { display: block; }
.fd-mobile-panel a {
    display: block; padding: 14px 4px; text-decoration: none; color: var(--fd-ink);
    font-weight: 600; border-bottom: 1px solid #f0f5fa;
}
.fd-mobile-panel a.active { color: var(--fd-primary); }

/* Traduttore solo su schermi ampi per non affollare l'header */
@media (max-width: 1299.98px) {
    .fd-header-actions #google_translate_element { display: none; }
}
@media (max-width: 991.98px) {
    .fd-nav, .fd-header-actions .fd-mini-search { display: none; }
    .fd-burger { display: inline-flex; margin-left: auto; }
}

/* ---- Hero ---- */
.fd-hero {
    background: linear-gradient(120deg, var(--fd-primary-dark) 0%, var(--fd-primary) 55%, var(--fd-accent) 100%);
    color: #fff;
    border-radius: var(--fd-radius);
    overflow: hidden;
    position: relative;
}
.fd-hero::after {
    content: "";
    position: absolute; inset: 0;
    background: radial-gradient(900px 380px at 85% -10%, rgba(255,255,255,.18), transparent 60%);
    pointer-events: none;
}
.fd-hero .fd-hero-inner { padding: 56px 40px; position: relative; z-index: 1; }
.fd-hero h1 { font-weight: 700; letter-spacing: -.5px; }
.fd-hero p.lead { opacity: .95; }

/* ---- Carosello hero ---- */
.fd-hero-carousel { border-radius: var(--fd-radius); overflow: hidden; box-shadow: var(--fd-shadow); }
.fd-hero-carousel .fd-hero { border-radius: 0; box-shadow: none; min-height: 340px; display: flex; align-items: center; }
.fd-hero-carousel .fd-hero-inner { width: 100%; padding: 48px 48px 64px; }
.fd-hero--1 { background: linear-gradient(120deg, #075089 0%, #0B6BB5 55%, #16B8C7 100%); }
.fd-hero--2 { background: linear-gradient(120deg, #0a4a7a 0%, #1488b0 55%, #19c0a8 100%); }
.fd-hero--3 { background: linear-gradient(120deg, #0B6BB5 0%, #1f6fb6 50%, #5b46b8 100%); }
/* Slide con IMMAGINE di sfondo + overlay (testo sempre leggibile) */
.fd-hero--photo { position: relative; background-size: cover; background-position: center; }
.fd-hero--photo::before {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(100deg, rgba(7,80,137,.92) 0%, rgba(11,107,181,.62) 45%, rgba(11,107,181,.10) 100%);
}
.fd-hero--photo .fd-hero-inner { position: relative; z-index: 1; }
.fd-hero-carousel .carousel-indicators { margin-bottom: .6rem; }
.fd-hero-carousel .carousel-indicators [data-bs-target] { width: 28px; height: 6px; border-radius: 999px; opacity: .55; }
.fd-hero-carousel .carousel-indicators .active { opacity: 1; }
.fd-hero-carousel .carousel-control-prev, .fd-hero-carousel .carousel-control-next { width: 6%; opacity: .8; }
.fd-hero-btn { background: #fff; color: var(--fd-primary-dark); border: none; border-radius: 999px; padding: 12px 26px; font-weight: 700; text-decoration: none; display: inline-block; transition: transform .15s ease, box-shadow .15s ease; }
.fd-hero-btn:hover { color: var(--fd-primary-dark); transform: translateY(-2px); box-shadow: 0 10px 26px rgba(0,0,0,.18); }

/* Pannello ricerca sovrapposto al carosello */
.fd-search-panel { max-width: 920px; margin: -40px auto 0; position: relative; z-index: 3; }
@media (max-width: 575.98px) {
    .fd-hero-carousel .fd-hero-inner { padding: 32px 24px 56px; }
    .fd-search-panel { margin-top: -24px; }
}

/* ---- Box ricerca ---- */
.fd-searchbox {
    background: #fff;
    border-radius: var(--fd-radius);
    box-shadow: var(--fd-shadow);
    padding: 10px;
}
.fd-searchbox .input-group { gap: 8px; }
.fd-searchbox .form-control {
    border: 2px solid #d4e3f1;
    background: #f6fafe;
    border-radius: 12px;
    box-shadow: none;
    font-size: 1.05rem;
    padding: 12px 16px;
}
.fd-searchbox .form-control::placeholder { color: #8aa0b5; }
.fd-searchbox .form-control:focus {
    border-color: var(--fd-primary);
    background: #fff;
    box-shadow: 0 0 0 .2rem rgba(11,107,181,.15);
}
.fd-searchbox .btn { border-radius: 12px; padding-inline: 28px; font-weight: 600; }

/* autocomplete jQuery UI dentro il box */
.ui-autocomplete {
    z-index: 1100;
    border-radius: 12px;
    box-shadow: var(--fd-shadow);
    border: 1px solid #e3eef7;
    background: #fff;
    padding: 6px;
    max-height: 360px; overflow-y: auto;
}
.ui-autocomplete .ui-menu-item-wrapper { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; }
.ui-autocomplete .ui-menu-item-wrapper img { width: 40px; height: 40px; object-fit: contain; border-radius: 6px; background: #f4f8fc; }
.ui-autocomplete .ui-state-active { background: var(--fd-bg-soft); color: var(--fd-ink); }

/* ---- Card categorie ---- */
.fd-cat-card {
    display: block;
    height: 100%;
    background: #fff;
    border: 1px solid #e6eef6;
    border-radius: var(--fd-radius);
    padding: 28px 24px;
    text-decoration: none;
    color: var(--fd-ink);
    box-shadow: 0 4px 16px rgba(21,50,74,.06);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.fd-cat-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--fd-shadow-hover);
    border-color: var(--fd-primary);
    color: var(--fd-ink);
}
.fd-cat-card .fd-cat-icon {
    width: 56px; height: 56px;
    display: grid; place-items: center;
    border-radius: 14px;
    background: linear-gradient(135deg, var(--fd-primary), var(--fd-accent));
    margin-bottom: 16px;
}
.fd-cat-card .fd-cat-icon .icon { fill: #fff; }
.fd-cat-card h3 { font-size: 1.15rem; font-weight: 700; margin-bottom: 6px; }
.fd-cat-card p { color: #5b7186; margin: 0; font-size: .95rem; }

/* ---- Sezioni ---- */
.fd-section { padding: 56px 0; }
.fd-section-soft { background: var(--fd-bg-soft); }

/* =====================================================================
   Pagina dettaglio prodotto
   ===================================================================== */
.product-header {
    background: #fff; padding: 20px; border-radius: var(--fd-radius);
    box-shadow: 0 4px 16px rgba(21,50,74,.06); margin-bottom: 22px;
    display: flex; align-items: flex-start; flex-wrap: wrap;
}
.product-image { max-width: 100%; height: auto; }
.product-title { font-size: 1.8rem; font-weight: 800; color: var(--fd-primary); margin-bottom: 10px; }
.product-category { font-size: .95rem; color: var(--fd-ink); margin-bottom: 0; }
.product-category2 { font-size: 1rem; color: #6b8198; margin-bottom: 0; }
.product-details { padding: 20px; background: #fff; border-radius: var(--fd-radius); margin-bottom: 20px; }
.product-details h4 {
    font-size: 1rem; margin-bottom: 10px; color: var(--fd-ink); text-align: left;
    display: flex; align-items: center; cursor: pointer; position: relative;
    border: 1px solid #e3eef7; border-radius: 12px; padding: 12px 40px 12px 14px;
    transition: border-color .15s ease, background .15s ease;
}
.product-details h4:hover { border-color: var(--fd-primary); background: var(--fd-bg-soft); }
.product-details h4::after { content: '▼'; font-size: .8em; position: absolute; right: 14px; top: 50%; transform: translateY(-50%); transition: transform .3s ease; color: var(--fd-primary); }
.product-details h4.active::after { transform: translateY(-50%) rotate(180deg); content: '▲'; }
.product-details div { margin-bottom: 15px; color: #555; display: none; }
.product-details div.active { display: block; }
.tabs { margin-top: 20px; border-bottom: 2px solid #eaeaea; }
.tab { padding: 10px 20px; cursor: pointer; border: none; background: none; font-weight: 700; color: var(--fd-primary); }
.tab:hover { background: var(--fd-bg-soft); }
.tab.active { border-bottom: 3px solid var(--fd-primary); }
.tab-content { display: none; padding-top: 20px; }
.tab-content.active { display: block; }
.copy-icon { cursor: pointer; font-size: .9rem; color: var(--fd-primary); margin-left: 10px; vertical-align: middle; }
@media (max-width: 768px) {
    .product-header { flex-direction: column; align-items: center; text-align: center; }
    .product-title { font-size: 1.5rem; }
    .tab { flex: 1 1 100%; text-align: center; }
}

/* =====================================================================
   Footer moderno Farmaco Digitale
   ===================================================================== */
.fd-footer {
    background: linear-gradient(135deg, var(--fd-ink) 0%, var(--fd-primary-dark) 100%);
    color: #cfe2f2; margin-top: 64px; position: relative;
}
.fd-footer::before {
    content: ""; display: block; height: 4px;
    background: linear-gradient(90deg, var(--fd-primary), var(--fd-accent));
}
.fd-footer-top { padding: 54px 0 30px; }
.fd-footer-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.fd-footer-brand img { height: 52px; width: auto; }
.fd-footer-brand .fd-footer-name { font-weight: 800; font-size: 1.3rem; color: #fff; line-height: 1.1; }
.fd-footer-brand .fd-footer-sub { font-size: .8rem; color: #a9c6df; }
.fd-footer p.fd-footer-claim { color: #a9c6df; max-width: 320px; font-size: .92rem; }
.fd-foot-title { color: #fff; font-size: .95rem; text-transform: uppercase; letter-spacing: .6px; margin-bottom: 16px; font-weight: 700; }
.fd-foot-list { list-style: none; padding: 0; margin: 0; }
.fd-foot-list li { margin-bottom: 10px; }
.fd-footer a { color: #cfe2f2; text-decoration: none; transition: color .15s ease; }
.fd-footer a:hover { color: #fff; text-decoration: underline; }
.fd-foot-socials { display: flex; gap: 10px; margin-top: 6px; }
.fd-foot-socials a {
    display: inline-grid; place-items: center; width: 42px; height: 42px;
    border-radius: 50%; background: rgba(255,255,255,.12); transition: background .15s ease, transform .15s ease;
}
.fd-foot-socials a:hover { background: var(--fd-accent); transform: translateY(-2px); text-decoration: none; }
.fd-foot-socials .icon { fill: #fff; }
.fd-footer-bottom { border-top: 1px solid rgba(255,255,255,.15); padding: 18px 0; font-size: .85rem; color: #a9c6df; }
.fd-footer-bottom ul { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 20px; padding: 0; margin: 0; align-items: center; }

/* ---- Paginazione (pagine risultati) ---- */
.pagination-container { display: flex; justify-content: center; margin-top: 20px; }
.pagination { display: flex; list-style: none; padding: 0; }
.pagination li { margin: 0 5px; }
.pagination li a, .pagination li button {
    padding: 8px 12px; border: 1px solid #dbe6f1; border-radius: 8px;
    text-decoration: none; color: var(--fd-primary); background: #fff; cursor: pointer;
}
.pagination li a:hover, .pagination li button:hover,
.pagination li.active button { background: var(--fd-primary); color: #fff; border-color: var(--fd-primary); }
.pagination li.disabled button { cursor: not-allowed; opacity: .5; }

/* ---- Cookie banner ---- */
.cookie-consent {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1080;
    background: #fff;
    box-shadow: 0 -6px 30px rgba(21,50,74,.18);
    border-top: 4px solid var(--fd-primary);
    padding: 18px 20px;
}
.cookie-consent .cookie-content {
    max-width: 1100px; margin: 0 auto;
    display: flex; gap: 16px; align-items: center; flex-wrap: wrap;
}
.cookie-consent .cookie-content p { margin: 0; flex: 1 1 320px; font-size: .92rem; color: #5b7186; }
