/* 1. MASTER RESET & FONTS */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: #fdfdfd;
    color: #333333;
    /* Because the footer is permanently hovering at the bottom, 
       we add padding to the bottom of the page. Reduced to 60px to match the new slim footer */
    padding-bottom: 60px !important; 
}

/* 2. TOP NAVIGATION BAR (MCMASTER OVERHAUL) */
.master-header {
    display: flex;
    flex-direction: column;
    padding: 15px 60px 25px 60px;
    background-color: #ffffff;
    border-bottom: 2px solid #cccccc;
    position: sticky !important;
    top: 0;
    z-index: 9999; 
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08); 
}

/* The Top Row: Phone & Email */
.header-utility {
    display: flex;
    justify-content: flex-end; 
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    font-size: 12px;
    font-weight: 500;
    color: #555555;
    flex-wrap: wrap; /* Keeps it clean on mobile */
}

.header-utility a {
    color: #555555;
    text-decoration: none;
    font-weight: 700;
}

.header-utility a:hover {
    color: #000000;
    text-decoration: underline;
}

.header-utility .divider {
    color: #cccccc;
    margin: 0 5px;
}

/* The Bottom Row: Logo, Search, Order */
.header-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

/* Left Zone: Logo Lockup */
.header-main .logo {
    flex: 1; 
    display: flex;
    align-items: center;
    gap: 15px; 
}

.header-main .logo h1 {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: 1px;
    color: #000000;
}

.brand-logo {
    height: 48px; 
    width: auto;
    object-fit: contain;
}

/* Middle Zone: Search Bar */
.search-container {
    flex: 2; 
    max-width: 700px;
    display: flex;
    margin: 0 40px;
}

.search-container input {
    width: 100%;
    padding: 12px 20px;
    border: 1px solid #999999; 
    border-radius: 4px 0 0 4px;
    outline: none;
    font-size: 14px;
}

.search-container button {
    padding: 0 25px;
    background-color: #000000;
    color: #ffffff;
    border: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.3s;
}

.search-container button:hover {
    background-color: #333333;
}

/* Right Zone: Order Button */
.header-actions {
    flex: 1; 
    display: flex;
    justify-content: flex-end;
}

.action-link {
    font-size: 18px;
    font-weight: 800;
    color: #444444; 
    text-decoration: none;
    letter-spacing: 0.5px;
}

.action-link:hover {
    text-decoration: underline;
}

nav ul {
    display: flex;
    list-style: none;
    gap: 40px;
}

nav ul li a {
    text-decoration: none;
    color: #555555;
    font-size: 14px;
    text-transform: uppercase;
    font-weight: 600;
}

nav ul li a:hover {
    color: #000000;
}

/* 3. DASHBOARD GRID SYSTEM */
.dashboard-layout {
    display: grid;
    grid-template-columns: 200px 1fr; 
    gap: 30px;
    padding: 40px 60px;
}

.sidebar h3 {
    font-size: 18px;
    margin-bottom: 20px;
    border-bottom: 2px solid #000;
    padding-bottom: 10px;
}

.sidebar ul {
    list-style: none;
}

.sidebar ul li {
    margin-bottom: 12px;
}

.sidebar ul li a {
    text-decoration: none;
    color: #666;
    transition: color 0.2s;
}

.sidebar ul li a:hover {
    color: #000;
    font-weight: 600;
}

/* 4. CATEGORY GRID SYSTEM */
.category-group {
    margin-bottom: 50px;
    scroll-margin-top: 140px; /* This prevents the sticky header from covering the title */
}

.category-group h2 {
    font-size: 22px;
    margin-bottom: 25px;
    border-bottom: 2px solid #eeeeee;
    padding-bottom: 10px;
    color: #000000;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); 
    gap: 15px; 
}

.card {
    background: transparent;
    border: none; 
    padding: 10px 5px; 
    text-align: center;
    cursor: pointer;
}

.card:hover h3 {
    text-decoration: underline;
    color: #0066cc;
}

.card img {
    height: 65px; 
    width: 100%;             
    object-fit: contain;     
    filter: grayscale(100%); 
    margin-bottom: 8px;
}

