/* xindex Premium Dashboard Styling */

.xindex-dashboard {
    --bg-dark: #ffffff;
    --card-dark: #ffffff;
    --border-dark: #e2e8f0;
    --text-primary-dark: #0f172a;
    --text-secondary-dark: #64748b;
    
    --green-neon: #10b981;
    --red-neon: #ef4444;
    --blue-neon: #3b82f6;
    --purple-ai: #8b5cf6;
    
    --tab-bg: rgba(148, 163, 184, 0.06);
    --tab-hover-bg: rgba(148, 163, 184, 0.12);
    --tab-active-bg: rgba(148, 163, 184, 0.18);
    --ai-title-color: #7c3aed;
    --ai-heading-color: #6d28d9;
    --ai-border: 1px solid rgba(139, 92, 246, 0.2);
    --ai-grad: radial-gradient(circle at top left, rgba(139, 92, 246, 0.04) 0%, rgba(59, 130, 246, 0.01) 100%), #ffffff;
    
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text-primary-dark);
    background-color: var(--bg-dark);
    border: 1px solid var(--border-dark);
    border-radius: 16px;
    padding: 24px;
    margin: 20px 0;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

/* Dark Theme overrides if theme="dark" is passed */
.xindex-dashboard.xindex-theme-dark {
    --bg-dark: #0b0f19;
    --card-dark: #111827;
    --border-dark: rgba(255, 255, 255, 0.08);
    --text-primary-dark: #f8fafc;
    --text-secondary-dark: #94a3b8;
    
    --red-neon: #f43f5e;
    
    --tab-bg: rgba(255, 255, 255, 0.03);
    --tab-hover-bg: rgba(255, 255, 255, 0.05);
    --tab-active-bg: rgba(255, 255, 255, 0.08);
    --ai-title-color: #fff;
    --ai-heading-color: #c084fc;
    --ai-border: 1px solid rgba(139, 92, 246, 0.2);
    --ai-grad: radial-gradient(circle at top left, rgba(139, 92, 246, 0.08) 0%, rgba(59, 130, 246, 0.02) 100%), #111827;
    
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
}

/* Grid & Layout Header */
.xindex-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-dark);
}

.xindex-title-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.xindex-main-title {
    font-size: 20px;
    font-weight: 800;
    margin: 0;
    letter-spacing: -0.025em;
    text-transform: uppercase;
    background: linear-gradient(to right, #0284c7, #4f46e5);
}
.xindex-dashboard.xindex-theme-dark .xindex-main-title {
    background: linear-gradient(to right, #38bdf8, #818cf8);
}
.xindex-main-title {
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.xindex-subtitle {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-secondary-dark);
    text-transform: none;
    -webkit-text-fill-color: var(--text-secondary-dark);
}

.xindex-market-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 9999px;
    padding: 3px 10px;
}

.xindex-pulse-dot {
    width: 6px;
    height: 6px;
    background-color: var(--green-neon);
    border-radius: 50%;
    animation: xindex-pulse 1.8s infinite;
}

.xindex-market-status {
    font-size: 11px;
    font-weight: 700;
    color: var(--green-neon);
    text-transform: uppercase;
}

.xindex-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.xindex-last-updated-text {
    font-size: 12px;
    color: var(--text-secondary-dark);
}

.xindex-icon-btn {
    background: var(--tab-bg);
    border: 1px solid var(--border-dark);
    color: var(--text-primary-dark);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.xindex-icon-btn:hover {
    background: var(--tab-hover-bg);
    border-color: var(--text-secondary-dark);
}

#xindex-refresh-btn {
    color: var(--red-neon);
}

#xindex-refresh-btn:hover {
    border-color: var(--red-neon);
    background: rgba(239, 68, 68, 0.08);
}

.xindex-icon-btn svg {
    transition: transform 0.3s ease;
    stroke: currentColor !important;
}

#xindex-refresh-btn svg {
    stroke: var(--red-neon) !important;
}

.xindex-icon-btn:active svg {
    transform: rotate(180deg);
}

