:root {
    --tv-bg: #131722;
    --tv-card-bg: #1e222d;
    --tv-border: #2a2e39;
    --tv-text-primary: #d1d4dc;
    --tv-text-secondary: #787b86;
    --tv-accent: #2962ff;
    --tv-up: #089981;
    --tv-down: #f23645;
    --tv-hover: #2a2e39;
}

body {
    background-color: var(--tv-bg) !important;
    color: var(--tv-text-primary) !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Trebuchet MS", Roboto, Ubuntu, sans-serif !important;
}

/* Header Adjustments */
.ep-kheader {
    background-color: var(--tv-bg) !important;
    border-bottom: 1px solid var(--tv-border) !important;
}

.ep-kheader__navlink {
    color: var(--tv-text-primary) !important;
    font-weight: 500 !important;
}

.ep-kheader__navlink:hover {
    color: var(--tv-accent) !important;
}

.tv-mobile-nav-btn {
    display: none;
}

/* Market Ticker Tape */
.tv-ticker-tape {
    background: #181c27;
    border-bottom: 1px solid var(--tv-border);
    height: 38px;
    overflow: hidden;
    display: flex;
    align-items: center;
    font-size: 11px;
    font-weight: 600;
}

.tv-ticker-track {
    display: flex;
    white-space: nowrap;
    animation: ticker-scroll 60s linear infinite;
}

@keyframes ticker-scroll {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50%);
    }
}

.tv-ticker-item {
    display: flex;
    align-items: center;
    padding: 0 15px;
    border-right: 1px solid var(--tv-border);
}

.tv-ticker-symbol {
    color: #fff;
    margin-right: 5px;
}

.tv-ticker-price {
    margin-right: 5px;
}

.tv-ticker-change.up {
    color: var(--tv-up);
}

.tv-ticker-change.down {
    color: var(--tv-down);
}

/* Main Cards */
.sidebar-widget,
.td-mob-popular,
.ep-mob-msmes-section,
.post-item {
    background: var(--tv-card-bg) !important;
    border: 1px solid var(--tv-border) !important;
    border-radius: 4px !important;
    box-shadow: none !important;
}

.widget-head .title,
.title-index,
.td-mob-popular__tab {
    color: var(--tv-text-primary) !important;
}

.td-mob-popular__tab.is-active {
    border-bottom: 2px solid var(--tv-accent) !important;
    color: var(--tv-accent) !important;
}

/* Buttons */
.btn-primary {
    background-color: var(--tv-accent) !important;
    border-color: var(--tv-accent) !important;
}

/* TradingView Chart Placeholder Style */
.tv-chart-hero {
    background: #131722;
    border: 1px solid var(--tv-border);
    border-radius: 4px;
    height: 450px;
    position: relative;
    overflow: hidden;
    margin-bottom: 20px;
}

.tv-chart-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--tv-text-secondary);
}

/* Watchlist Density */
.watchlist-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid var(--tv-border);
    transition: background 0.2s;
}

.watchlist-item:hover {
    background: var(--tv-hover);
}

.watchlist-symbol {
    font-weight: 700;
    color: #fff;
}

/* Idea Cards */
.tv-idea-card {
    background: var(--tv-card-bg);
    border: 1px solid var(--tv-border);
    border-radius: 12px;
    overflow: hidden;
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

.tv-idea-card:hover {
    transform: translateY(-5px);
    border-color: var(--tv-accent);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.idea-image {
    position: relative;
    height: 180px;
    overflow: hidden;
}

.idea-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.tv-idea-card:hover .idea-image img {
    transform: scale(1.05);
}

.idea-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(19, 23, 34, 0.8);
    backdrop-filter: blur(4px);
    color: #fff;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.idea-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.idea-title {
    margin: 0 0 15px 0;
    font-size: 17px;
    line-height: 1.4;
    font-weight: 700;
}

.idea-title a {
    color: #fff;
    text-decoration: none;
}

.idea-title a:hover {
    color: var(--tv-accent);
}

.idea-footer {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid var(--tv-border);
}

.author-name {
    font-size: 13px;
    font-weight: 600;
    color: #d1d4dc;
}

.idea-date {
    font-size: 12px;
    color: #868993;
}

.watchlist-last {
    font-weight: 600;
}

/* Pos/Neg Colors */
.text-up {
    color: var(--tv-up) !important;
}

.text-down {
    color: var(--tv-down) !important;
}

/* Hide standard news clutter if not needed */
.ep-kheader__subscribe,
.social-share {
    display: none !important;
}

/* Market Summary Boxes */
.tv-summary-box {
    background: var(--tv-card-bg);
    border: 1px solid var(--tv-border);
    border-radius: 8px;
    padding: 15px;
    height: 100%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s ease;
}

.tv-summary-box:hover {
    transform: translateY(-5px);
}

.gainer-box {
    border-top: 3px solid #089981;
}

.loser-box {
    border-top: 3px solid #f23645;
}

.active-box {
    border-top: 3px solid #2962ff;
}

.summary-title {
    margin: 0 0 15px 0;
    font-size: 14px;
    font-weight: 700;
    color: #868993;
    letter-spacing: 0.5px;
}

.summary-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--tv-border);
}

.summary-item:last-child {
    border-bottom: none;
}

.summary-item .symbol {
    font-weight: 700;
    color: #d1d4dc;
}

.summary-item .value {
    font-weight: 600;
    color: #fff;
}

/* Modern Layout Overrides */
.ep-modern-layout #header {
    display: none !important;
}

.ep-modern-layout .td-appbanner {
    display: none !important;
}

/* Adjust main content for sticky header */
.ep-modern-layout main {
    padding-top: 0 !important;
}

/* Ensure mobile header still works if needed, but usually we handle it in _header_desk */
@media (max-width: 991px) {
    .ep-modern-layout #header {
        display: none !important;
    }

    .tv-main-header {
        display: block !important;
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .tv-header-container {
        padding: 0 10px !important;
    }

    .tv-nav-primary {
        display: none !important;
        /* Hide standard nav on mobile */
    }

    .tv-mobile-nav-btn {
        display: block !important;
        background: transparent;
        border: none;
        color: #fff;
        font-size: 20px;
        padding: 5px;
        cursor: pointer;
    }

    .tv-header-actions {
        gap: 10px;
    }

    .tv-logo-img {
        height: 24px;
        width: auto;
    }

    .tv-header-right {
        gap: 5px;
    }

    .tv-btn-search span,
    .tv-btn-login span {
        display: none !important;
    }
}


/* Full Width Container for Hero */
.td-desk-home .container {
    width: 95% !important;
    max-width: 1600px !important;
}

.ep-desk-section {
    padding: 0 15px;
}