/*
Theme Name: CertiConnect - UAE B2B Directory
Description: Core responsive styles, layout grid, and specific component styling for the CertiSource Directory.
*/

/* --- 1. Global Setup and Typography --- */
:root {
    /* MOCKUP COLORS */
    --primary-color: #0d47a1; /* Deep Blue (Accents, Links) */
    --secondary-color: #ffc107; /* Gold/Yellow (CTAs, accents) */
    --background-dark: #212529; /* DARK HEADER/FOOTER (MOCKUP COLOR) */
    --page-background: #ffffff; /* Pure White (MOCKUP PAGE BACKGROUND) */
    --card-background: #fcfcfc; /* Slightly Off-White for Cards */
    --text-dark: #1f2937;
    --text-light: #ffffff;
    --card-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    --success-green: #28a745;
    --border-light: #e0e0e0;
}

html {
    box-sizing: border-box;
}
*, *:before, *:after {
    box-sizing: inherit;
}

body {
    margin: 0;
    /* --- FONT FIX: Using imported Poppins --- */
    font-family: 'Poppins', sans-serif;
    background-color: var(--page-background);
    color: var(--text-dark);
    line-height: 1.6;
}

h1, h2, h3, h4 {
    color: #0d47a1; /* Deep Blue Headings */
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

/* Site Title is hidden via CSS */
.site-title {
    display: none !important;
}

.site-header a {
    color: var(--text-light);
    transition: color 0.2s;
}

.site-header a:hover {
    color: var(--secondary-color);
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
}

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

.site-content {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1rem;
}

/* --- Buttons and Primary CTA --- */
button, .button, .cta-button {
    background-color: var(--primary-color);
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    text-transform: uppercase;
    font-size: 0.9em;
    font-weight: 600;
    margin-top: 10px;
    display: inline-block;
    transition: background-color 0.2s, transform 0.2s;
}

button:hover, .button:hover, .cta-button:hover {
    background-color: #ffc107; /* Gold Hover */
    color: var(--text-dark);
    transform: translateY(-1px);
}

.button-secondary {
    background-color: #4b5563; /* Gray secondary */
}

.button-secondary:hover {
    background-color: #6b7280;
    color: white;
}

/* --- 2. Header and Navigation Styling --- */

.site-header {
    background-color: var(--background-dark); /* MOCKUP DARK HEADER */
    color: var(--text-light);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.site-header-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Secondary Top Menu Bar (Top Bar) */
.secondary-navigation-wrapper {
    background-color: var(--background-dark);
    color: var(--text-light);
    width: 100%;
    /* Ensure only top bar items are affected */
    border-bottom: 1px solid rgba(255, 255, 255, 0.1); 
}

.secondary-navigation ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: none; /* Hidden by default on mobile */
    
}

.secondary-navigation li {
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.site-header a {
    color: var(--text-light);
    transition: color 0.2s;
}

.site-header a:hover {
    color: var(--secondary-color);
}

.site-branding {
    text-align: center;
    padding: 10px 0;
}

.site-description {
    display: none; /* Hide on small screens */
}

/* Mobile Menu Toggle */
.main-navigation {
    width: 100%;
}

.menu-toggle {
    background: var(--secondary-color);
    color: var(--text-dark);
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    display: block; 
    width: 100%;
    margin-bottom: 10px;
}

.main-navigation ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: none; /* Hidden by default on mobile */
   
}

.main-navigation li {
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.main-navigation li a {
    display: block;
    padding: 5px 10px;
}

/* Mobile Toggled State */
.main-navigation.toggled ul {
    display: flex; /* Show when toggled */
}

/* --- 3. Footer and Widget Styling --- */

.site-footer {
    background-color: var(--background-dark); /* MOCKUP DARK FOOTER */
    color: #cccccc;
    padding: 40px 20px;
    margin-top: 40px;
}

.site-footer a {
    color: #cccccc;
}

.footer-widgets {
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 20px;
    display: flex;
    flex-direction: column; 
    gap: 20px;
}

.widget {
    margin-bottom: 20px;
    padding: 10px; /* Padding for mobile view */
}

.widget-title {
    color: var(--secondary-color);
    font-size: 1.2rem;
    margin-bottom: 15px;
    border-bottom: 2px solid var(--secondary-color);
    padding-bottom: 5px;
}

.site-info-and-nav {
    display: flex;
    flex-direction: column;
    text-align: center;
}

.footer-menu-list {
    list-style: none;
    padding: 0;
    margin: 10px 0 0 0;
}

.footer-menu-list li {
    display: block;
    padding: 5px 0;
}

/* --- 4. Front Page Specific Styling --- */

.hero-section {
    background-color: var(--primary-color);
    color: white;
    padding: 4rem 1rem;
    text-align: center;
    border-radius: 1rem;
    margin-top: 2rem;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.hero-section h1 {
    font-size: 2.5rem; /* Larger font */
    font-weight: 800;
    margin-bottom: 1rem;
    color: white;
}

.hero-section .subtitle {
    font-size: 1.125rem;
    margin-bottom: 2rem;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.cta-button {
    background-color: var(--secondary-color);
    color: var(--text-dark);
    font-weight: 700;
    font-size: 1.1rem;
    padding: 0.75rem 2rem;
    border-radius: 0.5rem;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.2s, transform 0.2s;
}

.cta-button:hover {
    background-color: #ffeb3b; /* Lighter hover */
    transform: translateY(-1px);
}

/* Feature Strip Styling */
.feature-strip {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 2rem 0;
    text-align: center;
}

.feature-item {
    padding: 1rem;
    background: #ffffff;
    border-radius: 0.75rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.feature-item h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

/* Registration Form Card Styling */
.certisource-registration-page {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem 1rem;
}

#certisource-registration-form {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    max-width: 500px;
    width: 100%;
}

#certisource-registration-form h2 {
    text-align: center;
    color: var(--primary-color);
    margin-top: 0;
}

#certisource-registration-form label {
    font-weight: 600;
    margin-top: 15px;
    margin-bottom: 5px;
    display: block;
    color: var(--text-dark);
    font-size: 0.95rem;
}

#certisource-registration-form input[type="text"],
#certisource-registration-form input[type="email"],
#certisource-registration-page input[type="password"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    background-color: #f9f9f9;
}

#certisource-registration-form input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(13, 71, 161, 0.2);
    outline: none;
    background-color: white;
}