/* Tabs Navigation */
.xindex-tabs-wrapper {
    margin-bottom: 20px;
}

.xindex-tabs {
    display: flex;
    gap: 8px;
    background: var(--tab-bg);
    border: 1px solid var(--border-dark);
    padding: 4px;
    border-radius: 10px;
    width: fit-content;
}

.xindex-tab {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none !important;
    color: var(--text-secondary-dark) !important;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.xindex-tab svg {
    stroke: currentColor !important;
}

.xindex-tab:hover {
    color: var(--text-primary-dark) !important;
    background: var(--tab-hover-bg);
}

.xindex-tab.active {
    color: var(--text-primary-dark) !important;
    background: var(--tab-active-bg);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.xindex-tab-ai-trigger {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.08) 0%, rgba(59, 130, 246, 0.08) 100%);
    border: 1px solid rgba(139, 92, 246, 0.15);
    color: #7c3aed !important;
}
.xindex-dashboard.xindex-theme-dark .xindex-tab-ai-trigger {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1) 0%, rgba(59, 130, 246, 0.1) 100%);
    color: #a78bfa !important;
}

.xindex-tab-ai-trigger:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15) 0%, rgba(59, 130, 246, 0.15) 100%);
    color: #6d28d9 !important;
}
.xindex-dashboard.xindex-theme-dark .xindex-tab-ai-trigger:hover {
    color: #c084fc !important;
}

.xindex-tab-ai-trigger.active {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2) 0%, rgba(59, 130, 246, 0.2) 100%);
    border-color: rgba(139, 92, 246, 0.4);
    color: var(--text-primary-dark) !important;
}

.xindex-ai-icon {
    filter: drop-shadow(0 0 2px rgba(139, 92, 246, 0.3));
}

/* Panes Styling */
.xindex-pane {
    display: none;
    animation: xindex-fade-in 0.3s ease-in-out forwards;
}

.xindex-pane.active {
    display: block;
}

/* Indices Grid View */
.xindex-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.xindex-card {
    background: var(--card-dark);
    border: 1px solid var(--border-dark);
    border-radius: 12px;
    padding: 20px;
    position: relative;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.xindex-card:hover {
    transform: translateY(-2px);
    border-color: rgba(0, 0, 0, 0.15);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
}
.xindex-dashboard.xindex-theme-dark .xindex-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
}

.xindex-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.xindex-card-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary-dark);
}

.xindex-card-symbol {
    font-size: 11px;
    font-weight: 700;
    background: var(--tab-bg);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--text-secondary-dark);
}

.xindex-card-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.xindex-price-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.xindex-card-price {
    font-size: 22px;
    font-weight: 800;
    font-family: monospace;
    letter-spacing: -0.02em;
}

.xindex-card-change {
    font-size: 12px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.xindex-card-change.up {
    color: var(--green-neon);
}

.xindex-card-change.down {
    color: var(--red-neon);
}

.xindex-sparkline-container {
    height: 36px;
    margin-top: 8px;
    width: 100%;
}

.xindex-sparkline-svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

/* Tables Styling */
.xindex-table-container {
    overflow-x: auto;
    border: 1px solid var(--border-dark);
    border-radius: 12px;
    background: var(--card-dark);
}

.xindex-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 14px;
}

.xindex-table th {
    background: var(--tab-bg);
    padding: 14px 18px;
    font-weight: 700;
    color: var(--text-secondary-dark);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-dark);
}

.xindex-table td {
    padding: 12px 18px;
    border-bottom: 1px solid var(--border-dark);
    vertical-align: middle;
}

.xindex-table tbody tr:last-child td {
    border-bottom: none;
}

.xindex-table tbody tr:hover td {
    background: var(--tab-bg);
}

.xindex-ticker-badge {
    background: var(--tab-bg);
    color: var(--text-primary-dark);
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: 700;
    font-family: monospace;
    font-size: 12px;
    border: 1px solid var(--border-dark);
}

