/* ==========================================================================
   Treviup Theme - Main Stylesheet
   ========================================================================== */

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: Verdana, Arial, sans-serif;
    font-size: 13px;
    color: #505050;
    background: #d0d0d0;
    line-height: 1.6;
}

a { color: #467aa7; text-decoration: none; }
a:hover { color: #2a5a8a; text-decoration: underline; }

h1, h2, h3, h4, h5, h6 {
    font-family: 'Trebuchet MS', Arial, sans-serif;
    color: #464646;
    margin-bottom: 0.6em;
}

h1 { font-size: 1.6em; }
h2 { font-size: 1.3em; }
h3 { font-size: 1.1em; }

p { margin-bottom: 1em; }
ul, ol { padding-left: 1.5em; margin-bottom: 1em; }
img { max-width: 100%; height: auto; }

/* ---------- Wrapper ---------- */
#wrapper {
    max-width: 980px;
    margin: 0 auto;
    background: #fff;
    box-shadow: 0 0 12px rgba(0,0,0,0.25);
}

/* ==========================================================================
   HEADER
   ========================================================================== */

#header {
    background: #f0f0f0;
    border-bottom: 1px solid #c0c0c0;
}

/* Top bar */
#header-top {
    background: linear-gradient(to bottom, #f8f8f8, #e8e8e8);
    border-bottom: 1px solid #d0d0d0;
    padding: 10px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 70px;
}

#site-branding {
    display: flex;
    align-items: center;
    gap: 14px;
}

#site-logo img {
    max-height: 60px;
    width: auto;
}

#site-name {
    font-family: 'Trebuchet MS', Arial, sans-serif;
    font-size: 1.6em;
    font-weight: bold;
    color: #3a3a3a;
    letter-spacing: 1px;
    line-height: 1.2;
}

#site-name span {
    display: block;
    font-size: 0.55em;
    font-weight: normal;
    color: #787878;
    letter-spacing: 0;
}

/* Tagline / header middle */
#header-tagline {
    background: linear-gradient(to bottom, #e8e8e8, #d8d8d8);
    border-bottom: 1px solid #c0c0c0;
    padding: 8px 15px;
    text-align: center;
    font-family: 'Trebuchet MS', Arial, sans-serif;
    font-size: 0.9em;
    color: #505050;
}

#header-tagline strong {
    font-size: 1.05em;
    color: #3a3a3a;
    letter-spacing: 0.5px;
}

#header-tagline .tagline-sub {
    font-size: 0.85em;
    color: #787878;
    font-style: italic;
}

/* ---------- Primary Navigation ---------- */
#nav-primary {
    background: #e1e1e1;
    border-bottom: 2px solid #b0b0b0;
}

#nav-primary ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
}

#nav-primary ul li {
    position: relative;
}

#nav-primary ul li a {
    display: block;
    padding: 9px 14px;
    color: #404040;
    font-size: 0.85em;
    font-weight: bold;
    white-space: nowrap;
    border-right: 1px solid #c8c8c8;
    transition: background 0.2s;
}

#nav-primary ul li a:hover,
#nav-primary ul li.current-menu-item > a,
#nav-primary ul li.current-menu-ancestor > a {
    background: #467aa7;
    color: #fff;
    text-decoration: none;
}

/* Dropdown */
#nav-primary ul ul {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    border: 1px solid #c0c0c0;
    border-top: 2px solid #467aa7;
    min-width: 180px;
    z-index: 999;
    flex-direction: column;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

#nav-primary ul li:hover > ul { display: flex; }

#nav-primary ul ul li a {
    padding: 7px 14px;
    border-right: none;
    border-bottom: 1px solid #eee;
    font-weight: normal;
    color: #404040;
}

#nav-primary ul ul li a:hover {
    background: #f0f5fa;
    color: #467aa7;
}

/* Breadcrumb */
#breadcrumb {
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
    padding: 5px 15px;
    font-size: 0.78em;
    color: #888;
}

#breadcrumb a { color: #467aa7; }
#breadcrumb span { color: #555; }

/* ==========================================================================
   MAIN LAYOUT - 3 Columns
   ========================================================================== */

#content-wrapper {
    display: flex;
    align-items: flex-start;
    min-height: 420px;
}