#certisource-registration-form button[type="submit"] {
    width: 100%;
    margin-top: 25px;
    padding: 14px;
    background-color: var(--secondary-color);
    color: var(--text-dark);
    font-size: 1.1rem;
    font-weight: 700;
    border: none;
}

#certisource-registration-form button[type="submit"]:hover {
    background-color: #ffeb3b;
    transform: translateY(-2px);
}

/* --- 5. Custom Post Type Layouts (Mobile First) --- */

.directory-grid {
    display: flex;
    flex-direction: column; /* Stack on mobile */
    gap: 20px;
    margin-top: 2rem;
}

.listing-summary, .card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: var(--card-shadow);
}

/* Verified Badge Styles (Image Mockup Match) */
.verification-wrap {
    margin-top: 10px;
}

.verification-badge {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.85em;
}

.verified-pro {
    background-color: var(--success-green); /* Match success green from mockup */
    color: white;
    text-transform: uppercase;
}

.unverified {
    background-color: #dc3545;
    color: white;
}

/* Certification Tag Styling (ISO 9001, OHSAS 18001) */
.certification-tag {
    display: inline-block;
    background-color: #e3f2fd; /* Light blue background */
    color: var(--primary-color);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 600;
    margin-right: 5px;
    margin-top: 5px;
}

/* RFQ Sidebar Container Styling */
.rfq-sidebar {
    background: #ffffff; /* White background for clean form */
    border: 1px solid #e0e0e0;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

/* RFQ Form Styling */
.rfq-sidebar form label {
    font-weight: 600;
    margin-top: 15px;
    margin-bottom: 5px;
    display: block;
    color: var(--text-dark);
}

.rfq-sidebar form input[type="text"],
.rfq-sidebar form input[type="email"],
.rfq-sidebar form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.rfq-sidebar form input:focus,
.rfq-sidebar form textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(13, 71, 161, 0.2);
    outline: none;
}

/* Filter Dropdown Styling */
.filter-sidebar label {
    display: block;
    font-weight: 600;
    margin-top: 15px;
    margin-bottom: 5px;
    font-size: 0.95rem;
    color: #1f2937;
}

