/**
 * QuantumLayers Analytics Styles - Dark Mode
 * File: assets/analytics-dark.css
 */

/* Analytics Section */
.ql-analytics-section {
    background: linear-gradient(135deg, #252525 0%, #2A2A2A 100%);
    border-radius: 2px;
    padding: 30px;
    margin: 40px 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.4);
    border: 1px solid rgba(139, 127, 219, 0.15);
}

.ql-analytics-section h2 {
    margin: 0 0 20px 0;
    color: #FFFFFF;
    font-size: 24px;
}

/* Chart Controls */
.ql-filter-controls,
.ql-chart-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
    color: #FFFFFF;
}

.ql-cumul-control {
    white-space: nowrap;
    display: none;
}

.ql-filter-column-selector,
.ql-filter-value,
.ql-chart-type-selector,
.ql-column-selector {
    border: 1px solid rgba(139, 127, 219, 0.3) !important;
    border-radius: 2px !important;
    color: #FFFFFF !important;
    background: rgba(255, 255, 255, 0.05) !important;
    min-width: 200px;
    transition: all 0.2s;
}

.ql-filter-column-selector:focus,
.ql-filter-value:focus,
.ql-chart-type-selector:focus {
    outline: none;
    border-color: #8B7FDB;
    box-shadow: 0 0 0 2px rgba(139, 127, 219, 0.2);
}

.ql-column-selector {
    display: none;
}

/* Date Filter Selectors - Same styling as existing filter controls */
.ql-filter-date-column-selector,
.ql-filter-date-from-custom,
.ql-filter-date-to-custom,
.ql-filter-date-to-input,
.ql-filter-date-from-input {
    border: 1px solid rgba(139, 127, 219, 0.3) !important;
    border-radius: 2px !important;
    color: #FFFFFF !important;
    background: rgba(255, 255, 255, 0.05) !important;
    font-size: 15px;
    transition: all 0.2s;
    min-width: 200px;
}

/* Focus states */
.ql-filter-date-column-selector:focus,
.ql-filter-date-from-input:focus,
.ql-filter-date-to-input:focus,
.ql-filter-date-from-custom:focus,
.ql-filter-date-to-custom:focus {
    outline: none;
    border-color: #8B7FDB !important;
    box-shadow: 0 0 0 2px rgba(139, 127, 219, 0.2);
}


/* Labels in filter controls - ensure consistent styling */
.ql-filter-controls label {
    color: #FFFFFF;
    font-size: 15px;
    white-space: nowrap;
    font-weight: 500;
}

/* Multi-Select Trigger Button */
.ql-multiselect-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(139, 127, 219, 0.3);
    border-radius: 2px;
    color: #FFFFFF;
    min-width: 200px;
    width: 100%;
    transition: all 0.2s;
}

.ql-multiselect-trigger:hover {
    border-color: #8B7FDB;
}

.ql-multiselect-trigger:active {
    background: rgba(139, 127, 219, 0.15);
}

.ql-multiselect-label {
    flex: 1;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 15px;
}

/* Multi-Select Modal */
.ql-multiselect-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.ql-multiselect-modal.show {
    display: flex;
}

.ql-multiselect-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.ql-multiselect-modal-dialog {
    position: relative;
    z-index: 10001;
    background: linear-gradient(135deg, #252525 0%, #2A2A2A 100%);
    border-radius: 4px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(139, 127, 219, 0.3);
}

.ql-multiselect-modal-header {
    padding: 10px 15px;
    border-bottom: 1px solid rgba(139, 127, 219, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.ql-multiselect-modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: #FFFFFF;
    font-weight: 600;
}

.ql-multiselect-modal-content {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.ql-multiselect-selector {
    width: 100%;
    padding: 8px;
    border: 1px solid rgba(139, 127, 219, 0.3);
    border-radius: 2px;
    font-size: 14px;
    min-height: 200px;
    max-height: 300px;
    background: rgba(255, 255, 255, 0.05);
    color: #FFFFFF;
}

.ql-multiselect-selector option {
    padding: 6px;
    color: #FFFFFF;
}

.ql-multiselect-modal-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(139, 127, 219, 0.3);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0;
}

/* Chart Container */
.ql-chart-container {
    position: relative;
    min-height: 0px;
    margin: 20px 0;
}

canvas {
    display: block;
    max-width: 100%;
    height: auto;
}

.ql-chart-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 10px;
    margin: 20px 0;
    align-items: center;
}

/* Save Chart Button */
.ql-save-chart-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 100;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(139, 127, 219, 0.4);
    border-radius: 2px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 16px;
    color: #9B8FE8;
    transition: all 0.2s;
}

.ql-save-chart-btn:hover {
    background: linear-gradient(135deg, #7C6FD6 0%, #9B8FE8 100%);
    border-color: #8B7FDB;
    color: white;
    box-shadow: 0 4px 12px rgba(139, 127, 219, 0.4);
}

.ql-save-chart-btn:active {
    transform: translateY(0);
}

/* Saved Charts Grid */
#ql-saved-charts-section {
    margin-top: 20px;
}

