@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;700;800&display=swap');

:root {
    --rm-black: #111111;
    --rm-white: #ffffff;
    --rm-gray: #f4f4f4;
    --rm-accent: #e31837; 
    --rm-font: 'Montserrat', sans-serif;
}

html {
    scroll-padding-top: 120px; /* Evita che la navbar fissa copra i campi in validazione o i link ancore */
}

body {
    font-family: var(--rm-font);
    background-color: var(--rm-white);
    color: var(--rm-black);
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: -1px;
}

/* 
   Z-INDEX HIERARCHY - IMPORTANTE:
   Per evitare sovrapposizioni tra menu e filtri, rispettare questa scala:
   1020: Bootstrap .sticky-top (Sidebar filtri)
   1040: .navbar (Deve stare sopra la sidebar durante lo scroll)
   1050: .mega-menu (Deve stare sopra tutto per essere cliccabile)
*/

/* Navbar Style Refinement */
.navbar {
    padding: 1rem 0;
    background-color: var(--rm-white) !important;
    border-bottom: 1px solid #eee;
    z-index: 1040; 
}

.navbar-brand {
    font-weight: 800 !important;
    letter-spacing: -1.5px;
    font-size: 1.8rem;
    color: var(--rm-black) !important;
}

.nav-link {
    font-weight: 700 !important;
    text-transform: uppercase;
    font-size: 0.85rem;
    margin: 0 12px;
    color: var(--rm-black) !important;
}

/* Carousel Cinematic Text */
.carousel-caption {
    bottom: 20%;
    text-align: left;
    max-width: 800px;
    left: 10%;
    z-index: 10;
}

.carousel-caption h5 {
    font-size: 5rem;
    line-height: 0.85;
    margin-bottom: 1.5rem;
    font-weight: 800;
    color: white;
    text-shadow: 2px 2px 10px rgba(0,0,0,0.5);
}

.carousel-caption p {
    font-size: 1.4rem;
    font-weight: 400;
    margin-bottom: 2rem;
    color: white;
}

/* Card Style */
.card {
    border: none;
    border-radius: 0;
    background-color: var(--rm-gray);
    transition: all 0.3s ease;
}

.card:hover {
    background-color: #ebebeb;
}

.card-title {
    font-size: 1.4rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.btn-primary {
    background-color: var(--rm-black);
    border: none;
    border-radius: 0;
    padding: 12px 30px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9rem;
}

.btn-primary:hover {
    background-color: var(--rm-accent);
}

.btn-outline-dark {
    border-radius: 0;
    text-transform: uppercase;
    font-weight: 700;
    border-width: 2px;
}

/* Sections */
section {
    padding: 100px 0;
}

.section-title {
    font-size: 3rem;
    margin-bottom: 60px;
    font-weight: 800;
}

/* Forms */
.form-control {
    border-radius: 0;
    border: 2px solid #eee;
    padding: 12px;
}

/* Carousel Drag Cursor */
.carousel {
    cursor: grab;
}

.carousel:active {
    cursor: grabbing;
}

.carousel-control-prev-icon,
.carousel-control-next-icon {
    width: 3.5rem;
    height: 3.5rem;
    background-color: rgba(0,0,0,0.3);
    border-radius: 50%;
    background-size: 50%;
}

.carousel-control-prev:hover .carousel-control-prev-icon,
.carousel-control-next:hover .carousel-control-next-icon {
    background-color: var(--rm-accent);
}

/* Brands Mega Menu - Cinematic Style */
.navbar .nav-item.dropdown.mega-dropdown {
    position: static; /* Required for full-width dropdown */
}

.navbar .dropdown-menu.mega-menu {
    width: 100%;
    left: 0;
    right: 0;
    top: 100%;
    border: none;
    border-radius: 0;
    margin-top: 0;
    padding: 40px 0;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    background-color: var(--rm-white);
    border-top: 1px solid #eee;
    z-index: 1050; /* Superiore a sticky-top (1020) */
}

.brand-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0; /* Remove gap to let borders touch */
    border-top: 1px solid #eee;
    border-left: 1px solid #eee;
}