.card h3 {
    font-size: 12px; 
    color: #333333;
    font-weight: 500;
    line-height: 1.3;
}

/* 5. MCMASTER-CARR STYLE FOOTER (SLIM OVERHAUL) */
.site-footer {
    background-color: #ffffff;
    border-top: 1px solid #cccccc;
    padding: 15px 60px; 
    width: 100%;
    position: fixed !important;
    bottom: 0;
    left: 0;
    z-index: 9998; 
    box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.08); 
    display: flex;
    flex-direction: column; /* Changed to stack the new message properly */
    align-items: center;
    gap: 10px;
}

.footer-proactive-msg {
    color: #555555;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    letter-spacing: 0.3px;
}

.footer-bottom-row {
    display: flex;
    justify-content: space-between;
    width: 100%;
    align-items: center;
}

.site-footer .footer-nav {
    list-style: none;
    display: flex;
    flex-direction: row; 
    justify-content: flex-start;
    align-items: center;
    margin: 0;
    padding: 0;
}

.site-footer .footer-nav li {
    display: block;
    border-right: 1px solid #999999; 
    padding: 0 15px;
}

.site-footer .footer-nav li:first-child {
    padding-left: 0; 
}

.site-footer .footer-nav li:last-child {
    border-right: none; 
}

.site-footer .footer-nav li a {
    text-decoration: none;
    color: #000000; 
    font-size: 14px;
}

.site-footer .footer-nav li a:hover {
    text-decoration: underline;
    color: #0066cc; 
}

/* Footer Legal Text */
.footer-legal {
    color: #888888;
    font-size: 13px;
}

.footer-legal a {
    color: #888888;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.2s ease, text-decoration 0.2s ease;
}

.footer-legal a:hover {
    color: #000000;
    text-decoration: underline;
}

/* 6. INTERNAL TEXT PAGES (Locations, Returns, etc.) */
.page-banner {
    background-color: #333333; 
    color: #ffffff;
    text-align: center;
    padding: 60px 20px;
    margin-bottom: 50px;
}

.page-banner h1 {
    font-size: 36px;
    font-weight: 700;
    letter-spacing: 1px;
}

.page-content {
    max-width: 900px; 
    margin: 0 auto; 
    padding: 0 40px 60px 40px;
    color: #222222;
    line-height: 1.6;
}

.page-content h2 {
    font-size: 26px;
    font-weight: 700;
    margin-top: 40px;
    margin-bottom: 15px;
    color: #000000;
}

.page-content h3 {
    font-size: 18px;
    font-weight: 700;
    margin-top: 30px;
    margin-bottom: 10px;
    color: #000000;
}

.page-content p {
    font-size: 15px;
    margin-bottom: 20px;
}

.address-block {
    font-size: 15px;
    margin-bottom: 20px;
}

.contact-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 40px;
}

.contact-links a {
    text-decoration: none;
    color: #000000;
    font-weight: 700;
    font-size: 14px;
}

.contact-links a:hover {
    color: #0066cc;
    text-decoration: underline;
}

/* 7. SMOOTH SCROLLING & HIGHLIGHT EFFECTS */
html {
    scroll-behavior: smooth; 
}

.category-group:target h2 {
    color: #0066cc; 
    border-bottom: 2px solid #0066cc;
    transition: color 0.3s, border-bottom 0.3s;
}

/* 8. MOBILE RESPONSIVENESS (iPhone & Tablets) */
@media (max-width: 800px) {
    
    .master-header {
        padding: 15px 20px; 
    }
    
    .header-utility {
        justify-content: center; 
    }

    .header-main {
        flex-direction: column; 
        gap: 15px;
    }

    .search-container {
        margin: 0;
        width: 100%; 
    }

    .header-actions {
        justify-content: center;
    }

    .dashboard-layout {
        grid-template-columns: 1fr; 
        padding: 20px; 
        gap: 20px;
    }

    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); 
        gap: 10px;
    }

    .site-footer {
        padding: 15px 20px;
        flex-direction: column;
        justify-content: center;
        gap: 12px;
        text-align: center;
    }

    .site-footer .footer-nav {
        flex-wrap: wrap; 
        justify-content: center;
        row-gap: 15px;
    }

    .site-footer .footer-nav li {
        border-right: none; 
        padding: 0 10px;
    }
}

