:root {
    --primary-color: #003366; /* Deep Navy Blue */
    --secondary-color: #FF9900; /* Industrial Orange */
    --text-color: #333333;
    --light-bg: #f5f7fa;
    --border-color: #e1e4e8;
    --font-heading: 'Roboto', 'Open Sans', sans-serif;
    --font-body: 'Open Sans', sans-serif;
}

body {
    font-family: var(--font-body);
    background-color: var(--light-bg);
    color: var(--text-color);
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--primary-color);
    font-weight: 700;
}

/* Header Tweaks */
header {
    background: #fff;
    border-bottom: 2px solid var(--primary-color);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

#top {
    background-color: #f8f8f8;
    border-bottom: 1px solid #ddd;
    color: #666;
    font-size: 12px;
}

#logo a {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Search Bar B2B Style */
#search .input-lg {
    border: 2px solid var(--primary-color);
    border-radius: 0;
    height: 45px;
}

#search .btn-lg {
    background-color: var(--primary-color);
    border: 2px solid var(--primary-color);
    color: #fff;
    border-radius: 0;
    height: 45px;
    padding: 0 20px;
}

/* Navigation - 3D Dynamic Menu */
#menu {
    background: linear-gradient(180deg, var(--primary-color) 0%, #002244 100%);
    border: none;
    border-bottom: 3px solid var(--secondary-color);
    border-radius: 0;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    min-height: 50px;
    margin-bottom: 20px;
}

#menu .nav > li > a {
    color: #fff;
    font-weight: 600;
    text-transform: capitalize;
    font-size: 13px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    padding: 10px 10px;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

/* Hover Effect with 3D Lift */
#menu .nav > li > a:hover {
    background: linear-gradient(180deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    text-shadow: 0 0 8px rgba(255,255,255,0.6);
}

/* Active State */
#menu .nav > li.open > a,
#menu .nav > li.active > a {
    background: rgba(0,0,0,0.2);
    box-shadow: inset 0 3px 5px rgba(0,0,0,0.3);
}

/* Dropdown Menu 3D Style */
#menu .dropdown-menu {
    background: #fff;
    border: none;
    border-top: 3px solid var(--secondary-color);
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    border-radius: 0 0 4px 4px;
    padding: 0;
    transform-origin: top;
    animation: dropdownSlide 0.3s ease;
}

@keyframes dropdownSlide {
    from { opacity: 0; transform: translateY(-10px) scaleY(0.9); }
    to { opacity: 1; transform: translateY(0) scaleY(1); }
}

#menu .dropdown-inner {
    display: block;
}

#menu .dropdown-inner a {
    display: block;
    padding: 10px 20px;
    clear: both;
    font-weight: normal;
    line-height: 1.42857143;
    color: #333;
    white-space: nowrap;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
}

#menu .dropdown-inner a:hover {
    color: var(--primary-color);
    background-color: var(--light-bg);
    padding-left: 28px; /* Dynamic movement */
    border-left: 3px solid var(--secondary-color);
}

#menu .see-all {
    display: block;
    margin-top: 0.5em;
    border-top: 1px solid #DDD;
    padding: 10px 20px;
    transition: all 0.2s;
}

#menu .see-all:hover {
    background-color: var(--light-bg);
    color: var(--primary-color);
}

/* Footer B2B Style */
footer {
    background-color: #222;
    color: #ccc;
    padding-top: 40px;
}

footer h5 {
    color: #fff;
    text-transform: uppercase;
    border-bottom: 2px solid var(--secondary-color);
    padding-bottom: 10px;
    margin-bottom: 20px;
    display: inline-block;
}

footer a {
    color: #ccc;
}

footer a:hover {
    color: var(--secondary-color);
}

/* Product Card B2B Enhancement */
.product-thumb {
    border: 1px solid var(--border-color);
    background: #fff;
    border-radius: 4px;
    transition: all 0.3s ease;
    margin-bottom: 20px;
}

.product-thumb:hover {
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transform: translateY(-2px);
    border-color: var(--secondary-color);
}

.product-thumb .image {
    padding: 10px;
}

.product-thumb .caption {
    padding: 15px;
    background: #fff;
}

/* Ensure title wrapping (incorporating previous fix logic) */
.product-thumb .caption h4 a {
    color: var(--primary-color);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    text-decoration: none;
    display: block; /* Ensure block for multiline */
    /* Wrapping handled by custom_title_fixed.css, but enforcing here too */
    white-space: normal !important; 
}