/* Left Sidebar */
#sidebar-left {
    width: 195px;
    flex-shrink: 0;
    background: #f5f5f5;
    border-right: 1px solid #ddd;
    padding: 12px 0;
}

/* Main Content */
#main-content {
    flex: 1;
    padding: 18px 20px;
    min-width: 0;
}

/* Right Sidebar */
#sidebar-right {
    width: 210px;
    flex-shrink: 0;
    background: #f5f5f5;
    border-left: 1px solid #ddd;
}

/* ==========================================================================
   LEFT SIDEBAR
   ========================================================================== */

#sidebar-left .widget { margin-bottom: 14px; }

/* Left nav menu */
#sidebar-left .widget_nav_menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

#sidebar-left .widget_nav_menu ul li a {
    display: block;
    padding: 6px 12px 6px 22px;
    color: #404040;
    font-size: 0.82em;
    border-bottom: 1px solid #e0e0e0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='6' height='6'%3E%3Ccircle cx='3' cy='3' r='2.5' fill='%23467aa7'/%3E%3C/svg%3E") no-repeat 10px center;
    transition: background-color 0.15s;
}

#sidebar-left .widget_nav_menu ul li a:hover,
#sidebar-left .widget_nav_menu ul li.current-menu-item > a {
    background-color: #e8f0f8;
    color: #2a5a8a;
    text-decoration: none;
}

#sidebar-left .widget_nav_menu ul ul {
    padding-left: 12px;
}

#sidebar-left .widget_nav_menu ul ul li a {
    font-size: 0.78em;
    padding-left: 28px;
    background-position: 16px center;
    color: #666;
}

/* Gallery in left sidebar */
#sidebar-left .treviup-gallery {
    overflow: hidden;
}

#sidebar-left .treviup-gallery img {
    width: 100%;
    display: block;
    border: none;
}

