/* ===================================================================
   SGPE GATEWAY 1.0 - B2B TRADE & DIRECTORY STYLING
   Unified Brand Palette: White (#FFFFFF) / Navy (#17365D) / Red SGPE (#D00507)
   =================================================================== */

.gateway-hero {
    background: #0A1128;
    background-image:
        radial-gradient(circle at 15% 20%, rgba(30, 64, 175, 0.28) 0%, transparent 45%),
        radial-gradient(circle at 85% 70%, rgba(14, 116, 144, 0.2) 0%, transparent 50%);
    color: #FFFFFF;
    padding: 60px 0 50px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.gateway-metrics-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-top: 36px;
}

.metric-card {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.metric-icon {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.15);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.metric-data h4 {
    font-size: 1.6rem;
    font-weight: 800;
    color: #FFFFFF;
    line-height: 1.1;
}

.metric-data span {
    font-size: 0.8rem;
    color: #CBD5E1;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* TABS & SEARCH BAR */
.gateway-nav-tabs {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 30px 0 20px;
    border-bottom: 2px solid #E2E8F0;
    padding-bottom: 2px;
}

.tab-btn {
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 700;
    color: #64748B;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: -4px;
}

.tab-btn:hover {
    color: var(--sgpe-navy, #17365D);
}

.tab-btn.active {
    color: var(--sgpe-navy, #17365D);
    border-bottom-color: var(--sgpe-navy, #17365D);
}

.gateway-filter-box {
    background: #FFFFFF;
    border: 1px solid var(--sgpe-border);
    border-radius: var(--sgpe-radius);
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: var(--sgpe-shadow);
}

.filter-grid {
    display: grid;
    grid-template-columns: 2fr 1.5fr 1fr auto;
    gap: 14px;
    align-items: center;
}

.form-control {
    width: 100%;
    padding: 11px 16px;
    border: 1px solid var(--sgpe-border);
    border-radius: 8px;
    font-size: 0.92rem;
    outline: none;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-control:focus {
    border-color: var(--sgpe-navy, #17365D);
    box-shadow: 0 0 0 3px rgba(23, 54, 93, 0.12);
}

/* ENTERPRISE DIRECTORY CARDS */
.enterprise-card {
    background: #FFFFFF;
    border: 1px solid var(--sgpe-border);
    border-radius: var(--sgpe-radius);
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.3s ease;
    position: relative;
}

.enterprise-card:hover {
    border-color: var(--sgpe-navy, #17365D);
    box-shadow: var(--sgpe-shadow-lg);
    transform: translateY(-4px);
}

.enterprise-header {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.corp-logo-box {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    border: 1px solid #E2E8F0;
    padding: 4px;
    background: #FAFAFA;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.corp-badge-test {
    background: #FEF3C7;
    color: #92400E;
    font-size: 0.72rem;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-block;
    margin-bottom: 6px;
}

.corp-name {
    font-size: 1.12rem;
    font-weight: 700;
    color: var(--sgpe-navy-dark);
    line-height: 1.3;
}

.corp-industry {
    font-size: 0.82rem;
    color: var(--sgpe-text-muted);
    margin-top: 4px;
}

.corp-products {
    font-size: 0.88rem;
    color: var(--sgpe-text-secondary);
    margin: 12px 0 16px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.corp-action-links {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #F1F5F9;
    flex-wrap: wrap;
}

.btn-pill-kit {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    background: #EFF6FF;
    color: #1D4ED8;
    border: 1px solid #BFDBFE;
}

.btn-pill-showroom {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    background: #FDF2F8;
    color: #BE185D;
    border: 1px solid #FBCFE8;
}

/* TRADE DEMAND CARDS */
.demand-card {
    background: #FFFFFF;
    border: 1px solid var(--sgpe-border);
    border-radius: var(--sgpe-radius);
    padding: 22px;
    margin-bottom: 16px;
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
}

.demand-card:hover {
    border-color: var(--sgpe-navy, #17365D);
    box-shadow: var(--sgpe-shadow);
}

.badge-buy {
    background: #F1F5F9;
    color: var(--sgpe-navy, #17365D);
    border: 1px solid #CBD5E1;
    font-size: 0.75rem;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 4px;
    text-transform: uppercase;
}

.badge-sell {
    background: #ECFDF5;
    color: #047857;
    border: 1px solid #A7F3D0;
    font-size: 0.75rem;
    font-weight: 800;
    padding: 3px 10px;
    border-radius: 4px;
    text-transform: uppercase;
}

.demand-main h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--sgpe-navy, #17365D);
    margin: 8px 0;
}

.demand-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.85rem;
    color: var(--sgpe-text-muted);
    margin-bottom: 10px;
}

/* MATCH SCORE BAR */
.match-score-badge {
    background: #FEF3C7;
    color: #92400E;
    border: 1px solid #FCD34D;
    border-radius: 6px;
    padding: 6px 12px;
    font-weight: 800;
    font-size: 0.88rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.match-bar-wrap {
    width: 100%;
    height: 8px;
    background: #E2E8F0;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 6px;
}

.match-bar-fill {
    height: 100%;
    background: var(--sgpe-navy, #17365D);
    border-radius: 4px;
}

/* MODAL STYLING */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(23, 54, 93, 0.75);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
}

.modal-card {
    background: #FFFFFF;
    border-radius: 12px;
    width: 100%;
    max-width: 600px;
    box-shadow: 0 25px 50px -12px rgba(23, 54, 93, 0.25);
    overflow: hidden;
    animation: modalSlide 0.25s ease-out;
}

@keyframes modalSlide {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-header {
    background: var(--sgpe-navy, #17365D);
    color: #FFFFFF;
    padding: 18px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: #94A3B8;
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-close:hover {
    color: #FFFFFF;
}

.modal-body {
    padding: 24px;
    max-height: 80vh;
    overflow-y: auto;
}

@media (max-width: 768px) {
    .gateway-metrics-bar {
        grid-template-columns: 1fr 1fr;
    }
    .filter-grid {
        grid-template-columns: 1fr;
    }
    .demand-card {
        flex-direction: column;
    }
}

/* ============================================================
   GATEWAY FILTER BAR – RESPONSIVE FLEX IMPROVEMENTS
   ============================================================ */

/* Ensure select options display full text – no clipping */
.gateway-filter-box .form-control {
    min-width: 0;
    width: 100%;
    text-overflow: ellipsis;
}

/* Reset button styling */
.gateway-filter-box .btn-outline[href*="?tab="] {
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
.gateway-filter-box .btn-outline[href*="?tab="]:hover {
    background: #F1F5F9;
    color: #334155;
    border-color: #94A3B8;
}

/* Status bar spacing – margin-top ensures gap from filter box */
#tab-directory > div[style*="justify-content: space-between"] {
    margin-top: 20px !important;
}

/* Tablet: filter bar wraps at 2 rows */
@media (max-width: 900px) {
    .gateway-filter-box form > div {
        flex-direction: column;
    }
    .gateway-filter-box form > div > div[style*="flex:"],
    .gateway-filter-box form > div > div[style*="flex-shrink"] {
        flex: 1 1 100% !important;
        min-width: 0 !important;
    }
    .gateway-filter-box form > div > div[style*="flex-shrink"] {
        flex-direction: row;
        flex-wrap: wrap;
    }
}

/* Mobile: all full-width */
@media (max-width: 600px) {
    .gateway-filter-box {
        padding: 14px;
    }
    .gateway-filter-box form > div > div[style*="flex-shrink"] button,
    .gateway-filter-box form > div > div[style*="flex-shrink"] a {
        flex: 1;
        text-align: center;
        justify-content: center;
    }
}