.product-thumb .price {
    color: var(--secondary-color);
    font-weight: bold;
    font-size: 18px;
    margin: 10px 0;
}

/* Buttons */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    border-radius: 2px;
    text-transform: uppercase;
    font-weight: 600;
}

.btn-primary:hover {
    background-color: #002244;
    border-color: #002244;
}

/* Inquiry / Cart Button */
.button-group button {
    border-radius: 0;
    background: #f5f5f5;
    border: 1px solid #ddd;
    color: #666;
}

.button-group button:hover {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
}

/* Breadcrumbs */
.breadcrumb {
    background: transparent;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
    margin-bottom: 20px;
}

.breadcrumb a {
    color: var(--primary-color);
}

/* Inquiry Form */
.inquiry-form-wrapper {
    background: #f9f9f9;
    padding: 20px;
    border: 1px solid #e1e4e8;
    border-radius: 4px;
    margin-top: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.inquiry-form-wrapper h3 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 18px;
    border-bottom: 2px solid var(--secondary-color);
    padding-bottom: 10px;
    display: inline-block;
}

.inquiry-form-wrapper .form-control {
    border-radius: 2px;
    box-shadow: none;
    border: 1px solid #ddd;
}

.inquiry-form-wrapper .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 5px rgba(0, 51, 102, 0.2);
}

.inquiry-form-wrapper #button-inquiry {
    margin-top: 10px;
    font-size: 16px;
    padding: 10px;
    background-color: var(--secondary-color); /* Orange for call to action */
    border-color: var(--secondary-color);
}

.inquiry-form-wrapper #button-inquiry:hover {
    background-color: #e68a00;
    border-color: #e68a00;
}

/* Product Grid Flexbox Fix - Enhanced */
.product-wrapper {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
}

/* Fix for pseudo-elements interfering with flexbox */
.product-wrapper:before,
.product-wrapper:after {
    display: none;
}

.product-wrapper .product-layout {
    display: flex !important;
    flex-direction: column;
    float: none; /* Let flexbox handle it, but fallback to float if flex fails? No, float:none disables float. */
    /* If we want fallback, we should NOT force float:none unless we are sure flex works. 
       But if flex works, float is ignored. 
       If flex FAILS, float is needed. 
       So we should REMOVE float: none !important. 
       Bootstrap sets float: left. */
    height: auto !important; /* Let flexbox handle height */
    margin-bottom: 30px; /* Add consistent spacing */
}

/* Float Fallback: Clear fixes for Grid Layout */
/* If Flexbox fails, these clears ensure correct wrapping */

/* 4 Columns (No Sidebars) */
.product-layout.col-lg-3:nth-child(4n+1),
.product-layout.col-md-3:nth-child(4n+1) {
    clear: left;
}

/* 3 Columns (One Sidebar) */
.product-layout.col-lg-4:nth-child(3n+1),
.product-layout.col-md-4:nth-child(3n+1) {
    clear: left;
}

/* 2 Columns (Two Sidebars or Small Screen) */
.product-layout.col-lg-6:nth-child(2n+1),
.product-layout.col-md-6:nth-child(2n+1),
.product-layout.col-sm-6:nth-child(2n+1) {
    clear: left;
}

.product-wrapper .product-thumb {
    height: 100%;
    display: flex;
    flex-direction: column;
    width: 100%;
    border: 1px solid #e1e4e8; /* Ensure border is visible */
    background: #fff;
}

.product-wrapper .product-thumb .caption {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    padding: 15px;
    height: 100%; /* Fill parent */
}

.product-wrapper .product-thumb .caption h4 {
    margin-top: 0;
    margin-bottom: 10px;
    min-height: 40px; /* Minimum height for titles to align */
}

.product-wrapper .product-thumb .caption p {
    flex-grow: 1; /* Push bottom elements down */
    margin-bottom: 15px;
}

.product-wrapper .product-thumb .button-group {
    margin-top: auto; /* Push button group to bottom */
    width: 100%;
    border-top: 1px solid #eee; /* Visual separation */
}

/* Sidebar Product Spacing Fix */
#column-left .product-wrapper .product-layout {
    margin-bottom: 0 !important;
    padding-bottom: 5px;
}
#column-left .product-thumb {
    margin-bottom: 10px !important;
}