/* Apply styling to the dropdowns (select elements generated by wp_dropdown_categories) */
.filter-sidebar select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    background-color: white;
    appearance: none; 
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%230d47a1%22%20d%3D%22M287%20197.35L146.2%2056.55%205.4%20197.35l-5.4%205.4%205.4%205.4%20140.8%20140.8%20140.8-140.8%205.4-5.4z%22%2F%3E%3C%2Fsvg%3E'); 
    background-repeat: no-repeat;
    background-position: right 10px top 50%;
    background-size: 10px auto;
}

.filter-sidebar select:focus {
    border-color: #0d47a1;
    box-shadow: 0 0 0 2px rgba(13, 71, 161, 0.2);
    outline: none;
}


.listing-results {
    flex: 1; /* Take remaining space */
}

/* Project Portfolio Gallery Display */
.project-gallery {
    /* Use Grid to display images side-by-side */
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 15px;
    border-top: 1px solid var(--border-light);
    padding-top: 15px;
}

.project-gallery img {
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* --- 6. Responsive Rules (Desktop/Tablet) --- */

@media screen and (min-width: 768px) {
    
    /* SECONDARY MENU BAR (Top Bar Menu) */
    .secondary-navigation-wrapper .secondary-navigation ul {
        display: flex;
        justify-content: flex-end;
        align-items: center;
        padding: 5px 0;
        list-style: none;
        margin: 0; 
    }
    
    .secondary-navigation-wrapper .secondary-navigation li {
        padding: 0 10px;
        border-bottom: none;
        list-style: none;
        display: inline-block;
        font-size: 0.85rem;
    }
    
    /* Header/Nav Desktop */
    .site-header-inner {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 15px 0;
        max-width: 1280px; 
        margin: 0 auto;
    }
    .site-branding {
        text-align: left;
        padding: 0;
    }
    .menu-toggle {
        display: none; 
    }
    .main-navigation {
        width: auto;
    }
    .main-navigation ul {
        /* CRITICAL: Guarantees horizontal display for Primary Menu */
        display: flex !important; 
        flex-wrap: nowrap; 
        align-items: center;
        padding: 0;
    }
    .main-navigation li {
        border-bottom: none;
        padding: 0 10px;
        white-space: nowrap; 
        list-style: none;
        display: inline-block; 
        line-height: 1; 
        margin: 0; 
    }
    .main-navigation li a {
        padding: 8px 10px; 
        line-height: 1;
        display: block; 
    }

    /* Footer Widget Desktop Grid */
    .footer-widgets {
        flex-direction: row;
        justify-content: space-between;
    }
    .widget {
        flex-basis: 22%; 
    }
    .site-info-and-nav {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    .footer-menu-list {
        display: flex;
        gap: 15px;
    }


    /* Front Page Feature Strip */
    .feature-strip {
        flex-direction: row;
    }

    /* Archive/Search Page Layout (Two Columns) */
    .certisource-archive .directory-grid {
        /* CRITICAL FIX: Enforce Flexbox on main archive container */
        display: flex; 
        flex-direction: row;
        gap: 30px;
        align-items: flex-start; 
    }

    .certisource-archive .filter-sidebar {
        /* Apply Card Styling to Sidebar */
        background: white;
        padding: 20px;
        border-radius: 8px;
        box-shadow: var(--card-shadow);
        
        flex: 0 0 25%;
        position: sticky; 
        top: 20px;
        
        display: block; 
    }

    /* Target the form directly for horizontal layout */
    .certisource-archive .filter-sidebar form {
        display: block; 
        gap: 0;
        align-items: flex-start;
    }
    
    /* Make the select/label groups take full width and stack vertically (MOCKUP STYLE) */
    .certisource-archive .filter-sidebar > form > div {
        flex: none; 
        min-width: 100%; 
        margin-bottom: 10px;
    }

    .certisource-archive .listing-results {
        flex: 1; 
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 20px;
    }
    
    /* Ensure summary cards themselves match mockup card styles */
    .listing-summary {
        padding: 20px;
        background: white;
        border-radius: 8px;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
        border: 1px solid #eee;
    }

    /* Single Listing Page Layout (Two Columns) */
    .certisource-single-listing .content-wrapper {
        display: flex; 
        flex-direction: row;
        gap: 30px;
        align-items: flex-start;
    }

    .certisource-single-listing .listing-content {
        /* Apply Card Styling to Main Content */
        background: white;
        padding: 30px;
        border-radius: 8px;
        box-shadow: var(--card-shadow);
        border: 1px solid var(--border-light);
        
        flex: 0 0 calc(65% - 15px); 
    }

    .certisource-single-listing .rfq-sidebar {
        flex: 0 0 calc(35% - 15px); 
        position: sticky;
        top: 20px;
    }
}

/* --- Styling for Edit Listing Page --- */

.certisource-edit-page {
    /* Container to center the form on the page */
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem 1rem;
    margin: 20px 0;
}

#certisource-edit-form {
    /* The main form card styling */
    background: var(--page-background); /* White */
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    max-width: 800px; /* Wider than registration for more content */
    width: 100%;
}

#certisource-edit-form h2 {
    color: var(--primary-color);
    margin-top: 0;
    border-bottom: 2px solid var(--border-light);
    padding-bottom: 10px;
    margin-bottom: 20px;
}