.xindex-company-name {
    font-weight: 500;
    color: var(--text-secondary-dark);
    display: inline-block;
    max-width: 250px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Helper Text Classes */
.text-right { text-align: right; }
.text-center { text-align: center; }
.font-mono { font-family: monospace; }
.font-bold { font-weight: 700; }

.up { color: var(--green-neon) !important; }
.down { color: var(--red-neon) !important; }

/* AI Market Insight Card Styling */
.xindex-ai-card {
    background: var(--ai-grad);
    border: var(--ai-border);
    border-radius: 16px;
    padding: 24px;
    position: relative;
    box-shadow: 0 4px 20px -2px rgba(139, 92, 246, 0.05);
}
.xindex-dashboard.xindex-theme-dark .xindex-ai-card {
    box-shadow: 0 4px 20px -2px rgba(139, 92, 246, 0.2);
}

.xindex-ai-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(139, 92, 246, 0.15);
    padding-bottom: 16px;
    margin-bottom: 20px;
    gap: 16px;
    flex-wrap: wrap;
}

.xindex-ai-meta {
    display: flex;
    align-items: center;
    gap: 14px;
}

.xindex-ai-avatar {
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, #8b5cf6 0%, #3b82f6 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 0 12px rgba(139, 92, 246, 0.3);
    animation: xindex-float 3s ease-in-out infinite;
}

.xindex-ai-card-title {
    font-size: 16px;
    font-weight: 800;
    margin: 0;
    color: var(--text-primary-dark);
}

.xindex-ai-card-desc {
    font-size: 12px;
    color: #7c3aed;
    margin: 2px 0 0 0;
}
.xindex-dashboard.xindex-theme-dark .xindex-ai-card-desc {
    color: #a78bfa;
}

.xindex-btn {
    background: linear-gradient(135deg, #8b5cf6 0%, #3b82f6 100%);
    border: none;
    color: white !important;
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(139, 92, 246, 0.2);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.xindex-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(139, 92, 246, 0.3);
}

.xindex-btn:active {
    transform: translateY(0);
}

/* AI Document Text Formatting */
.xindex-ai-body {
    min-height: 150px;
    position: relative;
}

.xindex-ai-text {
    line-height: 1.7;
    font-size: 14px;
    color: var(--text-primary-dark);
}

.xindex-ai-title {
    font-size: 20px;
    margin-top: 0;
    color: var(--text-primary-dark);
}

.xindex-ai-heading {
    font-size: 16px;
    font-weight: 700;
    margin: 20px 0 10px 0;
    color: var(--ai-heading-color);
    border-left: 3px solid var(--purple-ai);
    padding-left: 10px;
}

.xindex-ai-subheading {
    font-size: 14px;
    font-weight: 700;
    margin: 15px 0 8px 0;
    color: var(--text-primary-dark);
}

.xindex-ai-list {
    margin: 10px 0 15px 20px;
    list-style-type: square;
}

.xindex-ai-list li {
    margin-bottom: 6px;
    color: var(--text-primary-dark);
}

.xindex-ai-timestamp {
    font-size: 11px;
    color: var(--text-secondary-dark);
    margin-top: 30px;
    text-align: right;
    border-top: 1px solid var(--border-dark);
    padding-top: 12px;
}

/* Warning & Alerts */
.xindex-ai-message-warning {
    background: rgba(245, 158, 11, 0.05);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: 8px;
    padding: 16px;
    color: #d97706;
}
.xindex-dashboard.xindex-theme-dark .xindex-ai-message-warning {
    background: rgba(245, 158, 11, 0.08);
    color: #f59e0b;
}

.xindex-ai-message-warning h5 {
    margin: 0 0 6px 0;
    font-size: 14px;
    font-weight: 700;
}

.xindex-ai-message-warning p {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
}

/* Empty State / Glowing Orb for Generation Trigger */
.xindex-ai-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
}

