/* ============================================
   SAFIT - Template Grossista Ferramenta
   ============================================ */

:root {
    --primary-color: #e42807;
    --secondary-color: #34495e;
    --accent-color: #e74c3c;
    --text-color: #333;
    --text-light: #666;
    --bg-light: #f8f9fa;
    --border-color: #dee2e6;
    --white: #ffffff;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 5px 20px rgba(0, 0, 0, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--text-color);
    line-height: 1.6;
    background-color: var(--bg-light);
    overflow-x: hidden;
}

/* ============================================
   HEADER
   ============================================ */

.main-header {
    background: linear-gradient(to right, var(--theme-header-color, #e42807) 0%, var(--theme-footer-color, #34495e) 100%);
    padding: 0.75rem 0;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1cm solid #ffffff;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: flex-start;
    align-items: center;
}

.logo-wrapper {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

/* Su mobile, centra il logo */
@media screen and (max-width: 767px) {
    .header-container {
        justify-content: center;
    }
    
    .logo-wrapper {
        justify-content: center;
    }
}

.logo {
    height: 60px;
    width: auto;
    max-width: 200px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

/* ============================================
   SIDEBAR
   ============================================ */

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 280px;
    height: 100vh;
    background-color: var(--white);
    box-shadow: var(--shadow-lg);
    z-index: 999;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    padding-top: 100px;
}

.sidebar.open {
    transform: translateX(0);
}

.sidebar-toggle {
    position: fixed;
    top: 20px;
    left: 20px;
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1001;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.sidebar-toggle:hover {
    background-color: var(--secondary-color);
    transform: scale(1.05);
}

.sidebar-toggle i {
    font-size: 1.5rem;
}

.sidebar-nav {
    padding: 1rem 0;
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu li {
    margin: 0;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    color: var(--text-color);
    text-decoration: none;
    transition: all 0.3s ease;
    border-left: 4px solid transparent;
    font-weight: 500;
}

.menu-item i {
    width: 24px;
    margin-right: 1rem;
    font-size: 1.2rem;
    color: var(--text-light);
    transition: color 0.3s ease;
}

.menu-item:hover {
    background-color: var(--bg-light);
    border-left-color: var(--primary-color);
    color: var(--primary-color);
}

.menu-item:hover i {
    color: var(--primary-color);
}

.menu-item.active {
    background-color: var(--bg-light);
    border-left-color: var(--accent-color);
    color: var(--accent-color);
    font-weight: 600;
}

.menu-item.active i {
    color: var(--accent-color);
}

.menu-item-highlight {
    background-color: #e42807;
    color: var(--white) !important;
    margin: 0.5rem 1rem;
    border-radius: 5px;
    border-left: none !important;
}

.menu-item-highlight i {
    color: var(--white) !important;
}

.menu-item-highlight:hover {
    background-color: #c82003;
    color: var(--white) !important;
}

.menu-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 1rem 0;
}

/* Overlay per mobile */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   MAIN CONTENT
   ============================================ */

.main-content {
    min-height: calc(100vh - 200px);
    padding: 3rem 2rem;
    padding-top: 0;
    padding-bottom: 0;
    margin-top: 0;
    margin-bottom: 0;
    transition: margin-left 0.3s ease;
    background-image: url('/safit/assets/images/quadro_safit_16_9_big.jpg');
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    position: relative;
    z-index: 0;
    background-color: #f0f0f0;
    background-origin: border-box;
}

/* Overlay trasparente solo su mobile per leggibilità */
.main-content::before {
    display: none;
}

@media screen and (max-width: 767px) {
    .main-content::before {
        display: block;
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(255, 255, 255, 0.7);
        z-index: 0;
        pointer-events: none;
    }
    
    /* Assicura che il contenuto sia sopra l'overlay su mobile */
    .main-content > * {
        position: relative;
        z-index: 1;
    }
}

/* Assicura che il contenuto sia sopra l'overlay */
.main-content > * {
    position: relative;
    z-index: 1;
}

/* ============================================
   FOOTER
   ============================================ */

.main-footer {
    background: linear-gradient(to right, var(--theme-footer-color, #34495e) 0%, var(--theme-header-color, #e42807) 100%);
    color: var(--white);
    padding: 1rem 0;
    text-align: center;
    margin-top: 0;
    border-top: 1cm solid #ffffff;
}

.footer-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

.footer-legal-bar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    column-gap: 1rem;
    row-gap: 0.4rem;
    font-size: 0.8rem;
    line-height: 1.45;
}

.footer-legal-link {
    color: #fff !important;
    text-decoration: underline;
    white-space: nowrap;
    opacity: 0.95;
}

.footer-legal-link:visited,
.footer-legal-link:hover,
.footer-legal-link:focus {
    color: #fff !important;
    opacity: 1;
}

.footer-legal-link:first-child {
    justify-self: start;
}

.footer-legal-link:last-child {
    justify-self: end;
}

.footer-legal-center {
    text-align: center;
    min-width: 0;
    opacity: 0.98;
}

.footer-legal-center p {
    margin: 0;
}

/* ============================================
   PAGE CONTENT STYLES
   ============================================ */

/* ============================================
   HERO BANNER SECTION
   ============================================ */

.hero-banner-section {
    width: 100%;
    margin-top: 0;
    margin-bottom: 0;
    overflow: hidden;
    position: relative;
    z-index: 10;
    background: #fff;
}

.hero-banner-container {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 0;
}

.hero-banner-link {
    display: block;
    width: 100%;
    text-decoration: none;
    transition: opacity 0.3s ease;
    line-height: 0;
}

.hero-banner-link:hover {
    opacity: 0.9;
}

.hero-banner-image {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    max-width: 100%;
}

/* Responsive Hero Banner */
@media (max-width: 768px) {
    .hero-banner-image {
        max-height: 300px;
        object-fit: cover;
    }
}

@media (min-width: 769px) {
    .hero-banner-image {
        max-height: 500px;
        object-fit: cover;
    }
}

.page-content {
    max-width: 1200px;
    margin: 0 auto;
    margin-bottom: 0;
    padding-bottom: 0;
}

.page-header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem 0;
}

.page-header h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-weight: 700;
}

.page-header p {
    font-size: 1.1rem;
    color: var(--text-light);
    max-width: 800px;
    margin: 0 auto;
}

.content-section {
    background-color: var(--white);
    padding: 2.5rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
    margin-bottom: 0;
}

.content-section h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
    border-bottom: 3px solid var(--accent-color);
    padding-bottom: 0.5rem;
}

.content-section h3 {
    color: var(--secondary-color);
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    font-size: 1.4rem;
}

.content-section p {
    margin-bottom: 1rem;
    line-height: 1.8;
}

.content-html {
    line-height: 1.8;
}

.content-html img {
    max-width: 100%;
    height: auto;
    border-radius: 5px;
    margin: 1rem 0;
}

/* Grid layout */
.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
    margin-bottom: 0;
}

.card {
    background-color: rgba(255, 255, 255, 0.95);
    padding: 2rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.card-icon {
    font-size: 3rem;
    color: var(--accent-color);
    margin-bottom: 1rem;
}

.card h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.card p {
    color: var(--text-light);
    line-height: 1.6;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Desktop - Sidebar controllabile */
@media screen and (min-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .sidebar-toggle {
        display: flex;
    }
    
    .main-content {
        margin-left: 0;
        background-position: center center;
    }
    
    /* Quando sidebar è aperta su desktop */
    .sidebar.open ~ .main-content {
        margin-left: 280px;
    }
    
    .sidebar-overlay {
        display: none;
    }
}

/* Tablet */
@media screen and (max-width: 1023px) {
    .main-content {
        padding: 2rem 1.5rem;
        padding-top: 0;
        background-attachment: scroll;
        background-position: center center;
    }
    
    .page-header h1 {
        font-size: 2rem;
    }
    
    .content-section {
        padding: 2rem;
    }
}

/* Mobile */
@media screen and (max-width: 767px) {
    .header-container {
        padding: 0 1rem;
    }
    
    .logo {
        height: 50px;
    }
    
    .sidebar {
        width: 260px;
    }
    
    .main-content {
        padding: 1.5rem 1rem;
        padding-top: 0;
        padding-bottom: 0;
        margin-left: 0;
        background-attachment: scroll;
        background-size: cover;
        background-position: center center;
    }
    
    .main-content::before {
        display: none;
    }
    
    .sidebar-toggle {
        display: flex !important;
        visibility: visible !important;
    }
    
    .sidebar {
        transform: translateX(-100%);
        z-index: 1002;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .sidebar-overlay {
        z-index: 1001;
    }
    
    .sidebar-toggle {
        display: flex !important;
    }
    
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .page-header {
        margin-bottom: 2rem;
        padding: 1.5rem 0;
    }
    
    .page-header h1 {
        font-size: 1.8rem;
    }
    
    .page-header p {
        font-size: 1rem;
    }
    
    .content-section {
        padding: 1.5rem;
    }
    
    .content-section h2 {
        font-size: 1.5rem;
    }
    
    .grid-cards {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .card {
        padding: 1.5rem;
    }
}
