/* ============================================================
   COMPANY PAGE STYLES
   Add this block to the bottom of your existing style.css
   ============================================================ */

/* ── Layout ─────────────────────────────────────────────────── */
.company-page-wrapper {
    /* max-width and padding handled by .container from style.css */
    padding-bottom: 48px;
}

.company-body {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 28px;
    margin-top: 28px;
    align-items: start;
}

/* Prevent grid children from overflowing their column */
.company-main,
.company-sidebar {
    min-width: 0;
}

.company-sidebar {
    position: sticky;
    top: calc(var(--header-height, 60px) + var(--nav-height, 44px) + 16px);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* ── Hero ────────────────────────────────────────────────────── */
.company-hero {
    background: linear-gradient(135deg, #0d1117 0%, #1a2332 60%, color-mix(in srgb, var(--company-color) 20%, #0d1117) 100%);
    border-radius: 12px;
    padding: 28px 28px 0;
    margin-top: 20px;
    position: relative;
    overflow: hidden;
}

.company-hero::before {
    content: '';
    position: absolute;
    top: -60px; right: -60px;
    width: 220px; height: 220px;
    border-radius: 50%;
    background: var(--company-color);
    opacity: 0.07;
    pointer-events: none;
}

.company-hero-inner {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.company-hero-left {
    display: flex;
    align-items: flex-start;
    gap: 18px;
}

.company-logo-badge {
    width: 64px; height: 64px;
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 28px; font-weight: 900;
    color: #fff;
    flex-shrink: 0;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    letter-spacing: -1px;
}

.company-logo-badge--sm {
    width: 40px; height: 40px;
    border-radius: 10px;
    font-size: 18px;
}

.company-hero-name {
    font-size: 1.8rem;
    font-weight: 800;
    color: #fff;
    margin: 0 0 4px;
    line-height: 1.1;
}

.company-ticker {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255,255,255,0.55);
    letter-spacing: 0.5px;
    margin-bottom: 10px;
}

.company-hero-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.company-tag {
    display: inline-flex;
    align-items: center;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.18);
    color: rgba(255,255,255,0.85);
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 4px 12px;
    text-decoration: none;
    transition: background 0.2s;
}

.company-tag:hover { background: rgba(255,255,255,0.18); color: #fff; }

.company-tag--search {
    border-style: dashed;
    opacity: 0.75;
}

.company-tag--search:hover { opacity: 1; }

.company-article-count {
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255,255,255,0.45);
    white-space: nowrap;
    padding-top: 8px;
}

.company-breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.72rem;
    color: rgba(255,255,255,0.4);
    padding: 14px 0 16px;
    margin-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.company-breadcrumb a {
    color: rgba(255,255,255,0.55);
    text-decoration: none;
}

.company-breadcrumb a:hover { color: #fff; }

/* ── Section Labels ──────────────────────────────────────────── */
.section-label {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--text-muted, #888);
    margin: 0 0 14px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-color, #eee);
}

/* ── Carousel ────────────────────────────────────────────────── */
.company-carousel-section {
    margin-bottom: 32px;
}

.company-carousel {
    position: relative;
    overflow: hidden;
    border-radius: 10px;
    width: 100%;
}

.company-carousel-track {
    display: flex;
    gap: 16px;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    width: 100%;
    will-change: transform;
}

/* carousel-card is now a div — styles defined in fixes section below */

.carousel-card-body {
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.carousel-source {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--primary-color, #0073aa);
}

.carousel-card-body h3 {
    font-size: var(--font-size-xl, 1.2rem);
    font-weight: 700;
    color: var(--text-color, #1a1a1a);
    line-height: 1.3;
    margin: 0 0 var(--spacing-sm, 8px);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.carousel-card-link:hover .carousel-card-body h3 {
    color: var(--primary-color, #0073aa);
}

.carousel-date {
    font-size: 0.68rem;
    color: var(--text-muted, #999);
    margin-top: auto;
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.95);
    border: 1px solid var(--border-color, #ddd);
    border-radius: 50%;
    width: 36px; height: 36px;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
    transition: all 0.2s;
    z-index: 2;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-color, #333);
}

.carousel-btn:hover { background: var(--primary-color, #0073aa); color: #fff; border-color: var(--primary-color, #0073aa); }
.carousel-prev { left: 8px; }
.carousel-next { right: 8px; }

/* ── Sidebar Cards ───────────────────────────────────────────── */
.sidebar-card {
    background: var(--background-second, #fff);
    border: 1px solid var(--border-color, #eee);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}



.sidebar-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    color: #fff;
}

.sidebar-card-header--plain {
    background: var(--background-third, #f8f9fa) !important;
    color: var(--text-color, #1a1a1a) !important;
    border-bottom: 1px solid var(--border-color, #eee);
}

.sidebar-section-title {
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-secondary, #555);
}

.sidebar-company-name {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
}

.sidebar-ticker {
    font-size: 0.7rem;
    color: rgba(255,255,255,0.65);
    margin-top: 2px;
}

.sidebar-card-body {
    padding: 14px 16px;
}

.company-about {
    font-size: 0.8rem;
    line-height: 1.6;
    color: var(--text-secondary, #666);
    margin: 0 0 12px;
}

.company-meta-list { display: flex; flex-direction: column; gap: 8px; }

.company-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    font-size: 0.78rem;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-color, #f0f0f0);
}

.company-meta-row:last-child { border-bottom: none; padding-bottom: 0; }

.meta-label {
    font-weight: 700;
    color: var(--text-muted, #999);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    flex-shrink: 0;
}

.meta-value {
    color: var(--text-color, #333);
    text-align: right;
}

.meta-value a {
    color: var(--primary-color, #0073aa);
    text-decoration: none;
    font-size: 0.75rem;
}

.meta-value a:hover { text-decoration: underline; }

/* ── Stock Card ──────────────────────────────────────────────── */
.stock-card {
    background: var(--background-second, #fff);
    border: 1px solid var(--border-color, #eee);
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.stock-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px 0;
}

.stock-card-title {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted, #999);
}

.stock-card-ticker {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--primary-color, #0073aa);
}

/* TradingView widget padding */
.stock-card .tradingview-widget-container { padding: 0 4px 4px; }

/* ── Related Companies Card ──────────────────────────────────── */
.companies-card {
    background: linear-gradient(160deg, #1a1228 0%, #2a1f3d 100%);
    border-color: #3d2b5e;
}

.companies-card .sidebar-card-header--plain {
    background: rgba(255,255,255,0.06) !important;
    border-bottom: 1px solid rgba(255,255,255,0.1) !important;
    color: #fff !important;
}

.companies-card .sidebar-section-title { color: rgba(255,255,255,0.7) !important; }

.companies-card .related-company-row {
    border-bottom-color: rgba(255,255,255,0.08);
}

.companies-card .related-company-row:hover {
    background: rgba(255,255,255,0.06);
}

.companies-card .rc-name { color: rgba(255,255,255,0.9); }
.companies-card .rc-count { color: rgba(255,255,255,0.45); }
.companies-card .rc-arrow { color: rgba(255,255,255,0.3); }

/* ── Topics Card ─────────────────────────────────────────────── */
.topics-card {
    background: linear-gradient(160deg, #0d1f18 0%, #162d22 100%);
    border-color: #1e4d35;
}

.topics-card .sidebar-card-header--plain {
    background: rgba(255,255,255,0.06) !important;
    border-bottom: 1px solid rgba(255,255,255,0.1) !important;
    color: #fff !important;
}

.topics-card .sidebar-section-title { color: rgba(255,255,255,0.7) !important; }

.topics-card .topics-card-body { padding: 12px 14px; }

.topics-card .topic-chip {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.8);
}

.topics-card .topic-chip:hover {
    background: rgba(255,255,255,0.18);
    border-color: rgba(255,255,255,0.3);
    color: #fff;
}

.topics-card .chip-count { color: rgba(255,255,255,0.45); }

/* ── Related Companies ───────────────────────────────────────── */
.sidebar-card-body--list { padding: 0; }

.related-company-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    text-decoration: none;
    border-bottom: 1px solid var(--border-color, #f0f0f0);
    transition: background 0.15s;
}

.related-company-row:last-child { border-bottom: none; }
.related-company-row:hover { background: var(--background-third, #f8f9fa); }

.rc-logo {
    width: 32px; height: 32px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 900;
    color: #fff;
    flex-shrink: 0;
}

.rc-info { flex: 1; }
.rc-name { display: block; font-size: 0.82rem; font-weight: 600; color: var(--text-color, #333); }
.rc-count { display: block; font-size: 0.68rem; color: var(--text-muted, #999); margin-top: 1px; }
.rc-arrow { color: var(--text-muted, #ccc); flex-shrink: 0; }

/* Search-fallback company rows (no dedicated WP category) */
.related-company-row--search { opacity: 0.85; }
.related-company-row--search:hover { opacity: 1; }
.rc-search-hint {
    display: block;
    font-size: 0.62rem;
    color: var(--text-muted, #999);
    margin-top: 1px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.rc-search-icon { color: var(--text-muted, #bbb); flex-shrink: 0; }

/* ── Topics Card ─────────────────────────────────────────────── */
.topics-card-body {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    padding: 12px 14px;
}

.topic-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--background-third, #f5f7fa);
    border: 1px solid var(--border-color, #e5e9f0);
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary, #555);
    padding: 4px 10px;
    text-decoration: none;
    transition: all 0.15s;
}

.topic-chip:hover {
    background: var(--primary-color, #0073aa);
    border-color: var(--primary-color, #0073aa);
    color: #fff;
}

.topic-chip--search {
    border-style: dashed;
    opacity: 0.75;
}

.topic-chip--search:hover { opacity: 1; }

.chip-count {
    font-size: 0.62rem;
    font-weight: 700;
    background: rgba(0,0,0,0.08);
    border-radius: 10px;
    padding: 1px 6px;
}

.topic-chip:hover .chip-count { background: rgba(255,255,255,0.2); }

/* ── Sidebar Banner Ad ───────────────────────────────────────── */
.sidebar-banner-ad {
    background: var(--background-third, #f8f9fa);
    border: 1px dashed var(--border-color, #ddd);
    border-radius: 8px;
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    flex-direction: column;
    gap: 4px;
    color: var(--text-muted, #bbb);
    font-size: 0.7rem;
}

.ad-label-pill {
    position: absolute;
    top: 5px; left: 8px;
    font-size: 0.55rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: rgba(0,0,0,0.07);
    border-radius: 3px;
    padding: 1px 5px;
    color: var(--text-muted, #aaa);
}

/* ── AdSense in-feed slot in grid ────────────────────────────── */
.adsense-slot .adsense-native-card {
    background: var(--background-third, #f8f9fa);
    border: 1px solid #e0eaf3;
    border-radius: 10px;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.adsense-label-row {
    padding: 8px 12px 0;
}

.adsense-label {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted, #aaa);
    border: 1px solid var(--border-color, #ddd);
    border-radius: 3px;
    padding: 1px 6px;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 900px) {
    .company-body {
        grid-template-columns: 1fr;
    }
    .company-sidebar {
        position: static;
        order: -1; /* Sidebar above content on mobile — remove if you prefer below */
    }
    .carousel-card { flex: 0 0 85%; }
}

@media (max-width: 600px) {
    .company-hero { padding: 20px 16px 0; }
    .company-hero-name { font-size: 1.4rem; }
    .company-logo-badge { width: 48px; height: 48px; font-size: 22px; }
    .carousel-card { flex: 0 0 90%; }
    .company-hero-right { display: none; }
}

/* ============================================================
   COMPANY PAGE — FIXES (a–e)
   ============================================================ */

/* ── a) Hide sidebar below 768px ────────────────────────────── */
@media (max-width: 768px) {
    .company-body {
        grid-template-columns: 1fr;
    }
    .company-sidebar {
        display: none;
    }
}

/* ── b+c) Hero: logo smaller, no ticker, tags on right ──────── */
.company-hero {
    padding: 18px 24px 0;
}

.company-hero-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.company-hero-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

/* Logo badge — hero size (matches text height) */
.company-logo-badge--hero {
    width: 40px; height: 40px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 800;
}

.company-hero-name {
    font-size: 1.4rem;
    font-weight: 800;
    color: #fff;
    margin: 0;
    white-space: nowrap;
}

/* Tags sit at the far right */
.company-hero-right {
    display: flex;
    align-items: center;
}

.company-hero-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 0;
}

/* Hide the old article count (already display:none above, belt+braces) */
.company-article-count { display: none; }

/* Hide ticker entirely — shown in sidebar card */
.company-ticker { display: none; }

/* ── d) Remove article count from hero ──────────────────────── */

/* ── Breadcrumb tighter ─────────────────────────────────────── */
.company-breadcrumb {
    padding: 10px 0 12px;
    margin-top: 12px;
}

/* ── e) 3-column grid on company pages (overrides global 4-col) ── */
/* company-grid overrides the global .category-grid rules */
@media (min-width: 1024px) {
    .company-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        grid-template-rows: auto !important;
    }
}

@media (min-width: 769px) and (max-width: 1023px) {
    .company-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        grid-template-rows: auto !important;
    }
}

@media (min-width: 601px) and (max-width: 768px) {
    .company-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ── c) Carousel card styles ─────────────────────────────────── */
.carousel-card {
    flex: 0 0 calc(33.333% - 11px);
    background: var(--background-second, #fff);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border-color, #eee);
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s, transform 0.2s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.carousel-card:hover {
    box-shadow: 0 6px 24px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}

.carousel-card-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.carousel-card-link:hover h3 { color: var(--primary-color, #0073aa); }

/* Footer reuses existing card-footer / card-footer-left / card-footer-right classes */
.carousel-card .card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px 12px;
    border-top: 1px solid var(--border-color, #eee);
    font-size: var(--font-size-xs, 0.72rem);
    color: var(--text-muted, #999);
    margin-top: 0;
}

.carousel-card .card-footer-left { display: flex; align-items: center; }
.carousel-card .card-footer-right { display: flex; align-items: center; gap: 4px; }

/* Responsive carousel widths */
@media (max-width: 900px) {
    .carousel-card { flex: 0 0 calc(50% - 8px); }
}
@media (max-width: 600px) {
    .carousel-card { flex: 0 0 88%; }
}

/* carousel-card-img */
.carousel-card-img {
    aspect-ratio: 16/9;
    overflow: hidden;
    background: #f0f4f8;
}
.carousel-card-img img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s;
}
.carousel-card:hover .carousel-card-img img { transform: scale(1.04); }

/* ── Carousel card source row (matches post-card.php structure) ── */
/* card-source row inside carousel cards — source left, share right */
.carousel-card .card-source {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.7em;
    color: var(--text-muted);
    margin-bottom: var(--spacing-sm, 8px);
}

.carousel-card .card-source .card-share-button {
    background: none;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.72rem;
    color: var(--text-muted, #999);
    padding: 2px 4px;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
    font-family: inherit;
}

.carousel-card .card-source .card-share-button svg {
    width: 13px; height: 13px;
}

.carousel-card .card-source .card-share-button:hover {
    color: var(--primary-color, #0073aa);
    background: rgba(0,115,170,0.08);
}

/* Remove old carousel-source span (no longer used) */
.carousel-source { display: none; }
.carousel-date   { display: none; }

/* Hide tablet rows by default on desktop (sidebar handles it) */
.tablet-info-row,
.tablet-bottom-row {
    display: none;
}

/* ── Visual treatment: no separator line ────────────────────── */
.tablet-info-row,
.tablet-bottom-row {
    border-top: none;
    padding-top: 0;
}

/* Cards inside inline rows inherit the same dark styles as desktop sidebar */

/* ============================================================
   ALL LAYOUTS BELOW 1024px — 2-col, horizontally scrollable
   ============================================================ */
@media (max-width: 1023px) {

    .company-body {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .company-sidebar { display: none; }

    /* 2-col grid, scroll horizontally if cards are too wide */
    .tablet-info-row,
    .tablet-bottom-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tablet-info-row  { margin-bottom: 28px; }
    .tablet-bottom-row { margin-top: 28px; }
}

/* ── Instant Search ─────────────────────────────────────────── */
.instant-search-header {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--background-secondary, #f8f9fa);
    border: 1px solid var(--border-color, #eee);
    border-radius: 8px;
    margin-bottom: 4px;
    font-size: 0.88rem;
    color: var(--text-color, #333);
}
.instant-search-label strong { color: var(--primary-color, #0073aa); }
.instant-search-clear {
    background: none;
    border: 1px solid var(--border-color, #eee);
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-color, #333);
    cursor: pointer;
    transition: all 0.15s;
}
.instant-search-clear:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #dc2626;
}
.instant-search-loading,
.instant-search-empty {
    grid-column: 1 / -1;
    padding: 40px;
    text-align: center;
    font-size: 0.9rem;
    color: var(--muted, #888);
}
.instant-search-empty a {
    color: var(--primary-color, #0073aa);
    font-weight: 600;
}
.meta-search-link {
    color: var(--primary-color, #0073aa);
    font-weight: 600;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 2px;
    cursor: pointer;
    transition: color 0.15s;
}
.meta-search-link:hover { color: var(--primary-hover, #005177); }
/* ============================================================
   INDUSTRY PAGE ADDITIONS
   ============================================================ */

/* ── Industries Card ─────────────────────────────────────────── */
/* Mirrors .companies-card dark treatment but with a blue-navy tone */
.industries-card {
    background: linear-gradient(160deg, #0d1a2e 0%, #112240 100%);
    border-color: #1e3a5f;
}

.industries-card .sidebar-card-header--plain {
    background: rgba(255,255,255,0.06) !important;
    border-bottom: 1px solid rgba(255,255,255,0.1) !important;
    color: #fff !important;
}

.industries-card .sidebar-section-title { color: rgba(255,255,255,0.7) !important; }

.industries-card .related-company-row {
    border-bottom-color: rgba(255,255,255,0.08);
}

.industries-card .related-company-row:hover {
    background: rgba(255,255,255,0.06);
}

.industries-card .rc-name  { color: rgba(255,255,255,0.9); }
.industries-card .rc-arrow { color: rgba(255,255,255,0.3); }

/* ── tablet-info-row: single column when only one card present ── */
/* Industry tablet-info-row has 2 cards (Key Companies + More Industries)
   so the existing 1fr 1fr grid already works. No extra rule needed.   */