#certisource-edit-form label {
    font-weight: 600;
    margin-top: 15px;
    margin-bottom: 5px;
    display: block;
    color: var(--text-dark);
    font-size: 0.95rem;
}

/* Apply professional styling to form inputs (same as registration/RFQ) */
#certisource-edit-form input[type="text"],
#certisource-edit-form input[type="email"],
#certisource-edit-form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    background-color: #f9f9f9;
}

#certisource-edit-form input:focus,
#certisource-edit-form textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(13, 71, 161, 0.2);
    outline: none;
    background-color: white;
}

#certisource-edit-form .submit-button {
    width: auto;
    margin-top: 25px;
    padding: 10px 30px;
    background-color: var(--secondary-color);
    color: var(--text-dark);
    font-size: 1.0rem;
    font-weight: 700;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}


/* --- Sector Showcase Styling (Homepage) --- */

.sector-showcase {
    padding: 2rem 0 4rem; /* More vertical padding for white space */
}

.sector-showcase h2 {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 2rem;
    color: var(--text-dark); /* Darker heading for the section */
}

.sector-grid {
    display: grid;
    /* Responsive grid: stacks on mobile, uses 3-4 columns on desktop */
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.sector-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    
    /* Card Styling */
    background: var(--page-background);
    padding: 25px 15px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08); /* Standard card shadow */
    border: 1px solid var(--border-light);
    
    /* Ensure the entire card is clickable */
    text-decoration: none;
    color: var(--text-dark);
    transition: transform 0.2s, box-shadow 0.2s, background-color 0.2s;
}

.sector-card:hover {
    transform: translateY(-5px); /* Lift effect on hover */
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15); /* Enhanced shadow */
    background-color: var(--card-background); /* Slight color change */
    color: var(--primary-color);
}

.sector-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.sector-icon span.dashicons {
    /* Styles for the default WordPress Dashicons placeholder */
    width: 3rem;
    height: 3rem;
}

.sector-name {
    font-weight: 700;
    font-size: 1.1rem;
    margin: 0;
    line-height: 1.2;
}

.listing-count {
    font-size: 0.85rem;
    color: #6c757d;
    margin: 5px 0 0;
}


/* --- Styling for Latest Suppliers List (front-page.php) --- */

.latest-listings-section {
    padding: 3rem 1rem;
    background-color: var(--card-background); /* Slight background separation */
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
}

.latest-listings-section .section-title {
    text-align: center;
    font-size: 1.8rem;
    margin-bottom: 2rem;
}

.latest-listings-grid {
    display: flex;
    flex-direction: column;
    gap: 15px; /* Vertical stacking */
    max-width: 900px;
    margin: 0 auto;
}

/* Reusing the listing-summary card style for latest suppliers */
.latest-listings-grid .listing-summary {
    background: var(--page-background);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05); /* Lighter shadow for the list */
    border: 1px solid var(--border-light);
}

.latest-listings-grid .listing-summary h2 a {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
}

.latest-listings-section .text-center {
    margin-top: 2rem;
}

/* --- LATEST SUPPLIERS LIST LAYOUT FIX --- */

