/* =========================================
   PHARMA DIRECTORY STYLES (Modern V4)
   ========================================= */
   
:root {
    --pharma-green: #10b981;
    --pharma-red: #c51b1b;
    --pharma-blue: #0b5c9c;
    --pharma-orange: #f58220;
    --pharma-bg: #f8fafc;
    --border-light: #e5e7eb;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --primary-blue: #2563eb;
}

body { 
    background-color: var(--pharma-bg); 
    font-family: 'Inter', -apple-system, sans-serif;
}

.company-directory-container {
    max-width: 98%; 
    width: 100%;
    margin: 30px auto;
    padding: 0 15px;
    box-sizing: border-box;
}

/* =========================================
   1. TOP SEARCH & FILTER BAR
   ========================================= */
.top-filter-wrapper {
    background: #fff;
    padding: 20px 0 10px 0;
    margin-bottom: 25px;
}

.filter-flex-box {
    display: flex;
    align-items: center;
    border: 1px solid var(--pharma-green);
    border-radius: 6px;
    overflow: hidden;
    max-width: 100%;
}

.location-box {
    display: flex;
    align-items: center;
    padding: 0 15px;
    width: 30%;
    min-width: 200px;
    border-right: 1px solid var(--border-light);
    background: #fff;
}

.keyword-box {
    display: flex;
    align-items: center;
    width: 70%;
    background: #fff;
}

.live-search-input {
    flex-grow: 1;
    border: none;
    padding: 14px 20px;
    font-size: 15px;
    outline: none;
}

/* New Inline View Toggles */
.inline-view-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0 15px;
    border-left: 1px solid var(--border-light);
    border-right: 1px solid var(--border-light);
}
.inline-view-toggle .view-btn {
    background: transparent;
    border: none;
    color: #cbd5e1;
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: color 0.2s;
}
.inline-view-toggle .view-btn.active, 
.inline-view-toggle .view-btn:hover { 
    color: var(--primary-blue); 
}

