/* expenseCorrelation.css - Professional Financial SaaS Version */

/* ===== MAIN WRAPPER ===== */
.correlation-analysis-wrapper {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background: #FFFFFF;
    border-radius: 6px;

    max-width: 1200px; /* Maximum width for readability */
    margin: 0 auto; /* Center the content */}

/* ===== HEADER ===== */
.correlation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.correlation-title-section {
    flex: 1;
}

.correlation-main-title {
    margin: 0;
    color: #1f2937;
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.correlation-main-title svg {
    color: #3b82f6;
}

.correlation-subtitle {
    color: #6b7280;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.correlation-actions {
    display: flex;
    gap: 0.5rem;
}

.correlation-action-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: white;
    color: #3b82f6;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.correlation-action-btn:hover {
    background: #f9fafb;
    border-color: #3b82f6;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* ===== CONTROLS PANEL ===== */
.correlation-controls-panel {
    background: white;
    border-radius: 6px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: flex-end;
}

.correlation-control-group {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.correlation-control-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    font-weight: 500;
}

.correlation-radio-group {
    display: flex;
    background: #f9fafb;
    border-radius: 6px;
    padding: 0.25rem;
}

.correlation-radio-option {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.correlation-radio-option input[type="radio"] {
    accent-color: #3b82f6;
}

.correlation-radio-option:has(input:checked) {
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    color: #3b82f6;
}

/* ===== ACCOUNT SELECTOR ===== */
.correlation-account-selector-group {
    min-width: 300px;
}

.correlation-account-selector-wrapper {
    position: relative;
}

.correlation-account-selector-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    width: 100%;
}

.correlation-account-selector-btn:hover {
    border-color: #3b82f6;
    background: #f9fafb;
}

.correlation-account-dropdown {
    position: absolute;
    top: calc(100% + 0.375rem);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
}

.correlation-account-dropdown-header {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.correlation-account-dropdown-header button {
    flex: 1;
    padding: 0.375rem 0.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 0.75rem;
    transition: all 0.2s ease;
}

.correlation-account-dropdown-header button:hover {
    background: #f9fafb;
    border-color: #3b82f6;
}

.correlation-account-list {
    padding: 0.5rem;
}

.correlation-account-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.correlation-account-item:hover {
    background: #f9fafb;
}

.correlation-account-item input[type="checkbox"] {
    accent-color: #3b82f6;
}

/* ===== ANALYZE BUTTON ===== */
.correlation-analyze-btn {
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 6px;
    background: #3b82f6;
    color: white;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.correlation-analyze-btn:hover {
    background: #2563eb;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.correlation-analyze-btn:active {
    background: #1d4ed8;
}

/* ===== TABS ===== */
.correlation-tabs {
    display: flex;
    gap: 0.5rem;
    background: #f9fafb;
    padding: 0.375rem;
    border-radius: 6px;
}

.correlation-tab {
    flex: 1;
    padding: 0.875rem;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #6b7280;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
}

.correlation-tab:hover {
    color: #3b82f6;
}

.correlation-tab-active {
    background: white;
    color: #3b82f6;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* ===== RESULTS AREA ===== */
.correlation-results-area {
    background: white;
    border-radius: 6px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid #e5e7eb;
    min-height: 500px;
}

.correlation-view {
    display: none;
}

.correlation-view-active {
    display: block;
}

.correlation-chart-container {
    position: relative;
    height: 500px;
    width: 100%;
    margin-top: 1rem;
}

.correlation-chart-container canvas {
    max-width: 100%;
    max-height: 100%;
}

.correlation-placeholder {
    text-align: center;
    color: #6b7280;
    font-size: 0.875rem;
    padding: 2rem 0;
}

/* ===== CUSTOM HEATMAP GRID ===== */
.custom-correlation-heatmap {
    width: 100%;
    overflow-x: auto;
}

.correlation-heatmap-grid {
    display: inline-block;
    min-width: 100%;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    overflow: hidden;
}

.correlation-heatmap-row {
    display: flex;
}

.correlation-heatmap-cell {
    min-width: 80px;
    max-width: 150px;
    padding: 0.5rem;
    text-align: center;
    font-size: 0.8125rem;
    border: 1px solid rgba(0, 0, 0, 0.05);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.correlation-heatmap-corner {
    background: #f9fafb;
    border: none;
}

.correlation-heatmap-header {
    background: #f9fafb;
    font-weight: 500;
    color: #3b82f6;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    padding: 1rem 0.375rem;
    min-height: 120px;
}

.correlation-heatmap-row-header {
    background: #f9fafb;
    font-weight: 500;
    color: #3b82f6;
    text-align: left;
    min-width: 150px;
    max-width: 200px;
}

.correlation-heatmap-data-cell {
    cursor: help;
    font-weight: 400;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Consolas', monospace;
    font-variant-numeric: tabular-nums;
}

.correlation-heatmap-data-cell:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    z-index: 10;
    position: relative;
}

.correlation-heatmap-legend {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 6px;
}

.correlation-legend-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.correlation-legend-color {
    height: 30px;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
}

.correlation-legend-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #6b7280;
}

/* ===== INSIGHTS VIEW ===== */
.correlation-insights-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.correlation-insight-card {
    padding: 1.25rem;
    border-radius: 6px;
    border-left: 3px solid #3b82f6;
    background: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border: 1px solid #e5e7eb;
    transition: all 0.2s ease;
}

.correlation-insight-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.correlation-insight-high {
    border-left-color: #dc2626;
    background: rgba(239, 68, 68, 0.05);
}

.correlation-insight-medium {
    border-left-color: #d97706;
    background: rgba(251, 191, 36, 0.05);
}

.correlation-insight-low {
    border-left-color: #059669;
    background: rgba(16, 185, 129, 0.05);
}

.correlation-insight-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.correlation-insight-icon {
    flex-shrink: 0;
}

.correlation-insight-title {
    flex: 1;
    font-weight: 500;
    font-size: 1.0625rem;
    color: #1f2937;
}

.correlation-insight-priority {
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.05em;
}

.correlation-insight-high .correlation-insight-priority {
    background: #dc2626;
    color: white;
}

.correlation-insight-medium .correlation-insight-priority {
    background: #d97706;
    color: white;
}

.correlation-insight-low .correlation-insight-priority {
    background: #059669;
    color: white;
}

.correlation-insight-message {
    color: #374151;
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.correlation-insight-action {
    color: #1f2937;
    font-size: 0.875rem;
    padding-top: 0.5rem;
    border-top: 1px solid #f3f4f6;
}

/* ===== SCATTER VIEW ===== */
.correlation-scatter-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.correlation-scatter-controls label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #374151;
}

.correlation-scatter-controls select {
    padding: 0.5rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    font-size: 0.875rem;
    cursor: pointer;
}

/* ===== STATISTICS VIEW ===== */
.correlation-statistics-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.correlation-stat-card {
    background: #f9fafb;
    border-radius: 6px;
    padding: 1.25rem;
    border: 1px solid #e5e7eb;
}

.correlation-stat-label {
    font-size: 0.8125rem;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.375rem;
}

.correlation-stat-value {
    font-size: 1.5rem;
    font-weight: 400;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Consolas', monospace;
    font-variant-numeric: tabular-nums;
    color: #3b82f6;
}

.correlation-statistics-table-wrapper {
    overflow-x: auto;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.correlation-statistics-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.correlation-statistics-table thead {
    background: #f9fafb;
}

.correlation-statistics-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 500;
    color: #1f2937;
    border-bottom: 1px solid #e5e7eb;
}

.correlation-statistics-table td {
    padding: 1rem;
    border-bottom: 1px solid #f3f4f6;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Consolas', monospace;
    font-variant-numeric: tabular-nums;
}

.correlation-statistics-table tr:hover {
    background: #f9fafb;
}

.correlation-strong {
    color: #dc2626;
    font-weight: 400;
}

.correlation-moderate {
    color: #d97706;
    font-weight: 400;
}

.correlation-weak {
    color: #6b7280;
    font-weight: 400;
}

.correlation-sig-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.correlation-sig-yes {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

.correlation-sig-no {
    background: rgba(113, 128, 150, 0.1);
    color: #6b7280;
}

/* ===== TOAST NOTIFICATIONS ===== */
.correlation-toast {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 6px;
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 400px;
    transform: translateX(calc(100% + 1.5rem));
    transition: transform 0.3s ease;
    z-index: 9999;
}

.correlation-toast-show {
    transform: translateX(0);
}

.correlation-toast-icon {
    flex-shrink: 0;
}

.correlation-toast-message {
    color: #1f2937;
    font-size: 0.875rem;
}

.correlation-toast-success {
    border-left: 3px solid #059669;
}

.correlation-toast-error {
    border-left: 3px solid #dc2626;
}

.correlation-toast-warning {
    border-left: 3px solid #d97706;
}

.correlation-toast-info {
    border-left: 3px solid #3b82f6;
}

/* ===== WELCOME MODAL ===== */
.correlation-welcome-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.correlation-welcome-show {
    opacity: 1;
}

.correlation-welcome-content {
    background: white;
    border-radius: 6px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
}

.correlation-welcome-header {
    background: #3b82f6;
    color: white;
    padding: 2rem;
    border-radius: 6px 6px 0 0;
}

.correlation-welcome-header h2 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 600;
}

.correlation-welcome-header p {
    margin: 0.5rem 0 0;
    opacity: 0.9;
}

.correlation-welcome-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    padding: 2rem;
}

.correlation-welcome-card {
    padding: 1.25rem;
    border-radius: 6px;
    border-left: 3px solid #3b82f6;
    background: #f9fafb;
    transition: all 0.2s ease;
}

.correlation-welcome-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.correlation-welcome-card svg {
    margin-bottom: 0.5rem;
}

.correlation-welcome-card h3 {
    margin: 0.5rem 0;
    font-size: 1rem;
    font-weight: 500;
    color: #1f2937;
}

.correlation-welcome-card p {
    margin: 0;
    font-size: 0.8125rem;
    color: #6b7280;
}

.correlation-welcome-footer {
    display: flex;
    gap: 0.5rem;
    padding: 1.25rem 2rem;
    border-top: 1px solid #e5e7eb;
}

.correlation-welcome-button {
    flex: 1;
    padding: 0.875rem;
    border: none;
    border-radius: 6px;
    background: #3b82f6;
    color: white;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.correlation-welcome-button:hover {
    background: #2563eb;
}

.correlation-welcome-link {
    padding: 0.875rem;
    border: none;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    transition: color 0.2s ease;
}

.correlation-welcome-link:hover {
    color: #3b82f6;
}

/* ===== KEYBOARD SHORTCUTS MODAL ===== */
.correlation-shortcuts-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.correlation-shortcuts-show {
    opacity: 1;
}

.correlation-shortcuts-content {
    background: white;
    border-radius: 6px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
}

.correlation-shortcuts-content h3 {
    margin: 0 0 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #1f2937;
    font-weight: 600;
}

.correlation-shortcuts-grid {
    display: grid;
    gap: 1rem;
}

.correlation-shortcut-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem;
    border-radius: 6px;
    background: #f9fafb;
}

.correlation-shortcut-item kbd {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    padding: 0.375rem 0.75rem;
    font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Roboto Mono', 'Consolas', monospace;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #3b82f6;
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.05);
}

.correlation-shortcut-item span {
    color: #6b7280;
    font-size: 0.875rem;
}

.correlation-shortcuts-close {
    margin-top: 1.5rem;
    width: 100%;
    padding: 0.875rem;
    border: none;
    border-radius: 6px;
    background: #3b82f6;
    color: white;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
}

.correlation-shortcuts-close:hover {
    background: #2563eb;
}

/* ===== ERROR STATES ===== */
.correlation-error {
    text-align: center;
    padding: 2rem;
    color: #dc2626;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 6px;
    border-left: 3px solid #dc2626;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1024px) {
    .correlation-controls-panel {
        flex-direction: column;
        align-items: stretch;
        padding: 1.25rem;
    }

    .correlation-account-selector-group {
        min-width: auto;
    }

    .correlation-statistics-summary {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}

@media (max-width: 768px) {
    .correlation-analysis-wrapper {
        padding: 1rem;
    }

    .correlation-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .correlation-tabs {
        flex-direction: column;
    }

    .correlation-welcome-features {
        grid-template-columns: 1fr;
    }

    .correlation-scatter-controls {
        flex-direction: column;
    }

    .correlation-toast {
        bottom: 0.5rem;
        right: 0.5rem;
        left: 0.5rem;
        max-width: none;
    }

    .correlation-chart-container {
        height: 400px;
    }
}

@media (max-width: 480px) {
    .correlation-analysis-wrapper {
        padding: 0.75rem;
    }

    .correlation-main-title {
        font-size: 1.25rem;
    }

    .correlation-chart-container {
        height: 300px;
    }

    .correlation-statistics-table {
        font-size: 0.75rem;
    }

    .correlation-statistics-table th,
    .correlation-statistics-table td {
        padding: 0.5rem;
    }

    .correlation-controls-panel {
        padding: 1rem;
    }

    .correlation-results-area {
        padding: 1rem;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .correlation-header .correlation-actions,
    .correlation-controls-panel,
    .correlation-tabs {
        display: none;
    }

    .correlation-view {
        display: block !important;
    }

    .correlation-toast,
    .correlation-welcome-modal,
    .correlation-shortcuts-modal {
        display: none !important;
    }

    .correlation-results-area,
    .correlation-insight-card,
    .correlation-stat-card {
        border: 1px solid #d1d5db;
        page-break-inside: avoid;
    }

    .correlation-welcome-header {
        background: #3b82f6;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
}

/* ===== ACCESSIBILITY ===== */
.correlation-action-btn:focus,
.correlation-analyze-btn:focus,
.correlation-tab:focus,
.correlation-account-selector-btn:focus,
.correlation-welcome-button:focus,
.correlation-shortcuts-close:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}