/* 9. MCMASTER-STYLE SEARCH RESULTS */
.mcmaster-results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr; 
    gap: 40px;
    margin-top: 30px;
}

.result-card {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.result-img img {
    width: 120px;
    height: auto;
    object-fit: contain;
}

.result-details h3 a {
    color: #0066cc;
    font-size: 18px;
    font-weight: 600;
    text-decoration: none;
    margin-bottom: 8px;
    display: block;
}

.result-details h3 a:hover {
    text-decoration: underline;
}

.result-details .desc {
    font-size: 14px;
    color: #333333;
    line-height: 1.4;
    margin-bottom: 12px;
}

.result-details .price {
    font-size: 18px;
    font-weight: 800;
    color: #000000;
    margin-bottom: 15px;
}

.buy-btn {
    background-color: #2e6b34;
    color: #ffffff;
    padding: 8px 16px;
    text-decoration: none;
    font-weight: 700;
    font-size: 13px;
    border-radius: 3px;
}

.buy-btn:hover {
    background-color: #214f25;
}

@media (max-width: 800px) {
    .mcmaster-results-grid {
        grid-template-columns: 1fr; 
    }
}

/* 10. PREDICTIVE AUTO-SUGGEST STYLING */
.autocomplete-items {
    position: absolute;
    border: 1px solid #d4d4d4;
    border-top: none;
    z-index: 99;
    top: 100%; 
    left: 0;
    right: 120px; 
    background-color: #ffffff;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
    border-radius: 0 0 4px 4px;
}

.autocomplete-items div {
    padding: 12px;
    cursor: pointer;
    font-size: 15px;
    color: #333333;
    border-bottom: 1px solid #eeeeee;
    text-align: left;
}

.autocomplete-items div:hover {
    background-color: #f0f8ff; 
    color: #0066cc;
}

/* 11. TRUE MCMASTER-CARR GRID LAYOUT */
#mcmaster-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); 
    gap: 15px; 
    padding-top: 15px;
}

.mcmaster-card {
    display: flex;
    flex-direction: row; 
    background: #ffffff;
    border: 1px solid #d4d4d4; 
    padding: 15px; 
    cursor: default;
    transition: border-color 0.2s;
}

.mcmaster-card:hover {
    border-color: #999999; 
}

.mcmaster-image {
    flex: 0 0 100px; 
    margin-right: 15px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.mcmaster-image img {
    max-width: 100%;
    max-height: 100px;
    object-fit: contain;
}

.mcmaster-details {
    flex: 1; 
    display: flex;
    flex-direction: column;
}

.mcmaster-title {
    font-size: 15px; 
    color: #333333;
    margin: 0 0 8px 0;
    font-weight: bold;
    line-height: 1.3;
}

.mcmaster-specs {
    list-style-type: none;
    padding: 0;
    margin: 0 0 15px 0;
    flex-grow: 1; 
}

.mcmaster-specs li {
    font-size: 13px;
    color: #555555;
    margin-bottom: 4px;
    line-height: 1.4;
    position: relative;
    padding-left: 10px;
}

.mcmaster-specs li::before {
    content: "-";
    position: absolute;
    left: 0;
    color: #888888;
}

.mcmaster-buy-section {
    display: flex;
    justify-content: space-between; 
    align-items: center;
    margin-top: auto;
    padding-top: 12px;
    border-top: 1px solid #eeeeee; 
    gap: 10px; 
}

.mcmaster-price {
    font-size: 17px; 
    font-weight: bold;
    color: #000000;
    white-space: nowrap; 
}

.mcmaster-btn {
    background-color: #e4e4e4; 
    color: #333333;
    border: 1px solid #cccccc;
    padding: 8px 10px; 
    font-size: 11px; 
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    white-space: nowrap; 
}

.mcmaster-btn:hover {
    background-color: #000000; 
    color: #ffffff; 
    border-color: #000000;
}

@media screen and (max-width: 768px) {
    #mcmaster-results-grid {
        grid-template-columns: 1fr; 
    }
}