.widget-title-bar {
    background: linear-gradient(to bottom, #c8c8c8, #b0b0b0);
    color: #fff;
    font-size: 0.82em;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 6px 10px;
    border-bottom: 1px solid #999;
    font-family: 'Trebuchet MS', Arial, sans-serif;
}

/* ==========================================================================
   RIGHT SIDEBAR - Colored blocks
   ========================================================================== */

.sidebar-block { margin-bottom: 0; border-bottom: 1px solid #ddd; }

.sidebar-block .widget-title {
    font-family: 'Trebuchet MS', Arial, sans-serif;
    font-size: 0.88em;
    font-weight: bold;
    color: #fff;
    padding: 7px 10px;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-block .widget-content {
    padding: 10px;
    font-size: 0.82em;
    line-height: 1.5;
}

/* Blue block - Dove Siamo */
.block-blue .widget-title { background: #89aad6; }
.block-blue { border-top: 2px solid #5580b0; }

/* Green block - Contatti */
.block-green .widget-title { background: #a0d651; }
.block-green { border-top: 2px solid #78a830; }

/* Orange block - Lavora con Noi */
.block-orange .widget-title { background: #e8b10d; }
.block-orange { border-top: 2px solid #c09000; }

.sidebar-block .widget-content p { margin-bottom: 0.5em; }
.sidebar-block .widget-content strong { color: #333; }
.sidebar-block img { width: 100%; height: auto; display: block; margin-bottom: 8px; }

/* Contact info in right sidebar */
.contact-info { list-style: none; padding: 0; margin: 0; }
.contact-info li {
    padding: 3px 0;
    border-bottom: 1px dashed #ddd;
    font-size: 0.9em;
}
.contact-info li:last-child { border-bottom: none; }
.contact-info .label { color: #888; font-size: 0.85em; }

/* ==========================================================================
   MAIN CONTENT AREA
   ========================================================================== */

.page-title {
    font-family: 'Trebuchet MS', Arial, sans-serif;
    font-size: 1.4em;
    color: #3a3a3a;
    border-bottom: 2px solid #467aa7;
    padding-bottom: 8px;
    margin-bottom: 16px;
}

.entry-content h2 { color: #467aa7; margin-top: 1.2em; }
.entry-content h3 { color: #555; }

/* Product grid */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 14px;
}

.product-card {
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    text-align: center;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.product-card:hover {
    border-color: #467aa7;
    box-shadow: 0 2px 8px rgba(70,122,167,0.15);
}

.product-card img {
    width: 100%;
    height: 110px;
    object-fit: cover;
    display: block;
}

.product-card .product-name {
    padding: 6px;
    font-size: 0.78em;
    color: #555;
    font-weight: bold;
}

.product-card a { color: inherit; }
.product-card a:hover { text-decoration: none; color: #467aa7; }

/* Category section */
.category-section {
    background: #f8f8f8;
    border: 1px solid #e0e0e0;
    border-left: 4px solid #467aa7;
    padding: 14px 16px;
    margin-bottom: 18px;
    border-radius: 0 4px 4px 0;
}

.category-section h2 {
    color: #467aa7;
    margin-bottom: 8px;
    font-size: 1.2em;
}

/* ==========================================================================
   HOMEPAGE - Front Page
   ========================================================================== */

.hero-slider {
    position: relative;
    overflow: hidden;
    background: #1a1a1a;
    margin-bottom: 0;
}

.hero-slider .slide {
    display: none;
    width: 100%;
}

.hero-slider .slide.active { display: block; }

.hero-slider img {
    width: 100%;
    height: 280px;
    object-fit: cover;
    display: block;
}

.hero-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.55);
    color: #fff;
    padding: 10px 16px;
    font-size: 0.95em;
}

.slider-nav {
    position: absolute;
    bottom: 8px;
    right: 10px;
    display: flex;
    gap: 5px;
}

.slider-dot {
    width: 9px; height: 9px;
    border-radius: 50%;
    background: rgba(255,255,255,0.4);
    cursor: pointer;
    border: none;
    transition: background 0.2s;
}

.slider-dot.active { background: #fff; }

/* Welcome box */
.welcome-box {
    padding: 20px;
}

.welcome-box h1 {
    font-size: 1.4em;
    color: #3a3a3a;
    border-bottom: 2px solid #467aa7;
    padding-bottom: 8px;
    margin-bottom: 14px;
}

/* Product categories grid on homepage */
.home-categories {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

.home-category-block {
    padding: 18px 20px;
    border: 1px solid #e0e0e0;
    position: relative;
}

.home-category-block h2 {
    font-size: 1.15em;
    color: #467aa7;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid #ddd;
}

.home-category-block ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.home-category-block ul li {
    padding: 3px 0;
    padding-left: 14px;
    font-size: 0.85em;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='6' height='6'%3E%3Ccircle cx='3' cy='3' r='2.5' fill='%23467aa7'/%3E%3C/svg%3E") no-repeat left center;
}

.home-category-block ul li a { color: #505050; }
.home-category-block ul li a:hover { color: #467aa7; }

.read-more {
    display: inline-block;
    margin-top: 10px;
    padding: 5px 14px;
    background: #467aa7;
    color: #fff;
    font-size: 0.82em;
    border-radius: 3px;
    transition: background 0.2s;
}

.read-more:hover { background: #2a5a8a; color: #fff; text-decoration: none; }

/* ==========================================================================
   GALLERY PAGE
   ========================================================================== */

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
    margin-top: 14px;
}

.gallery-item {
    border: 1px solid #ddd;
    overflow: hidden;
    border-radius: 3px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.gallery-item:hover { border-color: #467aa7; }

.gallery-item img {
    width: 100%;
    height: 130px;
    object-fit: cover;
    display: block;
    transition: transform 0.3s;
}

.gallery-item:hover img { transform: scale(1.05); }

/* Lightbox */
.lightbox-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.lightbox-overlay.open { display: flex; }
.lightbox-overlay img { max-width: 90vw; max-height: 85vh; border: 3px solid #fff; }
.lightbox-close {
    position: absolute;
    top: 15px;
    right: 20px;
    color: #fff;
    font-size: 2em;
    cursor: pointer;
    line-height: 1;
}

/* ==========================================================================
   CONTACT FORM
   ========================================================================== */

.contact-form-wrap { max-width: 500px; }

.contact-form-wrap label {
    display: block;
    font-size: 0.85em;
    font-weight: bold;
    color: #555;
    margin-bottom: 3px;
    margin-top: 12px;
}

.contact-form-wrap input[type="text"],
.contact-form-wrap input[type="email"],
.contact-form-wrap input[type="tel"],
.contact-form-wrap textarea,
.contact-form-wrap select {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #ccc;
    border-radius: 3px;
    font-family: Verdana, Arial, sans-serif;
    font-size: 0.9em;
    color: #333;
    transition: border-color 0.2s;
}

.contact-form-wrap input:focus,
.contact-form-wrap textarea:focus {
    border-color: #467aa7;
    outline: none;
    box-shadow: 0 0 0 2px rgba(70,122,167,0.15);
}

.contact-form-wrap textarea { min-height: 120px; resize: vertical; }

.btn-submit {
    margin-top: 16px;
    padding: 9px 24px;
    background: #467aa7;
    color: #fff;
    border: none;
    border-radius: 3px;
    font-size: 0.9em;
    cursor: pointer;
    font-family: Verdana, Arial, sans-serif;
    transition: background 0.2s;
}

.btn-submit:hover { background: #2a5a8a; }

/* Map container */
.map-container {
    margin: 14px 0;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.map-container iframe {
    width: 100%;
    height: 300px;
    display: block;
    border: none;
}

/* ==========================================================================
   FOOTER
   ========================================================================== */

#footer {
    background: linear-gradient(to bottom, #e8e8e8, #d8d8d8);
    border-top: 2px solid #b0b0b0;
    padding: 16px 15px 10px;
}

.footer-widgets {
    display: flex;
    gap: 20px;
    margin-bottom: 12px;
}

.footer-widget { flex: 1; min-width: 0; }
.footer-widget h4 {
    font-family: 'Trebuchet MS', Arial, sans-serif;
    font-size: 0.88em;
    color: #444;
    border-bottom: 1px solid #ccc;
    padding-bottom: 4px;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.footer-widget p, .footer-widget li { font-size: 0.78em; color: #666; }
.footer-widget ul { list-style: none; padding: 0; }
.footer-widget ul li { padding: 2px 0; }
.footer-widget a { color: #467aa7; }

#footer-bottom {
    text-align: center;
    border-top: 1px solid #ccc;
    padding-top: 10px;
    font-size: 0.75em;
    color: #888;
}

/* ==========================================================================
   MOBILE TOGGLE
   ========================================================================== */

.nav-toggle {
    display: none;
    background: #467aa7;
    color: #fff;
    border: none;
    padding: 8px 12px;
    font-size: 1.1em;
    cursor: pointer;
    width: 100%;
    text-align: left;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 840px) {
    #content-wrapper { flex-direction: column; }
    #sidebar-left { width: 100%; border-right: none; border-bottom: 1px solid #ddd; padding: 8px 0; }
    #sidebar-right { width: 100%; border-left: none; border-top: 1px solid #ddd; display: flex; flex-wrap: wrap; }
    .sidebar-block { flex: 1; min-width: 200px; }
    .home-categories { grid-template-columns: 1fr; }
    .footer-widgets { flex-direction: column; gap: 10px; }
}

@media (max-width: 600px) {
    #wrapper { box-shadow: none; }
    #site-name { font-size: 1.2em; }
    .nav-toggle { display: block; }
    #nav-primary ul { display: none; flex-direction: column; }
    #nav-primary ul.nav-open { display: flex; }
    #nav-primary ul li a { border-right: none; border-bottom: 1px solid #ccc; }
    #nav-primary ul ul { position: static; border: none; box-shadow: none; padding-left: 10px; }
    #nav-primary ul li:hover > ul { display: none; }
    #nav-primary ul li.nav-open > ul { display: flex; }
    .product-grid { grid-template-columns: repeat(2, 1fr); }
    .gallery-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ==========================================================================
   UTILITIES
   ========================================================================== */

.clearfix::after { content: ''; display: table; clear: both; }
.screen-reader-text { position: absolute; left: -9999px; }
.alignleft { float: left; margin-right: 16px; margin-bottom: 8px; }
.alignright { float: right; margin-left: 16px; margin-bottom: 8px; }
.aligncenter { display: block; margin: 0 auto 8px; }