.xindex-ai-glowing-sphere {
    width: 60px;
    height: 60px;
    background: radial-gradient(circle, #8b5cf6 0%, rgba(59, 130, 246, 0.05) 70%);
    border-radius: 50%;
    margin-bottom: 20px;
    animation: xindex-sphere-glow 3s ease-in-out infinite;
    box-shadow: 0 0 30px rgba(139, 92, 246, 0.15);
}
.xindex-dashboard.xindex-theme-dark .xindex-ai-glowing-sphere {
    background: radial-gradient(circle, #8b5cf6 0%, rgba(59, 130, 246, 0.1) 70%);
    box-shadow: 0 0 30px rgba(139, 92, 246, 0.2);
}

/* Loader Overlay */
.xindex-ai-loader-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    z-index: 10;
    gap: 16px;
}
.xindex-dashboard.xindex-theme-dark .xindex-ai-loader-overlay {
    background: rgba(11, 15, 25, 0.85);
}

.xindex-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(139, 92, 246, 0.1);
    border-radius: 50%;
    border-top-color: #8b5cf6;
    animation: xindex-spin 1s ease-in-out infinite;
}

.xindex-loader-text {
    color: #6d28d9;
    font-weight: 600;
    font-size: 13px;
    text-align: center;
}
.xindex-dashboard.xindex-theme-dark .xindex-loader-text {
    color: #c084fc;
}

/* Empty / Error state */
.xindex-empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 30px;
    color: var(--text-secondary-dark);
    font-style: italic;
    border: 1px dashed var(--border-dark);
    border-radius: 12px;
}

/* Animations */
@keyframes xindex-pulse {
    0% { transform: scale(0.9); opacity: 0.7; }
    50% { transform: scale(1.15); opacity: 1; box-shadow: 0 0 8px rgba(16, 185, 129, 0.5); }
    100% { transform: scale(0.9); opacity: 0.7; }
}

@keyframes xindex-sphere-glow {
    0% { transform: scale(0.95); opacity: 0.6; box-shadow: 0 0 20px rgba(139, 92, 246, 0.1); }
    50% { transform: scale(1.05); opacity: 0.9; box-shadow: 0 0 40px rgba(139, 92, 246, 0.4), 0 0 60px rgba(59, 130, 246, 0.15); }
    100% { transform: scale(0.95); opacity: 0.6; box-shadow: 0 0 20px rgba(139, 92, 246, 0.1); }
}

@keyframes xindex-float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-5px); }
    100% { transform: translateY(0px); }
}

@keyframes xindex-spin {
    to { transform: rotate(360deg); }
}

@keyframes xindex-fade-in {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .xindex-dashboard {
        padding: 16px;
    }
    
    .xindex-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .xindex-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .xindex-tabs {
        width: 100%;
        overflow-x: auto;
    }
    
    .xindex-tab {
        flex: 1;
        justify-content: center;
        white-space: nowrap;
    }
    
    .xindex-ai-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .xindex-btn {
        width: 100%;
    }
}

/* Screener Section Styling */
.xindex-screener-section {
    border-top: 1px solid var(--border-dark);
    margin-top: 36px;
    padding-top: 30px;
}

.xindex-screener-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}

.xindex-screener-filters {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.xindex-filter-btn {
    background: #ffffff !important;
    border: 1px solid var(--border-dark);
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 400;
    color: #1e293b !important;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.xindex-filter-btn:hover {
    background: #f8fafc !important;
    border-color: #94a3b8 !important;
    color: #0f172a !important;
}

.xindex-filter-btn.active {
    border-color: #0f172a !important;
    background: #ffffff !important;
    color: #0f172a !important;
}

.xindex-filter-btn .arrow {
    display: inline-flex;
    align-items: center;
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    color: #6b7280;
}

.xindex-filter-btn.active .arrow {
    transform: rotate(180deg);
    color: #0f172a;
}

/* Category Drawer & Pills Grid */
.xindex-screener-cat-drawer {
    background: #ffffff !important;
    border: 1px solid var(--border-dark);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}
.xindex-dashboard.xindex-theme-dark .xindex-screener-cat-drawer {
    background: #1e293b !important;
}

.xindex-cat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
}