.latest-listings-grid .listing-summary {
    /* Set up the main card as a horizontal Flex container */
    display: flex;
    flex-direction: column; /* Default: Stack on mobile */
    align-items: flex-start;
    gap: 20px;
}

@media screen and (min-width: 992px) {
    .latest-listings-grid .listing-summary {
        flex-direction: row; /* Horizontal on desktop */
        justify-content: space-between;
        align-items: center; /* Center the logo vertically with the content */
        padding: 30px; /* More padding for desktop view */
    }
    
    .latest-listings-grid .summary-content-details {
        /* Left content takes up most space */
        flex: 1; 
        min-width: 65%;
    }

    .latest-listings-grid .summary-logo-wrap {
        /* Logo area (Right side) */
        flex: 0 0 auto; /* Takes only the space required by the logo */
        max-width: 200px;
        text-align: right; /* Pushes the logo to the right edge of its container */
    }

    /* Grid for Meta Data (Address, Sector, etc.) */
    .summary-details-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr); /* Two columns for meta data */
        gap: 10px 20px;
        margin-bottom: 15px;
    }
    
    .summary-details-grid .detail-item strong {
        display: block; /* Ensure label is above value */
        color: #6c757d; /* Lighter color for label */
        font-weight: 500;
        font-size: 0.85rem;
    }
    .summary-details-grid .detail-item p {
        margin: 0;
        font-weight: 600;
        font-size: 0.95rem;
    }

    /* Logo Image Styling */
    .supplier-logo-thumb {
        width: 100%; /* Fill the max-width of 200px */
        height: auto;
        max-width: 200px;
        object-fit: contain;
        border: 1px solid #eee;
        border-radius: 4px;
    }
}

/* --- 4. Front Page Specific Styling --- */

.hero-section {
    background-color: var(--primary-color);
    color: white;
    padding: 4rem 1rem;
    text-align: center;
    border-radius: 1rem;
    margin-top: 2rem;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.hero-section h1 {
    font-size: 2.5rem; /* Larger font */
    font-weight: 800;
    margin-bottom: 1rem;
    color: white;
}

.hero-section .subtitle {
    font-size: 1.125rem;
    margin-bottom: 2rem;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.cta-button {
    background-color: var(--secondary-color);
    color: var(--text-dark);
    font-weight: 700;
    font-size: 1.1rem;
    padding: 0.75rem 2rem;
    border-radius: 0.5rem;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.2s, transform 0.2s;
}

.cta-button:hover {
    background-color: #ffeb3b; /* Lighter hover */
    transform: translateY(-1px);
}

/* Feature Strip Styling */
.feature-strip {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 2rem 0;
    text-align: center;
}

.feature-item {
    padding: 1rem;
    background: #ffffff;
    border-radius: 0.75rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.feature-item h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

/* Registration Form Card Styling */
.certisource-registration-page {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem 1rem;
}

#certisource-registration-form {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    max-width: 500px;
    width: 100%;
}

#certisource-registration-form h2 {
    text-align: center;
    color: var(--primary-color);
    margin-top: 0;
}

#certisource-registration-form label {
    font-weight: 600;
    margin-top: 15px;
    margin-bottom: 5px;
    display: block;
    color: var(--text-dark);
    font-size: 0.95rem;
}

#certisource-registration-form input[type="text"],
#certisource-registration-form input[type="email"],
#certisource-registration-page input[type="password"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    background-color: #f9f9f9;
}

#certisource-registration-form input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(13, 71, 161, 0.2);
    outline: none;
    background-color: white;
}

#certisource-registration-form button[type="submit"] {
    width: 100%;
    margin-top: 25px;
    padding: 14px;
    background-color: var(--secondary-color);
    color: var(--text-dark);
    font-size: 1.1rem;
    font-weight: 700;
    border: none;
}

#certisource-registration-form button[type="submit"]:hover {
    background-color: #ffeb3b;
    transform: translateY(-2px);
}

/* --- 5. Custom Post Type Layouts (Mobile First) --- */

.directory-grid {
    display: flex;
    flex-direction: column; /* Stack on mobile */
    gap: 20px;
    margin-top: 2rem;
}

.listing-summary, .card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: var(--card-shadow);
}