/* 12. AI LOADING PULSE EFFECT */
.loading-pulse {
    animation: ai-pulse 1.5s infinite ease-in-out;
    color: #888888;
}

@keyframes ai-pulse {
    0% { opacity: 0.4; }
    50% { opacity: 1; }
    100% { opacity: 0.4; }
}

/* 13. CART & CAPSULE */
.cart-badge {
    position: absolute;
    top: -10px;
    right: -15px;
    background: #d32f2f;
    color: white;
    border-radius: 50%;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: bold;
    display: none; 
}

.qty-capsule {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    background: #e0e0e0;
    border: 1px solid #ccc;
    border-radius: 2px;
    width: 130px; 
    height: 35px; 
    box-sizing: border-box;
    font-weight: bold;
}

.qty-capsule button {
    background: transparent;
    border: none;
    width: 35px;
    height: 100%;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.qty-capsule button:hover {
    background: #d0d0d0;
}

.qty-capsule span {
    flex: 1;
    text-align: center;
    font-size: 14px;
}

/* 14. SEARCH STATUS & INDUSTRIAL ALERT BOX */
#search-status {
    margin-bottom: 20px;
    font-size: 14px;
    font-weight: 500;
}

/* The clean, McMaster-style warning box */
.industrial-alert {
    background-color: #fffbe6; /* Pale, utilitarian yellow */
    color: #5c4c00; /* Dark mustard text for crisp contrast */
    padding: 12px 20px;
    border: 1px solid #ffe58f;
    border-left: 4px solid #faad14; /* Solid warning accent line */
    border-radius: 3px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    display: inline-block;
    width: 100%;
    margin-top: 15px;
    box-sizing: border-box;
}

/* =======================================================
   15. MOBILE-ONLY EMERGENCY OVERRIDES (Phones & Tablets)
   ======================================================= */
@media (max-width: 800px) {
    
    /* 1. FIX THE VIEWPORT CRUSH (Un-stick the footer) */
    body {
        padding-bottom: 0 !important; /* Removes the dead space at the bottom */
    }
    .site-footer {
        position: static !important; /* Lets the footer scroll away naturally */
        box-shadow: none;
        margin-top: 40px;
    }

    /* 2. FIX HORIZONTAL SCROLL (Wrap the navigation links) */
    nav ul {
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
        margin-top: 10px;
    }

    /* 3. FIX THE DROPDOWN WIDTH (Snap to search bar width) */
    .autocomplete-items {
        right: 0;
        width: 100%;
    }

    /* 4. FIX MCMASTER CARD SQUISH (Stack image on top of text) */
    .mcmaster-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    .mcmaster-image {
        margin-right: 0;
        margin-bottom: 15px;
    }
    .mcmaster-details {
        width: 100%;
    }
    .mcmaster-specs {
        text-align: left; /* Keeps bullet points readable */
        display: inline-block;
        width: 100%;
    }
    .mcmaster-buy-section {
        flex-direction: column; /* Stacks Price and Button */
        width: 100%;
        gap: 15px;
    }
    .mcmaster-btn {
        width: 100%; /* Makes the buy button wide for easy thumb tapping */
        padding: 12px;
        font-size: 14px;
    }

    /* 5. FIX THE CHECKOUT SQUISH (Stack Cart and Checkout Form) */
    .container {
        flex-direction: column;
        padding: 0 20px;
        gap: 20px;
        margin-top: 20px;
    }
    .cart-section, .checkout-pane {
        width: 100%;
        flex: none; /* Stops them from trying to split the screen 50/50 */
    }

    /* 6. CLEAN UP HEADER CRAMP (Hide extra text, keep Phone/Email) */
    .header-utility span {
        display: none; /* Hides "Standard Delivery", "Net-30", and "|" dividers */
    }
    .header-utility {
        justify-content: center;
        gap: 20px;
        padding-bottom: 5px;
    }
    .header-main .logo {
        justify-content: center;
    }

    /* 7. FIX FOOTER ALIGNMENT */
    .footer-bottom-row {
        flex-direction: column;
        gap: 15px;
    }
    .footer-legal {
        text-align: center;
    }
}