.ql-saved-charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(500px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.ql-saved-chart-wrapper {
    position: relative;
    background: linear-gradient(135deg, #252525 0%, #2A2A2A 100%);
    border: 1px solid rgba(139, 127, 219, 0.3);
    border-radius: 2px;
    padding: 15px;
    transition: all 0.2s;
}

.ql-saved-chart-wrapper:hover {
    border-color: #8B7FDB;
    box-shadow: 0 4px 16px rgba(139, 127, 219, 0.2);
}

.ql-saved-chart-title {
    font-size: 16px;
    font-weight: 600;
    color: #FFFFFF;
    margin-bottom: 10px;
    padding-right: 30px;
}

/* Delete Saved Chart Button */
.ql-delete-saved-chart-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 100;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(139, 127, 219, 0.3);
    border-radius: 2px;
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    color: #B8B8B8;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.ql-delete-saved-chart-btn:hover {
    background: #EB5757;
    border-color: #EB5757;
    color: white;
    box-shadow: 0 4px 12px rgba(235, 87, 87, 0.4);
}

/* Loading State */
.ql-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    color: #B8B8B8;
    font-size: 16px;
}

.ql-loading:before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(139, 127, 219, 0.2);
    border-top-color: #9B8FE8;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 10px;
}

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

/* Error State */
.ql-error {
    background: rgba(235, 87, 87, 0.15);
    border: 1px solid rgba(235, 87, 87, 0.4);
    color: #EB5757;
    padding: 15px;
    border-radius: 2px;
    margin: 10px 0;
}

/* Analysis Buttons */
.ql-analysis-buttons {
    display: flex;
    gap: 10px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.ql-analysis-btn {
    padding: 24px 24px;
    background: linear-gradient(135deg, #7C6FD6 0%, #9B8FE8 100%);
    color: white;
    border: none;
    border-radius: 2px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    line-height: 0;
    box-shadow: 0 4px 12px rgba(139, 127, 219, 0.3);
}

.ql-analysis-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(139, 127, 219, 0.4);
}

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

/* Modals */
.ql-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.ql-modal.show {
    display: flex;
}

.ql-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(5px);
}