/* Verified Badge Styles (Image Mockup Match) */
.verification-wrap {
    margin-top: 10px;
}

.verification-badge {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 0.85em;
}

.verified-pro {
    background-color: var(--success-green); /* Match success green from mockup */
    color: white;
    text-transform: uppercase;
}

.unverified {
    background-color: #dc3545;
    color: white;
}

/* Certification Tag Styling (ISO 9001, OHSAS 18001) */
.certification-tag {
    display: inline-block;
    background-color: #e3f2fd; /* Light blue background */
    color: var(--primary-color);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8em;
    font-weight: 600;
    margin-right: 5px;
    margin-top: 5px;
}

/* RFQ Sidebar Container Styling */
.rfq-sidebar {
    background: #ffffff; /* White background for clean form */
    border: 1px solid #e0e0e0;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

/* RFQ Form Styling */
.rfq-sidebar form label {
    font-weight: 600;
    margin-top: 15px;
    margin-bottom: 5px;
    display: block;
    color: var(--text-dark);
}

.rfq-sidebar form input[type="text"],
.rfq-sidebar form input[type="email"],
.rfq-sidebar form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.rfq-sidebar form input:focus,
.rfq-sidebar form textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(13, 71, 161, 0.2);
    outline: none;
}

/* Filter Dropdown Styling */
.filter-sidebar label {
    display: block;
    font-weight: 600;
    margin-top: 15px;
    margin-bottom: 5px;
    font-size: 0.95rem;
    color: #1f2937;
}

/* Apply styling to the dropdowns (select elements generated by wp_dropdown_categories) */
.filter-sidebar select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
    background-color: white;
    appearance: none; 
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%230d47a1%22%20d%3D%22M287%20197.35L146.2%2056.55%205.4%20197.35l-5.4%205.4%205.4%205.4%20140.8%20140.8%20140.8-140.8%205.4-5.4z%22%2F%3E%3C%2Fsvg%3E'); 
    background-repeat: no-repeat;
    background-position: right 10px top 50%;
    background-size: 10px auto;
}

.filter-sidebar select:focus {
    border-color: #0d47a1;
    box-shadow: 0 0 0 2px rgba(13, 71, 161, 0.2);
    outline: none;
}


.listing-results {
    flex: 1; /* Take remaining space */
}

/* Project Portfolio Gallery Display */
.project-gallery {
    /* Use Grid to display images side-by-side */
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 10px;
    margin-top: 15px;
    border-top: 1px solid var(--border-light);
    padding-top: 15px;
}

