/* Market Mood Dashboard - Clean Blue Design */
.market-mood-widget {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    margin: 20px 0;
    max-width: 100%;
    color: #374151;
}

/* Header Section */
.market-mood-header {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    padding: 24px;
    border-bottom: 1px solid #e2e8f0;
}

.market-mood-title {
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 8px 0;
    letter-spacing: -0.02em;
}

.market-mood-subtitle {
    font-size: 14px;
    color: #64748b;
    margin: 0 0 16px 0;
    font-weight: 400;
}

.market-mood-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.market-mood-dropdown {
    position: relative;
}

.market-mood-select {
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 32px 8px 12px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 8px center;
    background-repeat: no-repeat;
    background-size: 16px;
    min-width: 140px;
}

.market-mood-select:hover {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.market-mood-select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

.market-mood-refresh {
    background: #2563eb;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.market-mood-refresh:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
}

.market-mood-refresh:active {
    transform: translateY(0);
}

.market-mood-refresh.refreshing {
    pointer-events: none;
    opacity: 0.7;
}

.market-mood-refresh.refreshing .refresh-icon {
    animation: spin 1s linear infinite;
}

.refresh-icon {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Market Summary */
.market-mood-summary {
    padding: 20px 24px;
    background: #fafbfc;
    border-bottom: 1px solid #e2e8f0;
}

.market-mood-overall {
    text-align: center;
}

.overall-mood {
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 4px 0;
}

.overall-sentiment {
    font-size: 13px;
    color: #64748b;
    margin: 0 0 16px 0;
}

.market-indices {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.index-item {
    background: #ffffff;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #e5e7eb;
}

.index-name {
    font-size: 12px;
    color: #6b7280;
    margin: 0 0 4px 0;
    font-weight: 500;
}

.index-change {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
}

.index-change.positive {
    color: #059669;
}

.index-change.negative {
    color: #dc2626;
}

.index-change.neutral {
    color: #6b7280;
}

/* Heatmap Grid */
.market-mood-content {
    padding: 24px;
}

.sector-heatmap {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.sector-tile {
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.sector-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
    border-color: #2563eb;
}

.sector-tile.selected {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.sector-tile::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    transition: background-color 0.3s ease;
}

.sector-tile.bullish::before {
    background: linear-gradient(90deg, #059669, #10b981);
}

.sector-tile.bearish::before {
    background: linear-gradient(90deg, #dc2626, #ef4444);
}

.sector-tile.neutral::before {
    background: linear-gradient(90deg, #6b7280, #9ca3af);
}

.sector-name {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 8px 0;
}

.sector-change {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 8px 0;
}

.sector-change.positive {
    color: #059669;
}

.sector-change.negative {
    color: #dc2626;
}

.sector-change.neutral {
    color: #6b7280;
}

.sector-sentiment {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #64748b;
    margin: 0;
}

.sentiment-icon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
}

.sentiment-icon.bullish {
    background: #059669;
}

.sentiment-icon.bearish {
    background: #dc2626;
}

.sentiment-icon.neutral {
    background: #6b7280;
}

/* Stock Tiles */
.stock-tile {
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stock-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
    border-color: #2563eb;
}

.stock-tile.selected {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.stock-tile::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    transition: background-color 0.3s ease;
}

.stock-tile.positive::before {
    background: linear-gradient(90deg, #059669, #10b981);
}

.stock-tile.negative::before {
    background: linear-gradient(90deg, #dc2626, #ef4444);
}

.stock-tile.neutral::before {
    background: linear-gradient(90deg, #6b7280, #9ca3af);
}

.stock-tile .stock-symbol {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 4px 0;
}

.stock-tile .stock-name {
    font-size: 12px;
    color: #64748b;
    margin: 0 0 8px 0;
    line-height: 1.3;
}

.stock-tile .stock-price {
    font-size: 16px;
    font-weight: 600;
    color: #374151;
    margin: 0 0 6px 0;
}

.stock-tile .stock-change {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 8px 0;
}

.stock-tile .stock-sector {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #f1f5f9;
}

.stock-tile .sector-label {
    font-size: 11px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

/* Region Tiles */
.region-tile {
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.region-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
    border-color: #2563eb;
}

.region-tile.selected {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.region-tile::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    transition: background-color 0.3s ease;
}

.region-tile.bullish::before {
    background: linear-gradient(90deg, #059669, #10b981);
}

.region-tile.bearish::before {
    background: linear-gradient(90deg, #dc2626, #ef4444);
}

.region-tile.neutral::before {
    background: linear-gradient(90deg, #6b7280, #9ca3af);
}

.region-name {
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 8px 0;
}

.region-change {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 12px 0;
}

.region-stats {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.region-sentiment {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #64748b;
}

.region-info {
    font-size: 12px;
    color: #9ca3af;
    font-weight: 500;
}

/* Tooltip */
.sector-tooltip {
    position: fixed;
    background: #1f2937;
    color: #ffffff;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transform: translateY(8px);
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    max-width: 300px;
    word-wrap: break-word;
}

.sector-tooltip.show {
    opacity: 1;
    transform: translateY(0);
}

.sector-tooltip::after {
    content: "";
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid #1f2937;
}

/* Detail Panel */
.sector-detail-panel {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    margin-top: 24px;
    display: none;
}

.sector-detail-panel.show {
    display: block;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e2e8f0;
}

.detail-title {
    font-size: 20px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
    flex: 1;
}

.detail-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #6b7280;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
    margin-left: auto;
    flex-shrink: 0;
}

.detail-close:hover {
    background: #e5e7eb;
    color: #374151;
}

.detail-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.detail-section {
    background: #ffffff;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.detail-section-title {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin: 0 0 12px 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sentiment-score {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.score-value {
    font-size: 32px;
    font-weight: 700;
    line-height: 1;
}

.score-value.bullish {
    color: #059669;
}

.score-value.bearish {
    color: #dc2626;
}

.score-value.neutral {
    color: #6b7280;
}

.score-label {
    font-size: 14px;
    color: #64748b;
    font-weight: 500;
}

.score-bar {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}

.score-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
}

.score-fill.bullish {
    background: linear-gradient(90deg, #059669, #10b981);
}

.score-fill.bearish {
    background: linear-gradient(90deg, #dc2626, #ef4444);
}

.score-fill.neutral {
    background: linear-gradient(90deg, #6b7280, #9ca3af);
}

.top-stocks {
    list-style: none;
    padding: 0;
    margin: 0;
}

.stock-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
}

.stock-item:last-child {
    border-bottom: none;
}

.stock-info {
    flex: 1;
}

.stock-symbol {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.stock-name {
    font-size: 12px;
    color: #64748b;
    margin: 2px 0 0 0;
}

.stock-price {
    text-align: right;
}

.price-value {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
}

.price-change {
    font-size: 12px;
    margin: 2px 0 0 0;
    font-weight: 500;
}

.price-change.positive {
    color: #059669;
}

.price-change.negative {
    color: #dc2626;
}

.price-change.neutral {
    color: #6b7280;
}

.headlines-list {
    list-style: none !important;
    list-style-type: none !important;
    padding: 0;
    margin: 0;
}

.headlines-list li,
.headline-item {
    padding: 8px 0;
    font-size: 13px;
    line-height: 1.4;
    color: #374151;
    border-bottom: 1px solid #f1f5f9;
    position: relative;
    padding-left: 16px;
    list-style: none !important;
    list-style-type: none !important;
}

.headlines-list li:before,
.headline-item:before {
    content: "•" !important;
    color: #2563eb;
    margin-right: 8px;
    font-weight: bold;
    position: absolute;
    left: 0;
    top: 8px;
    display: inline-block !important;
}

.headline-item:last-child {
    border-bottom: none;
}

/* Detail Panel Content Styles */
.stock-details,
.region-overview {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.detail-row,
.overview-metric,
.performance-metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f1f5f9;
}

.detail-row:last-child,
.overview-metric:last-child,
.performance-metric:last-child {
    border-bottom: none;
}

.detail-label,
.metric-label {
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
}

.detail-value,
.metric-value {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
}

.sector-breakdown {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sector-breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.sector-breakdown-item .sector-info {
    flex: 1;
}

.sector-breakdown-item .sector-name {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 2px 0;
}

.sector-breakdown-item .sector-meta {
    font-size: 12px;
    color: #64748b;
    margin: 0;
}

.sector-breakdown-item .sector-metrics {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sector-breakdown-item .sector-change {
    font-size: 14px;
    font-weight: 600;
}

.sector-breakdown-item .sector-sentiment {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
}

/* Loading State */
.market-mood-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #64748b;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e5e7eb;
    border-top: 3px solid #2563eb;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

.loading-text {
    font-size: 14px;
    font-weight: 500;
}

/* Error State */
.market-mood-error {
    text-align: center;
    padding: 40px 20px;
    color: #dc2626;
}

.error-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.error-message {
    font-size: 16px;
    font-weight: 500;
    margin: 0 0 8px 0;
}

.error-details {
    font-size: 14px;
    color: #64748b;
    margin: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .market-mood-widget {
        margin: 16px 0;
        border-radius: 8px;
    }

    .market-mood-header {
        padding: 20px;
    }

    .market-mood-title {
        font-size: 20px;
    }

    .market-mood-controls {
        gap: 12px;
    }

    .market-mood-content {
        padding: 20px;
    }

    .sector-heatmap {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .sector-tile {
        padding: 16px;
    }

    .market-indices {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .detail-content {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .detail-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .detail-close {
        align-self: flex-end;
    }
}

@media (max-width: 480px) {
    .market-mood-header {
        padding: 16px;
    }

    .market-mood-content {
        padding: 16px;
    }

    .sector-tile {
        padding: 14px;
    }

    .sector-name {
        font-size: 15px;
    }

    .sector-change {
        font-size: 18px;
    }

    .market-indices {
        grid-template-columns: 1fr;
    }
}

/* Animation for data updates */
.market-mood-widget.updating {
    pointer-events: none;
}

.market-mood-widget.updating .sector-tile {
    opacity: 0.7;
    transform: scale(0.98);
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Print styles */
@media print {
    .market-mood-widget {
        box-shadow: none;
        border: 1px solid #e5e7eb;
    }

    .market-mood-refresh {
        display: none;
    }

    .sector-tile:hover {
        transform: none;
        box-shadow: none;
    }
}
