* { box-sizing: border-box; margin: 0; padding: 0; font-family: sans-serif; }

body { 
    /* Changed from 20px all around, to 0 on top, 20px right, 20px bottom, 20px left */
    padding: 0 20px 20px 20px; 
    background-color: #ffffff; 
}

.container {
    width: 100%;
    /* Changed from 10px top/bottom to 0 on top/bottom */
    padding: 0; 
}

/* Top Banner Styling (Mini-Grid) */
.top-banner-placeholder {
    width: 100%;
    display: flex;
    gap: 20px;
    justify-content: flex-start; /* This aligns your thumbs perfectly to the left! */
    align-items: center;
    background: transparent; /* Removes the ugly grey box */
    border: none; /* Removes the dashed line */
}

/* Give the thumbnails a polished look */
.top-banner-placeholder img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Header Flexbox Layout */
.main-header {
    display: flex;
    align-items: center; /* Centers the right column vertically with the logo */
    justify-content: flex-start; 
    gap: 40px; /* Space between the logo and the right column */
    margin-bottom: 25px;
    margin-top: 20px; /* Adds a little breathing room at the very top of the page */
}

/* Right Column (Banner + Search) */
.header-right-column {
    display: flex;
    flex-direction: column; 
    gap: 15px; 
    width: 100%; 
    flex-grow: 1; /* NEW: This tells the column to expand and fill all leftover space */
}

/* Top Banner Styling */
.top-banner-placeholder {
    width: 100%;
    height: 90px;
    background-color: #f4f4f4;
    border: 1px dashed #ccc; /* Dashed border so it looks like a placeholder */
    display: flex;
    align-items: center;
    justify-content: center;
    color: #aaa;
    font-size: 14px;
    letter-spacing: 1px;
    border-radius: 4px;
}

/* Search Bar Sizing */
.search-form {
    display: flex;
    gap: 5px;
    width: 100%;
}

.search-form input {
    padding: 12px 15px;
    border: 1px solid #ccc;
    border-radius: 4px;
    flex-grow: 1; /* Magically forces the input box to stretch to the exact width of the banner above it */
    font-size: 16px;
}

.search-form input:focus {
    border-color: #003366;
    outline: none;
}

.search-form button {
    padding: 12px 25px;
    background: #003366;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: background-color 0.2s;
}

.search-form button:hover {
    background: #002244;
}

/* Header Layout */
header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end; /* Keeps search bar level with logo bottom on desktop */
    margin-bottom: 20px;
}

/* Logo Sizing */
.logo { 
    display: flex; 
    align-items: center;
    flex-shrink: 0; /* NEW: Stops the search column from squashing the logo */
    min-width: 180px; /* NEW: Forces the logo to always be at least this wide */
}

.logo img {
    max-width: 300px; 
    width: 100%;      
    height: auto;     
}

.search-bar {
    padding: 10px;
    width: 50%;
    border: 1px solid #ccc;
    border-radius: 20px;
    outline: none; 
}

.search-bar:focus {
    border-color: #003366; 
}

/* Desktop Pill Navigation Default */
nav {
    display: flex;
    justify-content: flex-start; 
    flex-wrap: wrap; 
    gap: 12px; 
    margin-bottom: 30px;
    border-bottom: 2px solid #eee;
    padding-bottom: 15px;
}

nav a { 
    text-decoration: none; 
    color: #333; 
    white-space: nowrap;
    font-size: 14px; 
    padding: 8px 18px; 
    background-color: #f0f0f0; 
    border-radius: 20px; 
    border: 1px solid #ddd;
    transition: all 0.2s ease; 
}

nav a:hover {
    background-color: #e0e0e0;
    border-color: #ccc;
    color: #000;
}

/* Main Grid Layout (Desktop Default) */
.main-layout {
    display: grid;
    grid-template-columns: 200px 1fr 200px;
    gap: 10px;
}

/* Product Grid (Desktop Default - Locked to 4 Columns) */
.product-grid > div {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 10px 10px;
    width: 100%;
}

/* Card Styles (Upgraded for Live Data) */
.card {
    border: 1px solid #e0e0e0; 
    background: #fff;
    display: flex;
    flex-direction: column;
    border-radius: 8px; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.05); 
    overflow: hidden; /* Keeps the image neatly inside the curved borders */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    text-decoration: none; /* In case we wrap it in a link later */
}

.card:hover {
    transform: translateY(-4px); /* Slight lifting effect when hovered */
    box-shadow: 0 6px 12px rgba(0,0,0,0.1);
}

.card-img {
    width: 100%;
    height: 180px;
    object-fit: contain; /* This guarantees the whole image stays visible */
    background-color: #f4f4f4; /* Fills in the blank space if the image is narrow */
    display: flex;
    align-items: center;
    justify-content: center;
    color: #aaa;
}