.project-gallery img {
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* --- 6. Responsive Rules (Desktop/Tablet) --- */

@media screen and (min-width: 768px) {
    
    /* SECONDARY MENU BAR (Top Bar Menu) */
    .secondary-navigation-wrapper .secondary-navigation ul {
        display: flex;
        justify-content: flex-end;
        align-items: center;
        padding: 5px 0;
        list-style: none;
        margin: 0; 
    }
    
    .secondary-navigation-wrapper .secondary-navigation li {
        padding: 0 10px;
        border-bottom: none;
        list-style: none;
        display: inline-block;
        font-size: 0.85rem;
    }
    
    /* Header/Nav Desktop */
    .site-header-inner {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 15px 0;
        max-width: 1280px; 
        margin: 0 auto;
    }
    .site-branding {
        text-align: left;
        padding: 0;
    }
    .menu-toggle {
        display: none; 
    }
    .main-navigation {
        width: auto;
    }
    .main-navigation ul {
        /* CRITICAL: Guarantees horizontal display for Primary Menu */
        display: flex !important; 
        flex-wrap: nowrap; 
        align-items: center;
        padding: 0;
    }
    .main-navigation li {
        border-bottom: none;
        padding: 0 10px;
        white-space: nowrap; 
        list-style: none;
        display: inline-block; 
        line-height: 1; 
        margin: 0; 
    }
    .main-navigation li a {
        padding: 8px 10px; 
        line-height: 1;
        display: block; 
    }

    /* Footer Widget Desktop Grid */
    .footer-widgets {
        flex-direction: row;
        justify-content: space-between;
    }
    .widget {
        flex-basis: 22%; 
    }
    .site-info-and-nav {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    .footer-menu-list {
        display: flex;
        gap: 15px;
    }


    /* Front Page Feature Strip */
    .feature-strip {
        flex-direction: row;
    }

    /* Archive/Search Page Layout (Two Columns) */
    .certisource-archive .directory-grid {
        /* CRITICAL FIX: Enforce Flexbox on main archive container */
        display: flex; 
        flex-direction: row;
        gap: 30px;
        align-items: flex-start; 
    }

    .certisource-archive .filter-sidebar {
        /* Apply Card Styling to Sidebar */
        background: white;
        padding: 20px;
        border-radius: 8px;
        box-shadow: var(--card-shadow);
        
        flex: 0 0 25%;
        position: sticky; 
        top: 20px;
        
        display: block; 
    }

    /* Target the form directly for horizontal layout */
    .certisource-archive .filter-sidebar form {
        display: block; 
        gap: 0;
        align-items: flex-start;
    }
    
    /* Make the select/label groups take full width and stack vertically (MOCKUP STYLE) */
    .certisource-archive .filter-sidebar > form > div {
        flex: none; 
        min-width: 100%; 
        margin-bottom: 10px;
    }

    .certisource-archive .listing-results {
        flex: 1; 
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 20px;
    }
    
    /* Ensure summary cards themselves match mockup card styles */
    .listing-summary {
        padding: 20px;
        background: white;
        border-radius: 8px;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
        border: 1px solid #eee;
    }

    /* Single Listing Page Layout (Two Columns) */
    .certisource-single-listing .content-wrapper {
        display: flex; 
        flex-direction: row;
        gap: 30px;
        align-items: flex-start;
    }

    .certisource-single-listing .listing-content {
        /* Apply Card Styling to Main Content */
        background: white;
        padding: 30px;
        border-radius: 8px;
        box-shadow: var(--card-shadow);
        border: 1px solid var(--border-light);
        
        flex: 0 0 calc(65% - 15px); 
    }

    .certisource-single-listing .rfq-sidebar {
        flex: 0 0 calc(35% - 15px); 
        position: sticky;
        top: 20px;
    }
}

/* --- Styling for Edit Listing Page --- */

.certisource-edit-page {
    /* Container to center the form on the page */
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem 1rem;
    margin: 20px 0;
}

#certisource-edit-form {
    /* The main form card styling */
    background: var(--page-background); /* White */
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    max-width: 800px; /* Wider than registration for more content */
    width: 100%;
}

#certisource-edit-form h2 {
    color: var(--primary-color);
    margin-top: 0;
    border-bottom: 2px solid var(--border-light);
    padding-bottom: 10px;
    margin-bottom: 20px;
}

#certisource-edit-form label {
    font-weight: 600;
    margin-top: 15px;
    margin-bottom: 5px;
    display: block;
    color: var(--text-dark);
    font-size: 0.95rem;
}

/* Apply professional styling to form inputs (same as registration/RFQ) */
#certisource-edit-form input[type="text"],
#certisource-edit-form input[type="email"],
#certisource-edit-form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    background-color: #f9f9f9;
}

#certisource-edit-form input:focus,
#certisource-edit-form textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(13, 71, 161, 0.2);
    outline: none;
    background-color: white;
}

#certisource-edit-form .submit-button {
    width: auto;
    margin-top: 25px;
    padding: 10px 30px;
    background-color: var(--secondary-color);
    color: var(--text-dark);
    font-size: 1.0rem;
    font-weight: 700;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}


/* --- Sector Showcase Styling (Homepage) --- */

.sector-showcase {
    padding: 2rem 0 4rem; /* More vertical padding for white space */
}

.sector-showcase h2 {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 2rem;
    color: var(--text-dark); /* Darker heading for the section */
}

.sector-grid {
    display: grid;
    /* Responsive grid: stacks on mobile, uses 3-4 columns on desktop */
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.sector-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    
    /* Card Styling */
    background: var(--page-background);
    padding: 25px 15px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08); /* Standard card shadow */
    border: 1px solid var(--border-light);
    
    /* Ensure the entire card is clickable */
    text-decoration: none;
    color: var(--text-dark);
    transition: transform 0.2s, box-shadow 0.2s, background-color 0.2s;
}