.brand-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 25px;
    text-decoration: none;
    color: var(--rm-black);
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    background-color: transparent;
    border-right: 1px solid #eee;
    border-bottom: 1px solid #eee;
    height: 100%;
}

.brand-item:hover {
    background-color: #f9f9f9;
    z-index: 1;
    box-shadow: 0 0 20px rgba(0,0,0,0.05);
}

.brand-item:hover span {
    color: var(--rm-accent);
}

.brand-item img {
    height: 50px;
    width: auto;
    max-width: 140px;
    margin-bottom: 15px;
    object-fit: contain;
    filter: grayscale(1);
    opacity: 0.7;
    transition: all 0.3s ease;
}

.brand-item:hover img {
    filter: grayscale(0);
    opacity: 1;
}

.brand-item span {
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: color 0.3s ease;
}

.mega-menu-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 25px;
    display: block;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

@media (max-width: 991.98px) {
    .navbar .dropdown-menu.mega-menu {
        position: relative;
        width: 100%;
        padding: 20px;
        box-shadow: none;
    }
    .brand-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
}

/* Rebranding and Navbar Polishing */
.top-bar {
    letter-spacing: 0.5px;
}

.top-bar a.hover-white {
    transition: color 0.2s ease-in-out;
}

.top-bar a.hover-white:hover {
    color: #ffffff !important;
}

.no-caret::after {
    display: none !important;
}

.navbar .d-flex a {
    transition: transform 0.2s ease-in-out, color 0.2s ease-in-out;
}

.navbar .d-flex a:hover {
    color: var(--rm-accent) !important;
    transform: scale(1.05);
}

/* Fix visibility for Editor.js Delimiter in Admin */
.ce-delimiter {
    padding: 2rem 0 !important;
    text-align: center !important;
}
.ce-delimiter::before {
    content: "" !important;
    border-radius: 0;
    padding: 12px 30px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9rem;
}

.btn-primary:hover {
    background-color: var(--rm-accent);
}

.btn-outline-dark {
    border-radius: 0;
    text-transform: uppercase;
    font-weight: 700;
    border-width: 2px;
}

/* Sections */
section {
    padding: 100px 0;
}

.section-title {
    font-size: 3rem;
    margin-bottom: 60px;
    font-weight: 800;
}

/* Forms */
.form-control {
    border-radius: 0;
    border: 2px solid #eee;
    padding: 12px;
}

/* Carousel Drag Cursor */
.carousel {
    cursor: grab;
}

.carousel:active {
    cursor: grabbing;
}

.carousel-control-prev-icon,
.carousel-control-next-icon {
    width: 3.5rem;
    height: 3.5rem;
    background-color: rgba(0,0,0,0.3);
    border-radius: 50%;
    background-size: 50%;
}

.carousel-control-prev:hover .carousel-control-prev-icon,
.carousel-control-next:hover .carousel-control-next-icon {
    background-color: var(--rm-accent);
}

/* Brands Mega Menu - Cinematic Style */
.navbar .nav-item.dropdown.mega-dropdown {
    position: static; /* Required for full-width dropdown */
}

.navbar .dropdown-menu.mega-menu {
    width: 100%;
    left: 0;
    right: 0;
    top: 100%;
    border: none;
    border-radius: 0;
    margin-top: 0;
    padding: 40px 0;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    background-color: var(--rm-white);
    border-top: 1px solid #eee;
    z-index: 1050; /* Superiore a sticky-top (1020) */
}

.brand-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0; /* Remove gap to let borders touch */
    border-top: 1px solid #eee;
    border-left: 1px solid #eee;
}

.brand-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 25px;
    text-decoration: none;
    color: var(--rm-black);
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
    background-color: transparent;
    border-right: 1px solid #eee;
    border-bottom: 1px solid #eee;
    height: 100%;
}

.brand-item:hover {
    background-color: #f9f9f9;
    z-index: 1;
    box-shadow: 0 0 20px rgba(0,0,0,0.05);
}

.brand-item:hover span {
    color: var(--rm-accent);
}

.brand-item img {
    height: 50px;
    width: auto;
    max-width: 140px;
    margin-bottom: 15px;
    object-fit: contain;
    filter: grayscale(1);
    opacity: 0.7;
    transition: all 0.3s ease;
}