.card-content {
    padding: 15px;
}

.card-title {
    font-size: 15px;
    color: #333;
    margin-bottom: 8px;
}

.card-price {
    font-size: 18px;
    font-weight: bold;
    color: #003366;
}

.card-category {
    font-size: 12px;
    color: #888;
    margin-top: 10px;
}

/* Keep the ad boxes simple */
.ad-card {
    aspect-ratio: 1/1; 
    margin-bottom: 15px;
    background-color: #f9f9f9; 
    border: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #aaa;
    box-shadow: none; 
}

/* Sidebar Menu Styling (Category Page) */
.sidebar-menu {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    height: fit-content; /* Stops the box from stretching too far down */
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.sidebar-menu h3 {
    margin-bottom: 15px;
    font-size: 16px;
    color: #003366;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}

.sidebar-menu ul {
    list-style: none; /* Removes the default bullet points */
    padding: 0;
}

.sidebar-menu li {
    margin-bottom: 12px;
}

.sidebar-menu a {
    text-decoration: none;
    color: #555;
    font-size: 14px;
    transition: color 0.2s ease;
}

.sidebar-menu a:hover {
    color: #003366;
    font-weight: bold;
}

/* Form Styling */
.form-container {
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.form-container h2 {
    margin-bottom: 20px;
    color: #003366;
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
}

.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 8px;
    font-weight: bold;
    color: #333;
    font-size: 14px;
}

.form-group input, 
.form-group select, 
.form-group textarea {
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
    font-family: inherit;
}

.form-group input:focus, 
.form-group select:focus, 
.form-group textarea:focus {
    border-color: #003366;
    outline: none;
}

.btn-submit {
    background-color: #003366;
    color: white;
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    width: 100%;
    transition: background-color 0.2s;
}

.btn-submit:hover {
    background-color: #002244;
}

/* Detailed Listing Page Layout */
.listing-page-layout {
    grid-template-columns: 1fr 1fr; /* Splitting into two equal halves */
    gap: 40px;
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.listing-image-container {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.main-product-img {
    width: 100%;
    max-height: 500px;
    object-fit: contain; /* Ensures the photo is completely intact */
    border-radius: 6px;
    background-color: #f9f9f9;
    border: 1px solid #eee;
}

.no-image-placeholder {
    width: 100%;
    height: 350px;
    background: #f4f4f4;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #aaa;
    border-radius: 6px;
}

/* Details Panel Styling */
.listing-details-container {
    display: flex;
    flex-direction: column;
}

.detail-category-badge {
    align-self: flex-start;
    background-color: #f0f0f0;
    color: #666;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 4px;
    margin-bottom: 12px;
    text-transform: uppercase;
    font-weight: bold;
    border: 1px solid #ddd;
}

.detail-title {
    font-size: 28px;
    color: #333;
    margin-bottom: 15px;
    line-height: 1.2;
}

.detail-price {
    font-size: 32px;
    font-weight: bold;
    color: #003366;
    margin-bottom: 20px;
}

.seller-info {
    font-size: 13px;
    color: #777;
    border-bottom: 1px solid #eee;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.detail-description-box h3 {
    font-size: 16px;
    color: #333;
    margin-bottom: 10px;
}

.detail-description-box p {
    font-size: 15px;
    color: #555;
    line-height: 1.6;
    margin-bottom: 30px;
}

.btn-contact {
    display: block;
    text-align: center;
    background-color: #003366;
    color: white;
    text-decoration: none;
    padding: 15px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 4px;
    transition: background-color 0.2s;
    margin-top: auto; /* Pushes the button to the absolute bottom of the box */
}

.btn-contact:hover {
    background-color: #002244;
}

/* Navigation Split Layout */
.main-nav {
    display: flex;
    justify-content: space-between; /* Pushes the left and right groups to opposite ends */
    align-items: center; /* Keeps everything vertically centered */
    margin-bottom: 20px;
    border-bottom: 2px solid #f0f0f0; /* Optional: Adds a nice divider line under the menu */
    padding-bottom: 15px;
}

.nav-categories {
    display: flex;
    flex-wrap: wrap; /* Allows pills to drop to a new line on small screens */
    gap: 10px;
}

/* Category Pill Styling */
.nav-pill {
    background-color: #f4f4f4;
    color: #333;
    padding: 8px 16px;
    border-radius: 20px;
    text-decoration: none;
    font-size: 14px;
    transition: background-color 0.2s;
}

.nav-pill:hover {
    background-color: #e0e0e0;
}

/* Auth Buttons (Red & White) */
.nav-user-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-auth {
    background-color: #cc0000; /* Deep red */
    color: #ffffff !important; /* Forces text to be white */
    padding: 8px 18px;
    border-radius: 4px; /* Square corners like a standard button */
    text-decoration: none;
    font-weight: bold;
    font-size: 14px;
    transition: background-color 0.2s;
}

.btn-auth:hover {
    background-color: #990000; /* Darker red when hovered */
}

/* Mobile responsive fix for the listing page */
@media (max-width: 768px) {
    .listing-page-layout {
        grid-template-columns: 1fr; /* Stack image above data on tablet/mobile */
        gap: 20px;
    }
}

/* =========================================
   MOBILE RESPONSIVENESS (MEDIA QUERIES) 
   ========================================= */

/* Tablet / Smaller Desktop */
@media (max-width: 1100px) {
    /* Drop center grid to 3 columns so cards don't get too narrow */
    .product-grid > div {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

@media (max-width: 900px) {
    /* Stack the whole page: Left Ads -> Main Grid -> Right Ads */
    .main-layout {
        grid-template-columns: 1fr;
    }
    
    /* Make ads display side-by-side (2 across) to save vertical space */
    .left-ads, .right-ads {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        margin-bottom: 20px;
    }

    /* FIX: Force the title to span across both columns so it doesn't act like an ad! */
    .sponsors-title {
        grid-column: 1 / -1;
    }
    
    .ad-card { 
        margin-bottom: 0; 
    }
}

/* Phones */
@media (max-width: 600px) {
    /* FIX: Targets the main header class and stacks it cleanly */
    .main-header {
        flex-direction: column;
        align-items: center; /* Centers the logo nicely on top */
        gap: 15px;
    }
    
    .search-bar { width: 100%; }

    nav {
        flex-wrap: wrap; 
        justify-content: center; 
        gap: 8px; 
        padding-bottom: 15px;
    }
    
    nav a {
        font-size: 13px;
        padding: 6px 14px;
    }

    /* Drop center grid to 2 columns for phones */
    .product-grid > div {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* Very Small Phones */
@media (max-width: 400px) {
    /* Stack everything into 1 single column */
    .product-grid > div { 
        grid-template-columns: 1fr !important; 
    }
    .left-ads, .right-ads { 
        grid-template-columns: 1fr; 
    }
}

/* =========================================
   FOOTER STYLES (Upgraded Layout)
   ========================================= */
.main-footer {
    background-color: #002244; 
    color: #ffffff;
    margin-top: 50px;
    padding-top: 40px;
    border-top: 4px solid #cc0000; 
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: grid;
    /* This gives the About section 2 parts of the space, and the links 1 part each */
    grid-template-columns: 2fr 1fr 1fr; 
    gap: 40px;
}

/* Push the middle column slightly to the center */
.footer-column:nth-child(2) {
    justify-self: center;
}

/* Push the final Support column cleanly to the far right edge */
.footer-column:last-child {
    justify-self: end;
}

.footer-column h3 {
    font-size: 18px;
    margin-bottom: 20px;
    color: #f4f4f4;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.footer-column p {
    color: #cccccc;
    line-height: 1.6;
    font-size: 14px;
    max-width: 400px; /* Keeps the text from stretching too far */
}

.footer-column ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-column ul li {
    margin-bottom: 12px;
}

.footer-column ul li a {
    color: #cccccc;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}

.footer-column ul li a:hover {
    color: #ffffff;
    text-decoration: underline;
}

/* Make it stack into 1 column on mobile phones */
@media (max-width: 768px) {
    .footer-container {
        grid-template-columns: 1fr;
    }
    
    /* Reset the alignments so they sit on the left for mobile */
    .footer-column:nth-child(2),
    .footer-column:last-child {
        justify-self: start;
    }
}

/* Sponsors Label Styling */
.sponsors-title {
    text-align: center;
    font-size: 12px;
    text-transform: uppercase;
    color: #888888;
    letter-spacing: 1.5px;
    margin-bottom: 10px;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 5px;
}

/* =========================================
   FOOTER LINK STYLING
   ========================================= */
/* Targets every single link inside the footer */
.main-footer a {
    color: #ffffff; /* Bright white for high contrast */
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s ease, opacity 0.2s ease;
}

/* Hover effect so users know it is clickable */
.main-footer a:hover {
    color: #cccccc; /* Dims slightly to light grey */
    text-decoration: underline;
}

/* Specifically styles the links inside your bulleted lists */
.footer-column ul li {
    margin-bottom: 12px;
}

/* If you ever add links to the very bottom copyright bar */
.footer-bottom a {
    color: #ffffff;
    font-weight: bold;
}