.btn-live-search {
    background: var(--pharma-green);
    color: #fff;
    border: none;
    padding: 0 35px;
    height: 50px;
    cursor: pointer;
    font-size: 18px;
    transition: background 0.2s;
}
.btn-live-search:hover { background: #059669; }

/* Company Count */
.results-count-text {
    text-align: right;
    font-size: 13.5px;
    color: var(--text-muted);
    margin-top: 10px;
    font-weight: 500;
}
.results-count-text span {
    color: var(--text-main);
    font-weight: 700;
    font-size: 15px;
}

/* Select2 Dropdown Overrides */
.location-box .select2-container { width: 100% !important; }
.location-box .select2-selection--single {
    border: none !important;
    background: transparent !important;
    height: 45px !important;
    display: flex !important;
    align-items: center !important;
}
.location-box .select2-selection__rendered { padding-left: 0 !important; font-size: 15px; color: #333 !important; }
.location-box .select2-selection__arrow { top: 10px !important; }


/* =========================================
   2. MAIN 3-COLUMN GRID LAYOUT
   ========================================= */
.company-directory-layout {
    display: grid;
    grid-template-columns: 200px 1fr 360px; 
    gap: 30px;
    align-items: start;
}

/* =========================================
   3. LEFT SIDEBAR (ADVERTISEMENTS)
   ========================================= */
#company-left-ad-sidebar { width: 100%; }
.sticky-ads { position: sticky; top: 20px; }
.ad-banner-slot { background: #fff; border: 1px solid var(--border-light); border-radius: 8px; padding: 10px; text-align: center; box-shadow: 0 2px 4px rgba(0,0,0,0.02); }
.ad-label { display: block; font-size: 10px; text-transform: uppercase; color: #94a3b8; margin-bottom: 8px; letter-spacing: 0.5px; }
.ad-placeholder { background: #f1f5f9; border: 1px dashed #cbd5e1; border-radius: 4px; display: flex; align-items: center; justify-content: center; color: #64748b; font-size: 13px; font-weight: 600; }
.ad-placeholder img { max-width: 100%; height: auto; border-radius: 4px; }

/* =========================================
   4. RIGHT SIDEBAR (STICKY LEAD FORM)
   ========================================= */
.sticky-form { 
    position: sticky; top: 20px; background: #fff; border-radius: 8px; 
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); border: 1px solid var(--border-light); overflow: hidden;
}

/* =========================================
   5. LIST VS GRID VIEW LISTINGS
   ========================================= */
.company-list.list-view { display: flex; flex-direction: column; gap: 20px; }
.company-list.grid-view { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }

/* =========================================
   6. COMPANY CARD DESIGN
   ========================================= */
.company-card-new { 
    background: #fff; border: 1px solid var(--border-light); display: flex; padding: 25px; 
    position: relative; overflow: hidden; border-radius: 8px; transition: box-shadow 0.2s;
}
.company-card-new:hover { box-shadow: 0 4px 15px rgba(0,0,0,0.05); }
.company-card-new.is-premium { border-top: 3px solid #f59e0b; }

.corner-ribbon {
    width: 120px; background: #f59e0b; color: #fff; text-align: center; 
    font-size: 10px; font-weight: bold; position: absolute; top: 18px; left: -30px; 
    transform: rotate(-45deg); padding: 5px 0; text-transform: uppercase; letter-spacing: 1px;
}

.card-left-logo { 
    width: 140px; height: 140px; margin-right: 25px; display: flex; align-items: center; 
    justify-content: center; border: 1px solid #f1f5f9; padding: 10px; border-radius: 6px;
    background: #fff; flex-shrink: 0;
}
.card-left-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
.placeholder-icon { font-size: 40px; color: #cbd5e1; }

.card-right-content { flex: 1; min-width: 0; }
.company-title-new { margin: 0 0 10px; font-size: 20px; font-weight: 700; line-height: 1.3; }
.company-title-new a { color: var(--text-main); text-decoration: none; transition: color 0.2s;}
.company-title-new a:hover { color: var(--primary-blue); }

.company-meta-new { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; display: flex; gap: 20px; flex-wrap: wrap; }
.company-meta-new strong { color: var(--text-main); font-weight: 600; }
.company-excerpt { font-size: 14px; color: #475569; margin-bottom: 20px; line-height: 1.5; }

.card-action-buttons { display: flex; gap: 12px; flex-wrap: wrap; }
.btn-action { 
    padding: 10px 18px; border: none; color: #fff; font-weight: 600; font-size: 13px; 
    border-radius: 6px; cursor: pointer; text-decoration: none; display: inline-flex; 
    align-items: center; justify-content: center; gap: 8px; transition: opacity 0.2s; 
}
.btn-action:hover { opacity: 0.9; color: #fff; }
.btn-contact { background: var(--pharma-green); flex: 1; }
.btn-catalog { background: var(--pharma-red); flex: 1;}

.company-list.grid-view .company-card-new { flex-direction: column; align-items: center; text-align: center; padding: 30px 20px; }
.company-list.grid-view .card-left-logo { margin: 0 0 20px 0; }
.company-list.grid-view .company-meta-new { justify-content: center; flex-direction: column; gap: 6px; }
.company-list.grid-view .card-action-buttons { flex-direction: column; width: 100%; }
.company-list.grid-view .card-action-buttons .btn-action { width: 100%; }

/* =========================================
   7. BEAUTIFUL PAGINATION
   ========================================= */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 40px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    padding: 0 10px;
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 15px;
    text-decoration: none;
    transition: all 0.2s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}
.pagination .page-numbers:hover {
    background: #f1f5f9;
    color: var(--primary-blue);
    border-color: #cbd5e1;
}
.pagination .page-numbers.current {
    background: var(--primary-blue);
    color: #fff;
    border-color: var(--primary-blue);
    box-shadow: 0 4px 6px -1px rgba(37,99,235,0.2);
}
.pagination .next, .pagination .prev { font-weight: 700; padding: 0 15px;}

/* =========================================
   8. RESPONSIVE & MOBILE DESIGN
   ========================================= */
@media (max-width: 1200px) {
    .company-directory-layout { grid-template-columns: 1fr 340px; }
    #company-left-ad-sidebar { display: none; }
}

@media (max-width: 991px) {
    .company-directory-layout { display: flex; flex-direction: column; gap: 20px; }
    #company-main-content { order: 1; width: 100%; }
    #company-right-sidebar { order: 2; width: 100%; margin-top: 10px; }
    #company-left-ad-sidebar { display: none; }

    .sticky-form { position: relative; top: 0; }
    
    .filter-flex-box { flex-direction: column; border: none; gap: 10px; }
    .location-box, .keyword-box { width: 100%; border: 1px solid var(--pharma-green); border-radius: 6px; }
    .inline-view-toggle { border-left: none; }
    
    .results-count-text { text-align: center; margin-top: 15px; }

    .company-list.list-view .company-card-new { flex-direction: column; align-items: center; text-align: center; }
    .company-list.list-view .card-left-logo { margin: 0 0 20px 0; }
    .company-list.list-view .company-meta-new { justify-content: center; }
    .company-list.list-view .card-action-buttons { flex-direction: column; }
    .company-list.list-view .card-action-buttons .btn-action { width: 100%; }
}