.ql-modal-dialog {
    position: relative;
    z-index: 10001;
    top: 30px;
    margin: auto;
    background: linear-gradient(135deg, #252525 0%, #2A2A2A 100%);
    border-radius: 2px;
    width: 90%;
    height: 90%;
    overflow: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    border: 1px solid rgba(139, 127, 219, 0.3);
}

.ql-modal-header {
    padding: 20px 30px;
    border-bottom: 1px solid rgba(139, 127, 219, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ql-modal-header h2 {
    margin: 0;
    font-size: 24px;
    color: #FFFFFF;
}

.ql-multiselect-modal-close, 
.ql-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #B8B8B8;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 2px;
    transition: all 0.2s;
}

.ql-multiselect-modal-close:hover,
.ql-modal-close:hover {
    background: rgba(139, 127, 219, 0.2);
    color: #FFFFFF;
}

.ql-modal-content {
    padding: 30px;
    min-height: 200px;
}

/* Tables */
.ql-correlation-table-wrapper,
.ql-stats-table-wrapper,
.ql-anova-table-wrapper {
    overflow-x: scroll;
    overflow-y: scroll;
    margin: 20px 0;
    max-height: 600px;
}

.ql-correlation-table,
.ql-stats-table,
.ql-anova-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.ql-correlation-table th,
.ql-correlation-table td,
.ql-stats-table th,
.ql-stats-table td,
.ql-anova-table th,
.ql-anova-table td {
    padding: 10px;
    text-align: center;
    border: 1px solid rgba(139, 127, 219, 0.3);
}

.ql-stats-table thead th,
.ql-anova-table th,
.ql-correlation-table th {
    background: linear-gradient(135deg, #7C6FD6 0%, #9B8FE8 100%);
    color: white;
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 10;
}

.ql-stats-table tbody tr:nth-child(even),
.ql-correlation-table tbody tr:nth-child(even) {
    background: rgba(139, 127, 219, 0.05);
}

.ql-stats-table tbody tr:hover,
.ql-correlation-table tbody tr:hover {
    background: rgba(139, 127, 219, 0.1);
}

.ql-stats-table td,
.ql-correlation-table td,
.ql-anova-table td {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #B8B8B8;
}

.ql-anova-table tbody th {
    background: rgba(139, 127, 219, 0.1);
    color: #FFFFFF;
    text-align: left;
    position: sticky;
    left: 0;
    z-index: 9;
    font-weight: 600;
}

.ql-anova-cell {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-weight: 500;
    vertical-align: top;
    transition: all 0.2s;
}

.ql-anova-cell:hover {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(139, 127, 219, 0.4);
    z-index: 5;
}

.ql-anova-cell-content strong {
    font-size: 16px;
    color: #FFFFFF;
}

.ql-anova-details {
    font-size: 11px;
    color: #B8B8B8;
    margin-top: 4px;
}

.ql-anova-cell-error {
    background: rgba(242, 201, 76, 0.1);
    color: #F2C94C;
    font-size: 11px;
}

/* Significance Badges */
.ql-sig-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 2px;
    font-size: 11px;
    font-weight: 700;
    font-family: monospace;
    margin: 2px;
}

.ql-sig-highly {
    background: #2e7d32;
    color: white;
}

.ql-sig-very {
    background: #43a047;
    color: white;
}

.ql-sig-significant {
    background: #66bb6a;
    color: white;
}

.ql-sig-marginal {
    background: #ffeb3b;
    color: #1A1A1A;
}

.ql-sig-ns {
    background: rgba(184, 184, 184, 0.2);
    color: #B8B8B8;
}

.ql-sig-error {
    background: rgba(235, 87, 87, 0.2);
    color: #EB5757;
}

/* Legends and Info Boxes */
.ql-anova-legend {
    background: rgba(139, 127, 219, 0.1);
    padding: 15px;
    border-radius: 2px;
    margin: 20px 0;
    border-left: 4px solid #8B7FDB;
}

.ql-anova-legend h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    color: #FFFFFF;
}

.ql-anova-category-section {
    margin: 30px 0;
    padding: 20px;
    background: rgba(139, 127, 219, 0.05);
    border-radius: 2px;
    border-left: 4px solid #8B7FDB;
}

.ql-anova-category-section h4 {
    margin-top: 0;
    color: #9B8FE8;
    font-size: 18px;
}

/* Distribution Stats */
.ql-distribution-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.ql-stat-card {
    background: rgba(139, 127, 219, 0.1);
    padding: 15px;
    border-radius: 2px;
    border-left: 4px solid #8B7FDB;
}

.ql-stat-card h4 {
    margin: 0 0 5px 0;
    font-size: 12px;
    color: #B8B8B8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ql-stat-card .value {
    font-size: 24px;
    font-weight: 600;
    color: #FFFFFF;
}

/* Analysis Grid */
.ql-analysis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.ql-analysis-card {
    background: linear-gradient(135deg, #252525 0%, #2A2A2A 100%);
    border: 1px solid rgba(139, 127, 219, 0.3);
    border-radius: 2px;
    padding: 20px;
    transition: all 0.2s;
}

.ql-analysis-card:hover {
    box-shadow: 0 4px 12px rgba(139, 127, 219, 0.3);
    transform: translateY(-2px);
    border-color: #8B7FDB;
}

.ql-analysis-card h3 {
    margin: 0 0 15px 0;
    font-size: 18px;
    color: #FFFFFF;
}

.ql-analysis-card p {
    margin: 0 0 10px 0;
    color: #B8B8B8;
    line-height: 1.6;
}

/* Insights Badge */
.ql-insight-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 2px;
    font-size: 12px;
    font-weight: 600;
    margin: 5px 5px 5px 0;
}

.ql-insight-badge.positive {
    background: rgba(111, 207, 151, 0.2);
    color: #6FCF97;
    border: 1px solid rgba(111, 207, 151, 0.3);
}

.ql-insight-badge.negative {
    background: rgba(235, 87, 87, 0.2);
    color: #EB5757;
    border: 1px solid rgba(235, 87, 87, 0.3);
}

.ql-insight-badge.neutral {
    background: rgba(139, 127, 219, 0.2);
    color: #9B8FE8;
    border: 1px solid rgba(139, 127, 219, 0.3);
}

@media (max-width: 1400px) {
    .ql-filter-controls,
    .ql-chart-controls {
        flex-wrap: wrap;
        flex-direction: column;
        align-items: stretch;
    }
}
/* Responsive */
@media (max-width: 768px) {
    .ql-analytics-section {
        padding: 15px;
        margin: 20px 0px;
    }
    
    .ql-chart-row {
        grid-template-columns: 1fr;
    }
    
    .ql-saved-charts-grid {
        grid-template-columns: 1fr;
    }
    
    
    .ql-filter-selector,
    .ql-chart-selector,
    .ql-column-selector {
        width: 100%;
    }
    
    .ql-modal-dialog {
        max-width: 95%;
        margin: 10px;
    }
    
    .ql-modal-content {
        padding: 15px;
    }
    
    .ql-correlation-table,
    .ql-stats-table,
    .ql-anova-table {
        font-size: 11px;
    }
    
    .ql-correlation-table th,
    .ql-correlation-table td,
    .ql-stats-table th,
    .ql-stats-table td,
    .ql-anova-table th,
    .ql-anova-table td {
        padding: 6px;
        min-width: 80px;
    }
    
    .ql-analysis-buttons {
        flex-direction: column;
    }
    
    .ql-analysis-btn {
        width: 100%;
    }
}

/* Print Styles */
@media print {
    .ql-modal-backdrop {
        display: none;
    }
    
    .ql-modal-dialog {
        box-shadow: none;
        max-width: 100%;
    }
    
    .ql-modal-close {
        display: none;
    }
    
    .ql-analysis-btn,
    .ql-save-chart-btn,
    .ql-delete-saved-chart-btn {
        display: none;
    }
    
    .ql-anova-table-wrapper,
    .ql-correlation-table-wrapper {
        overflow: visible;
        max-height: none;
    }
}
