/**
 * Factor Info Modal CSS
 *
 * Styling for the factor information modal overlay
 */

/* Modal Overlay */
.factor-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.factor-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.factor-modal-content {
    position: relative;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    animation: factorModalSlideIn 0.3s ease-out;
}

@keyframes factorModalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Modal Header */
.factor-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.factor-modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
}

.factor-modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.factor-modal-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Modal Body */
.factor-modal-body {
    padding: 24px;
    max-height: calc(90vh - 100px);
    overflow-y: auto;
}

/* Loading State */
.factor-loading {
    text-align: center;
    padding: 40px 20px;
}

.factor-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f4f6;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: factorSpinner 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes factorSpinner {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.factor-loading p {
    color: #6b7280;
    margin: 0;
}

/* Factor Summary */
.factor-summary {
    margin-bottom: 24px;
    padding: 20px;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.factor-score {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    font-size: 1.25rem;
    font-weight: 600;
}

.factor-score-label {
    color: #374151;
    margin-right: 8px;
}

.factor-score-value {
    color: #667eea;
    font-size: 2rem;
    margin-right: 4px;
}

.factor-score-max {
    color: #6b7280;
    font-size: 1rem;
}

.factor-description {
    color: #4b5563;
    line-height: 1.6;
    margin: 0;
}

/* Indicators Section */
.factor-indicators {
    margin-bottom: 24px;
}

.factor-indicators h4 {
    margin: 0 0 16px 0;
    color: #374151;
    font-size: 1.125rem;
    font-weight: 600;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 8px;
}

.indicators-list {
    display: grid;
    gap: 12px;
}

.indicator-item {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.indicator-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #667eea;
}

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

.indicator-name {
    font-weight: 600;
    color: #374151;
    flex: 1;
}

.indicator-value {
    color: #667eea;
    font-weight: 600;
    margin-right: 12px;
}

.indicator-score {
    background: #f3f4f6;
    color: #6b7280;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
}

.indicator-description {
    color: #6b7280;
    font-size: 0.875rem;
    margin-bottom: 8px;
    line-height: 1.4;
}

.indicator-interpretation {
    color: #059669;
    font-size: 0.875rem;
    font-weight: 500;
    background: #ecfdf5;
    padding: 8px 12px;
    border-radius: 6px;
    border-left: 3px solid #10b981;
}

/* Raw Data Section */
.factor-raw-data h4 {
    margin: 0 0 16px 0;
    color: #374151;
    font-size: 1.125rem;
    font-weight: 600;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 8px;
}

.raw-data-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.raw-data-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f9fafb;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.raw-data-key {
    color: #6b7280;
    font-weight: 500;
    text-transform: capitalize;
}

.raw-data-value {
    color: #374151;
    font-weight: 600;
}

/* Comparison Data Styles */
.comparison-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

.comparison-values {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

.comparison-current,
.comparison-previous,
.comparison-five-year {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-radius: 4px;
    background: white;
    border: 1px solid #e5e7eb;
}

.comparison-current {
    border-left: 4px solid #10b981;
    background: #f0fdf4;
}

.comparison-previous {
    border-left: 4px solid #6b7280;
    background: #f9fafb;
}

.comparison-five-year {
    border-left: 4px solid #3b82f6;
    background: #eff6ff;
}

.period-label {
    color: #6b7280;
    font-weight: 500;
    font-size: 0.875rem;
}

.comparison-current .value {
    color: #059669;
    font-weight: 600;
}

.comparison-previous .value {
    color: #374151;
    font-weight: 600;
}

.comparison-five-year .value {
    color: #1d4ed8;
    font-weight: 600;
}

/* Error State */
.factor-error {
    text-align: center;
    padding: 40px 20px;
    color: #dc2626;
}

.factor-error p {
    margin: 0;
    font-size: 1.125rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .factor-modal-content {
        width: 95%;
        margin: 20px;
    }

    .factor-modal-header {
        padding: 16px 20px;
    }

    .factor-modal-header h3 {
        font-size: 1.25rem;
    }

    .factor-modal-body {
        padding: 20px;
    }

    .factor-score {
        font-size: 1.125rem;
    }

    .factor-score-value {
        font-size: 1.75rem;
    }

    .raw-data-list {
        grid-template-columns: 1fr;
    }

    .indicator-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .indicator-value {
        margin-right: 0;
    }
}

/* Body scroll lock when modal is open */
body.factor-modal-open {
    overflow: hidden;
}

/* Hover effects for factor elements */
.factor-value:hover,
.watchlist-factor:hover {
    cursor: pointer;
    background-color: #f3f4f6;
    border-radius: 4px;
    transition: background-color 0.2s;
}

/* Tooltip-like styling for factor elements */
.factor-value[data-tooltip],
.watchlist-factor[data-tooltip] {
    position: relative;
}

.factor-value[data-tooltip]:hover::after,
.watchlist-factor[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #374151;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 4px;
}

.factor-value[data-tooltip]:hover::before,
.watchlist-factor[data-tooltip]:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: #374151;
    z-index: 1000;
}

/* Raw Data Section */
.raw-data-section {
    margin-top: 20px;
    padding: 16px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.raw-data-section h4 {
    margin: 0 0 12px 0;
    color: #495057;
    font-size: 1rem;
    font-weight: 600;
}

.raw-data-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px;
}

.raw-data-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 8px;
    background-color: white;
    border-radius: 4px;
    border: 1px solid #dee2e6;
}

.raw-data-label {
    font-weight: 500;
    color: #6c757d;
    font-size: 0.875rem;
}

.raw-data-value {
    font-weight: 600;
    color: #495057;
    font-size: 0.875rem;
    text-align: right;
}