.xindex-cat-pill {
    display: flex;
    justify-content: center;
    align-items: center;
    background: #ffffff !important;
    border: 1px solid var(--border-dark);
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.xindex-dashboard.xindex-theme-dark .xindex-cat-pill {
    background: #0f172a !important;
}

.xindex-cat-pill:hover {
    transform: translateY(-1px);
    border-color: #0f172a !important;
    background: #f8fafc !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}
.xindex-dashboard.xindex-theme-dark .xindex-cat-pill:hover {
    background: #1e293b !important;
    border-color: #ffffff !important;
}

.xindex-cat-pill.active {
    background: #ffffff !important;
    border-color: #0f172a !important;
    border-width: 2px;
    padding: 7px 11px;
}
.xindex-dashboard.xindex-theme-dark .xindex-cat-pill.active {
    background: #0f172a !important;
    border-color: #ffffff !important;
}

.xindex-cat-pill-label {
    font-size: 12px;
    font-weight: 400;
    color: #1e293b !important;
}
.xindex-dashboard.xindex-theme-dark .xindex-cat-pill-label {
    color: #f1f5f9 !important;
}
.xindex-cat-pill.active .xindex-cat-pill-label {
    color: #0f172a !important;
}
.xindex-dashboard.xindex-theme-dark .xindex-cat-pill.active .xindex-cat-pill-label {
    color: #ffffff !important;
}

.xindex-cat-pill-count {
    font-size: 10px;
    font-weight: 800;
    background: #f1f5f9 !important;
    color: #475569 !important;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 22px;
    text-align: center;
}
.xindex-dashboard.xindex-theme-dark .xindex-cat-pill-count {
    background: #1e293b !important;
    color: #cbd5e1 !important;
}
.xindex-cat-pill.active .xindex-cat-pill-count {
    background: #0f172a !important;
    color: #ffffff !important;
}
.xindex-dashboard.xindex-theme-dark .xindex-cat-pill.active .xindex-cat-pill-count {
    background: #ffffff !important;
    color: #0f172a !important;
}

/* Sector Drawer & Pills Grid */
.xindex-screener-sector-drawer {
    background: #ffffff !important;
    border: 1px solid var(--border-dark);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}
.xindex-dashboard.xindex-theme-dark .xindex-screener-sector-drawer {
    background: #1e293b !important;
}

.xindex-sector-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 8px;
}

.xindex-sector-pill {
    display: flex;
    justify-content: center;
    align-items: center;
    background: #ffffff !important;
    border: 1px solid var(--border-dark);
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.xindex-dashboard.xindex-theme-dark .xindex-sector-pill {
    background: #0f172a !important;
}

.xindex-sector-pill:hover {
    transform: translateY(-1px);
    border-color: #0f172a !important;
    background: #f8fafc !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}
.xindex-dashboard.xindex-theme-dark .xindex-sector-pill:hover {
    background: #1e293b !important;
    border-color: #ffffff !important;
}

.xindex-sector-pill.active {
    background: #ffffff !important;
    border-color: #0f172a !important;
    border-width: 2px;
    padding: 7px 11px;
}
.xindex-dashboard.xindex-theme-dark .xindex-sector-pill.active {
    background: #0f172a !important;
    border-color: #ffffff !important;
}

.xindex-sector-pill-label {
    font-size: 12px;
    font-weight: 400;
    color: #1e293b !important;
    text-align: center;
}
.xindex-dashboard.xindex-theme-dark .xindex-sector-pill-label {
    color: #f1f5f9 !important;
}
.xindex-sector-pill.active .xindex-sector-pill-label {
    color: #0f172a !important;
}
.xindex-dashboard.xindex-theme-dark .xindex-sector-pill.active .xindex-sector-pill-label {
    color: #ffffff !important;
}

.xindex-filter-select-wrapper {
    position: relative;
    display: inline-block;
}

.xindex-filter-select {
    background: var(--card-dark);
    border: 1px solid var(--border-dark);
    border-radius: 8px;
    padding: 10px 32px 10px 14px;
    font-size: 13px;
    color: var(--text-primary-dark);
    outline: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    transition: all 0.2s ease;
    min-width: 160px;
}

.xindex-filter-select:focus {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.xindex-screener-title {
    font-size: 18px;
    font-weight: 800;
    margin: 0;
    color: var(--text-primary-dark);
    letter-spacing: -0.02em;
}

.xindex-search-box {
    position: relative;
    width: 240px;
}

#xindex-screener-search {
    background: var(--card-dark);
    border: 1px solid var(--border-dark);
    border-radius: 8px;
    padding: 10px 14px 10px 38px;
    width: 100%;
    font-size: 13px;
    color: var(--text-primary-dark);
    outline: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

#xindex-screener-search:focus {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.xindex-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary-dark);
    display: flex;
    align-items: center;
    pointer-events: none;
}

.xindex-screener-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 30px;
    min-height: 100px;
}

@media (max-width: 992px) {
    .xindex-screener-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .xindex-screener-grid {
        grid-template-columns: 1fr;
    }
}

.xindex-screener-card {
    background: var(--card-dark);
    border: 1px solid var(--border-dark);
    border-radius: 12px;
    padding: 14px 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.xindex-screener-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 0, 0, 0.15);
}
.xindex-dashboard.xindex-theme-dark .xindex-screener-card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.15);
}