.sector-card:hover {
    transform: translateY(-5px); /* Lift effect on hover */
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15); /* Enhanced shadow */
    background-color: var(--card-background); /* Slight color change */
    color: var(--primary-color);
}

.sector-icon {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.sector-icon span.dashicons {
    /* Styles for the default WordPress Dashicons placeholder */
    width: 3rem;
    height: 3rem;
}

.sector-name {
    font-weight: 700;
    font-size: 1.1rem;
    margin: 0;
    line-height: 1.2;
}

.listing-count {
    font-size: 0.85rem;
    color: #6c757d;
    margin: 5px 0 0;
}


/* --- Styling for Latest Suppliers List (front-page.php) --- */

.latest-listings-section {
    padding: 3rem 1rem;
    background-color: var(--card-background); /* Slight background separation */
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
}

.latest-listings-section .section-title {
    text-align: center;
    font-size: 1.8rem;
    margin-bottom: 2rem;
}

.latest-listings-grid {
    display: flex;
    flex-direction: column;
    gap: 15px; /* Vertical stacking */
    max-width: 900px;
    margin: 0 auto;
}

/* Reusing the listing-summary card style for latest suppliers */
.latest-listings-grid .listing-summary {
    background: var(--page-background);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05); /* Lighter shadow for the list */
    border: 1px solid var(--border-light);
}

.latest-listings-grid .listing-summary h2 a {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
}

.latest-listings-section .text-center {
    margin-top: 2rem;
}

/* --- LATEST SUPPLIERS LIST LAYOUT FIX --- */

.latest-listings-grid .listing-summary {
    /* Set up the main card as a horizontal Flex container */
    display: flex;
    flex-direction: column; /* Default: Stack on mobile */
    align-items: flex-start;
    gap: 20px;
}

@media screen and (min-width: 992px) {
    .latest-listings-grid .listing-summary {
        flex-direction: row; /* Horizontal on desktop */
        justify-content: space-between;
        align-items: center; /* Center the logo vertically with the content */
        padding: 30px; /* More padding for desktop view */
    }
    
    .latest-listings-grid .summary-content-details {
        /* Left content takes up most space */
        flex: 1; 
        min-width: 65%;
    }

    .latest-listings-grid .summary-logo-wrap {
        /* Logo area (Right side) */
        flex: 0 0 auto; /* Takes only the space required by the logo */
        max-width: 200px;
        text-align: right; /* Pushes the logo to the right edge of its container */
    }

    /* Grid for Meta Data (Address, Sector, etc.) */
    .summary-details-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr); /* Two columns for meta data */
        gap: 10px 20px;
        margin-bottom: 15px;
    }
    
    .summary-details-grid .detail-item strong {
        display: block; /* Ensure label is above value */
        color: #6c757d; /* Lighter color for label */
        font-weight: 500;
        font-size: 0.85rem;
    }
    .summary-details-grid .detail-item p {
        margin: 0;
        font-weight: 600;
        font-size: 0.95rem;
    }

    /* Logo Image Styling */
    .supplier-logo-thumb {
        width: 100%; /* Fill the max-width of 200px */
        height: auto;
        max-width: 200px;
        object-fit: contain;
        border: 1px solid #eee;
        border-radius: 4px;
    }
}

/* --- Updates for Logo Alignment and Size on Single Listing Page --- */

/* Ensures the logo and text are side-by-side on desktop */
.certisource-single-listing .logo-and-title-area {
    display: flex;
    flex-direction: row; /* Logo and text side-by-side */
    justify-content: space-between;
    align-items: flex-start; /* Align content to the top */
    gap: 25px; /* Spacing between text and logo */
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-light);
    margin-bottom: 20px;
}

.certisource-single-listing .logo-detail-wrap {
    /* Right side container */
    flex: 0 0 200px; /* Allocate fixed width for the logo column */
    max-width: 200px;
    height: 200px; /* Enforce minimum height */
    text-align: right;
}

.certisource-single-listing .content-text-wrap {
    /* Left side content */
    flex: 1; 
    min-width: 0;
}

.certisource-single-listing .supplier-logo-detail {
    /* Styling for the image element */
    width: 200px;
    height: 200px;
    max-width: 100%;
    object-fit: contain; /* Ensures the logo fits without cropping */
    border: 1px solid var(--border-light);
    border-radius: 6px;
}