.brand-item:hover img {
    filter: grayscale(0);
    opacity: 1;
}

.brand-item span {
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: color 0.3s ease;
}

.mega-menu-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 25px;
    display: block;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

@media (max-width: 991.98px) {
    .navbar .dropdown-menu.mega-menu {
        position: relative;
        width: 100%;
        padding: 20px;
        box-shadow: none;
    }
    .brand-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
}

/* Rebranding and Navbar Polishing */
.top-bar {
    letter-spacing: 0.5px;
}

.top-bar a.hover-white {
    transition: color 0.2s ease-in-out;
}

.top-bar a.hover-white:hover {
    color: #ffffff !important;
}

.no-caret::after {
    display: none !important;
}

.navbar .d-flex a {
    transition: transform 0.2s ease-in-out, color 0.2s ease-in-out;
}

.navbar .d-flex a:hover {
    color: var(--rm-accent) !important;
    transform: scale(1.05);
}

/* Fix visibility for Editor.js Delimiter in Admin */
.ce-delimiter {
    padding: 2rem 0 !important;
    text-align: center !important;
}
.ce-delimiter::before {
    content: "" !important;
    display: block !important;
    width: 60% !important;
    margin: 0 auto !important;
    border-top: 1px solid #ccc !important;
}

h1:focus, h1:focus-visible, 
h2:focus, h2:focus-visible, 
h3:focus, h3:focus-visible, 
h4:focus, h4:focus-visible, 
h5:focus, h5:focus-visible, 
h6:focus, h6:focus-visible { 
    outline: none !important; 
}

/* Responsive Navbar & Mobile Header */
.brand-logo {
    height: 55px;
    width: auto;
    object-fit: contain;
    transition: height 0.2s ease;
}

@media (min-width: 992px) {
    .brand-logo {
        height: 80px;
    }
}

.hover-accent:hover {
    color: var(--rm-accent) !important;
}

@media (max-width: 991.98px) {
    .navbar {
        padding: 0.5rem 0 !important;
    }
    .navbar-collapse {
        background-color: var(--rm-white);
        padding: 0.75rem 0.5rem;
        border-top: 1px solid #f0f0f0;
        margin-top: 0.5rem;
    }
    .navbar-nav .nav-link {
        padding: 0.65rem 0.5rem !important;
        margin: 0 !important;
        font-size: 0.95rem;
        border-bottom: 1px solid #f8f9fa;
    }
}

/* Iubenda: nasconde l'icona/badge galleggiante fissa sullo schermo per mantenere il design pulito */
.iubenda-tp-btn,
.iubenda-tp-alert-btn,
.iubenda-tp-btn--warning,
.iubenda-uspr-btn,
.iubenda-floatable-aw-btn,
.iubenda-floatable-btn-with-label,
.iubenda-floatable-default-btn,
.iubenda-floatable-tb-btn,
.iubenda-cs-default-floating,
.iubenda-cs-brand-badge,
.iubenda-cs-brand-badge-outer,
.iubenda-cs-brand-badge-text,
.iubenda-iframe-badge-container,
[data-tp-float],
[data-tp-icon],
button.iubenda-cs-preferences-link,
#iubenda-cs-badge,
.iubenda-cs-badge,
.iub-cs-badge,
.iub-floating-button,
[id^="iubenda-cs-badge"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    position: fixed !important;
    bottom: -9999px !important;
    right: -9999px !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    z-index: -9999 !important;
}

/* Assicura che i link di testo nel footer rimangano sempre perfettamente visibili e cliccabili */
footer .iubenda-cs-preferences-link,
footer .iubenda-advertising-preferences-link {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    position: static !important;
}

/* Stile Dedicato Pulsante Area Riservata B2B in Navbar */
.btn-b2b-nav {
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 4px;
    border: 1.5px solid var(--rm-black);
    color: var(--rm-black);
    padding: 0.32rem 0.85rem;
    transition: all 0.2s ease;
    text-decoration: none;
    background-color: transparent;
    line-height: 1.3;
}
.btn-b2b-nav:hover {
    background-color: var(--rm-black);
    color: #ffffff !important;
    border-color: var(--rm-black);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
}
.btn-b2b-nav:hover i {
    color: #ff4d6d !important;
}