/* ========================================
   PROFESSIONAL MARKET HEALTH STYLES - FIXED
   Dark theme compatible, no scroll bars, better key levels
   ======================================== */

/* Professional Market Health Container */
.professional-market-health-container {
    height: 100%;
    width: 100%;
    overflow: hidden;
    font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Main Container - Fixed Width */
.pmh-container {
    height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    background: var(--valhalla-bg-primary, #ffffff);
    overflow: hidden;
}

/* Professional Header - Clean Design */
.pmh-header {
    background: var(--valhalla-bg-primary, #ffffff);
    border-bottom: 1px solid var(--valhalla-border, #e5e7eb);
    padding: 12px 16px;
    flex-shrink: 0;
}

.pmh-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pmh-title-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pmh-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--valhalla-text-primary, #111827);
    margin: 0;
    line-height: 1.2;
}

.pmh-live-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
}

.pmh-live-dot {
    width: 6px;
    height: 6px;
    background: #10b981;
    border-radius: 50%;
    animation: pulse-green 2s infinite;
}

.pmh-live-text {
    font-size: 11px;
    font-weight: 500;
    color: #10b981;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.pmh-expand-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    background: var(--valhalla-bg-secondary, #f9fafb);
    border: 1px solid var(--valhalla-border, #e5e7eb);
    border-radius: 5px;
    color: var(--valhalla-text-primary, #111827);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pmh-expand-btn:hover {
    background: var(--valhalla-border, #e5e7eb);
}

.pmh-expand-icon {
    width: 12px;
    height: 12px;
}

/* Content Area - No Scroll */
.pmh-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    background: var(--valhalla-bg-secondary, #f9fafb);
    width: 100%;
    box-sizing: border-box;
}

/* Section Styling */
.pmh-section {
    margin-bottom: 24px;
    width: 100%;
}

.pmh-section:last-child {
    margin-bottom: 0;
}

.pmh-section-header {
    margin-bottom: 12px;
}

.pmh-section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--valhalla-text-primary, #111827);
    margin: 0 0 2px 0;
}

.pmh-section-subtitle {
    font-size: 11px;
    color: var(--valhalla-text-secondary, #6b7280);
    margin: 0;
    line-height: 1.3;
}

/* Professional Card System */
.pmh-card {
    background: var(--valhalla-bg-primary, #ffffff);
    border: 1px solid var(--valhalla-border, #e5e7eb);
    border-radius: 6px;
    padding: 12px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
    width: 100%;
    box-sizing: border-box;
}

.pmh-card:hover {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-color: var(--valhalla-text-secondary, #6b7280);
}

/* Market Pulse Grid - Better Visual Separation */
.pmh-pulse-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px; /* Increased gap for better separation */
    width: 100%;
    padding: 8px 0;
}

/* Pulse Card Styling - Clear Visual Separation */
.pulse-card {
    background: var(--valhalla-bg-secondary, #f9fafb);
    border: 1px solid var(--valhalla-border, #e5e7eb);
    border-radius: 8px;
    padding: 12px;
    transition: all 0.2s ease;
    min-height: 80px;
}

.pulse-card:hover {
    border-color: var(--valhalla-accent, #3b82f6);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

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

.card-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--valhalla-text-secondary, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.card-status {
    font-size: 10px;
    font-weight: 500;
    color: var(--valhalla-text-tertiary, #9ca3af);
}

.card-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--valhalla-text-primary, #111827);
    margin-bottom: 8px;
    line-height: 1.2;
}

.card-indicator {
    margin-top: 8px;
}

.indicator-track {
    width: 100%;
    height: 4px;
    background: var(--valhalla-bg-tertiary, #f3f4f6);
    border-radius: 2px;
    overflow: hidden;
}

.indicator-fill {
    height: 100%;
    background: var(--valhalla-accent, #3b82f6);
    border-radius: 2px;
    transition: width 0.6s ease, background-color 0.3s ease;
}

.pmh-pulse-card .pmh-card-content {
    text-align: center;
}

.pmh-metric-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--valhalla-text-primary, #111827);
    margin-bottom: 3px;
    min-height: 20px;
}

.pmh-metric-label {
    font-size: 10px;
    font-weight: 500;
    color: var(--valhalla-text-secondary, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 6px;
}

.pmh-progress-bar {
    width: 100%;
    height: 2px;
    background: var(--valhalla-border, #e5e7eb);
    border-radius: 1px;
    overflow: hidden;
}

.pmh-progress-fill {
    height: 100%;
    width: 0%;
    border-radius: 1px;
    transition: width 0.5s ease;
}

.pmh-progress-fill.trend-color { background: #3b82f6; }
.pmh-progress-fill.strength-color { background: #10b981; }
.pmh-progress-fill.institutions-color { background: #8b5cf6; }
.pmh-progress-fill.volatility-color { background: #f59e0b; }

/* Sector Stack - Full Width */
.pmh-sector-stack,
.pmh-flow-stack,
.pmh-strategy-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

.pmh-sector-card {
    padding: 0;
    overflow: hidden;
}

.pmh-sector-header {
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1px solid var(--valhalla-border, #e5e7eb);
    background: var(--valhalla-bg-secondary, #f9fafb);
}

.pmh-sector-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.pmh-sector-indicator.leading { background: #10b981; }
.pmh-sector-indicator.lagging { background: #ef4444; }
.pmh-sector-indicator.rotation { background: #3b82f6; }

.pmh-sector-type {
    font-size: 12px;
    font-weight: 600;
    color: var(--valhalla-text-primary, #111827);
}

.pmh-sector-content {
    padding: 12px;
    min-height: 50px;
}

.pmh-sector-list {
    width: 100%;
}

.pmh-sector-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2px 0;
    font-size: 11px;
}

.pmh-sector-name {
    color: var(--valhalla-text-primary, #111827);
    font-weight: 500;
}

.pmh-sector-performance.positive {
    color: #10b981;
    font-weight: 600;
}

.pmh-sector-performance.negative {
    color: #ef4444;
    font-weight: 600;
}

/* Flow Metrics */
.pmh-flow-metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.pmh-flow-info {
    flex: 1;
}

.pmh-flow-label {
    font-size: 10px;
    font-weight: 500;
    color: var(--valhalla-text-secondary, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 2px;
}

.pmh-flow-value {
    font-size: 12px;
    font-weight: 600;
    color: var(--valhalla-text-primary, #111827);
}

.pmh-status-badge {
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 9px;
    font-weight: 500;
    text-transform: uppercase;
}

.pmh-status-badge.positive {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.pmh-status-badge.negative {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.pmh-status-badge.neutral {
    background: rgba(107, 114, 128, 0.1);
    color: var(--valhalla-text-secondary, #6b7280);
}

/* Strategy Content - Improved Key Levels */
.pmh-strategy-content {
    width: 100%;
}

.pmh-strategy-label {
    font-size: 10px;
    font-weight: 500;
    color: var(--valhalla-text-secondary, #6b7280);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.pmh-strategy-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--valhalla-text-primary, #111827);
    margin-bottom: 6px;
}

.pmh-strategy-text {
    font-size: 11px;
    color: var(--valhalla-text-secondary, #6b7280);
    line-height: 1.4;
}

/* Improved Key Levels Layout - Fixed Overlapping Text */
.pmh-key-levels-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 4px 0;
}

.pmh-key-level-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 0;
    font-size: 11px;
    min-height: 20px; /* Prevent overlapping */
}

.pmh-key-level-symbol {
    font-weight: 600;
    color: var(--valhalla-text-primary, #111827);
    flex-shrink: 0;
    min-width: 35px;
}

.pmh-key-level-data {
    display: flex;
    gap: 8px;
    font-family: monospace;
    font-size: 10px;
}

.pmh-support {
    color: #dc2626; /* Red for support */
    font-weight: 500;
}

.pmh-resistance {
    color: #059669; /* Green for resistance */
    font-weight: 500;
}

/* Legacy key levels styling (fallback) */
.pmh-key-levels {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pmh-key-level-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2px 0;
    font-size: 11px;
}

.pmh-key-level-values {
    font-family: monospace;
    color: var(--valhalla-text-secondary, #6b7280);
}

/* Footer */
.pmh-footer {
    border-top: 1px solid var(--valhalla-border, #e5e7eb);
    padding: 8px 16px;
    background: var(--valhalla-bg-primary, #ffffff);
    flex-shrink: 0;
}

.pmh-footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.pmh-update-info {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pmh-update-text {
    font-size: 10px;
    color: var(--valhalla-text-secondary, #6b7280);
}

.pmh-connection-status {
    font-size: 10px;
    color: #10b981;
    font-weight: 500;
}

/* Loading States */
.pmh-loading {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--valhalla-text-secondary, #6b7280);
    font-size: 11px;
}

.pmh-loading::before {
    content: '';
    width: 10px;
    height: 10px;
    border: 2px solid var(--valhalla-border, #e5e7eb);
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Animations */
@keyframes pulse-green {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Dark Theme - Force Compatibility */
.dark .pmh-container,
.dark .pmh-header,
.dark .pmh-footer {
    background: var(--valhalla-bg-primary, #374151) !important;
    border-color: var(--valhalla-border, #4b5563) !important;
}

.dark .pmh-content {
    background: var(--valhalla-bg-secondary, #1f2937) !important;
}

.dark .pmh-card,
.dark .pmh-sector-card,
.dark .pmh-flow-card,
.dark .pmh-strategy-card {
    background: var(--valhalla-bg-primary, #374151) !important;
    border-color: var(--valhalla-border, #4b5563) !important;
}

.dark .pmh-title,
.dark .pmh-section-title,
.dark .pmh-metric-value,
.dark .pmh-flow-value,
.dark .pmh-strategy-value,
.dark .pmh-sector-name,
.dark .pmh-sector-type,
.dark .pmh-key-level-symbol {
    color: var(--valhalla-text-primary, #f9fafb) !important;
}

.dark .pmh-section-subtitle,
.dark .pmh-metric-label,
.dark .pmh-flow-label,
.dark .pmh-strategy-label,
.dark .pmh-strategy-text,
.dark .pmh-update-text,
.dark .pmh-key-level-values {
    color: var(--valhalla-text-secondary, #d1d5db) !important;
}

/* Dark Mode Pulse Cards */
.dark .pulse-card {
    background: var(--valhalla-bg-secondary, #1f2937) !important;
    border-color: var(--valhalla-border, #374151) !important;
}

.dark .pulse-card:hover {
    border-color: var(--valhalla-accent, #3b82f6) !important;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3) !important;
}

.dark .card-value {
    color: var(--valhalla-text-primary, #f9fafb) !important;
}

.dark .card-label {
    color: var(--valhalla-text-secondary, #d1d5db) !important;
}

.dark .card-status {
    color: var(--valhalla-text-tertiary, #9ca3af) !important;
}

.dark .indicator-track {
    background: var(--valhalla-bg-tertiary, #374151) !important;
}

/* Dark Mode Key Levels */
.dark .pmh-support {
    color: #f87171 !important; /* Lighter red for dark mode */
}

.dark .pmh-resistance {
    color: #34d399 !important; /* Lighter green for dark mode */
}

.dark .pmh-sector-header {
    background: var(--valhalla-bg-secondary, #1f2937) !important;
}

.dark .pmh-expand-btn {
    background: var(--valhalla-bg-secondary, #1f2937) !important;
    border-color: var(--valhalla-border, #4b5563) !important;
    color: var(--valhalla-text-primary, #f9fafb) !important;
}

.dark .pmh-expand-btn:hover {
    background: var(--valhalla-border, #4b5563) !important;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .pmh-content {
        padding: 12px;
    }

    .pmh-pulse-grid {
        grid-template-columns: 1fr;
    }

    .pmh-section {
        margin-bottom: 20px;
    }
}