.xindex-screener-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.xindex-screener-card-meta {
    font-size: 11px;
    color: var(--text-secondary-dark);
    font-style: italic;
}

.xindex-rec-badge {
    font-size: 10px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.xindex-rec-badge.buy {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.2);
}
.xindex-dashboard.xindex-theme-dark .xindex-rec-badge.buy {
    color: var(--green-neon);
}

.xindex-rec-badge.hold {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
    border: 1px solid rgba(245, 158, 11, 0.2);
}
.xindex-dashboard.xindex-theme-dark .xindex-rec-badge.hold {
    color: #f59e0b;
}

.xindex-rec-badge.sell {
    background: rgba(244, 63, 94, 0.1);
    color: #e11d48;
    border: 1px solid rgba(244, 63, 94, 0.2);
}
.xindex-dashboard.xindex-theme-dark .xindex-rec-badge.sell {
    color: var(--red-neon);
}

.xindex-screener-card-ticker {
    font-size: 18px;
    font-weight: 800;
    font-family: monospace;
    color: var(--text-primary-dark);
    margin: 0 0 2px 0;
}

.xindex-screener-card-name {
    font-size: 12px;
    color: var(--text-secondary-dark);
    margin: 0 0 8px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.xindex-screener-card-price-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.xindex-screener-card-price {
    font-size: 20px;
    font-weight: 800;
    font-family: monospace;
}

.xindex-screener-card-change {
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Screener Targets Grid */
.xindex-screener-targets {
    border-top: 1px dashed var(--border-dark);
    margin-top: 12px;
    padding-top: 10px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.xindex-target-col {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.xindex-target-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-secondary-dark);
    letter-spacing: 0.02em;
}

.xindex-target-val {
    font-size: 14px;
    font-weight: 700;
    font-family: monospace;
    color: var(--text-primary-dark);
}

.xindex-target-pct {
    font-size: 11px;
    color: var(--green-neon);
    font-weight: 600;
}

/* Pagination Styling */
.xindex-pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-dark);
    padding-top: 20px;
    flex-wrap: wrap;
    gap: 16px;
}

.xindex-pagination-info {
    font-size: 12px;
    color: var(--text-secondary-dark);
}

.xindex-pagination-buttons {
    display: flex;
    gap: 6px;
}

.xindex-page-btn {
    background: var(--tab-bg);
    border: 1px solid var(--border-dark);
    color: var(--text-primary-dark);
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 700;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.xindex-page-btn:hover:not(:disabled) {
    background: var(--tab-hover-bg);
    border-color: var(--text-secondary-dark);
}

.xindex-page-btn.active {
    background: var(--tab-active-bg);
    border-color: var(--text-secondary-dark);
}

.xindex-page-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.xindex-screener-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    gap: 12px;
    width: 100%;
}

.xindex-screener-loader p {
    margin: 0;
    font-size: 13px;
    color: var(--text-secondary-dark);
    font-weight: 600;
}

@media (max-width: 640px) {
    .xindex-screener-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .xindex-screener-filters {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }
    
    .xindex-filter-select-wrapper,
    .xindex-filter-select,
    .xindex-search-box {
        width: 100% !important;
    }
    
    .xindex-pagination-container {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
}

/* Single Ticker Post Widgets CSS */
a.xindex-screener-card {
    text-decoration: none !important;
    color: inherit !important;
}

.xindex-single-widget {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 18px 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #0f172a;
}
.xindex-dashboard.xindex-theme-dark .xindex-single-widget {
    background: #111827;
    border-color: rgba(255, 255, 255, 0.08);
    color: #f8fafc;
}

.xindex-single-widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.xindex-single-widget-ticker {
    font-size: 18px;
    font-weight: 800;
    display: block;
    color: #0f172a;
}
.xindex-dashboard.xindex-theme-dark .xindex-single-widget-ticker {
    color: #f8fafc;
}

.xindex-single-widget-name {
    font-size: 12px;
    color: #64748b;
}

.xindex-single-widget-price-area {
    text-align: right;
}

.xindex-single-widget-price {
    font-size: 18px;
    font-weight: 800;
    font-family: monospace;
    display: block;
}

.xindex-single-widget-change {
    font-size: 12px;
    font-weight: 700;
}

.xindex-single-chart-container {
    width: 100%;
    height: 280px;
    margin: 10px 0;
    position: relative;
}

.xindex-single-svg-chart {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.xindex-single-chart-footer {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #94a3b8;
    margin-top: 5px;
    border-top: 1px solid #f1f5f9;
    padding-top: 8px;
}
.xindex-dashboard.xindex-theme-dark .xindex-single-chart-footer {
    border-color: rgba(255, 255, 255, 0.05);
}

.xindex-single-section-title {
    font-size: 14px;
    font-weight: 700;
    margin: 0 0 10px 0;
    color: #0f172a;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 6px;
}
.xindex-dashboard.xindex-theme-dark .xindex-single-section-title {
    color: #f8fafc;
    border-color: rgba(255, 255, 255, 0.08);
}

.xindex-single-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.xindex-single-table th {
    background: #f8fafc;
    color: #475569;
    font-weight: 700;
    padding: 10px 12px;
    border-bottom: 1px solid #e2e8f0;
}
.xindex-dashboard.xindex-theme-dark .xindex-single-table th {
    background: #1f2937;
    color: #cbd5e1;
    border-color: rgba(255, 255, 255, 0.08);
}

.xindex-single-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f1f5f9;
    color: #334155;
}
.xindex-dashboard.xindex-theme-dark .xindex-single-table td {
    border-color: rgba(255, 255, 255, 0.05);
    color: #cbd5e1;
}

.xindex-single-table tbody tr:last-child td {
    border-bottom: none;
}

/* Single Chart Range Filters styling */
.xindex-single-chart-filters {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.xindex-chart-range-btn {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #475569;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.xindex-dashboard.xindex-theme-dark .xindex-chart-range-btn {
    background: #1f2937;
    border-color: rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
}

.xindex-chart-range-btn:hover {
    background: #e2e8f0;
    color: #0f172a;
}
.xindex-dashboard.xindex-theme-dark .xindex-chart-range-btn:hover {
    background: #374151;
    color: #ffffff;
}

.xindex-chart-range-btn.active {
    background: #0f172a;
    border-color: #0f172a;
    color: #ffffff;
}
.xindex-dashboard.xindex-theme-dark .xindex-chart-range-btn.active {
    background: #f8fafc;
    border-color: #f8fafc;
    color: #0f172a;
}
