/* cortex/static/css/charts.css */

/* Chart Analysis Button */
.chart-analysis-btn {
    background: #17a2b8;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 8px;
    font-size: 14px;
    transition: background-color 0.2s;
}

.chart-analysis-btn:hover {
    background: #138496;
}

.chart-analysis-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
    opacity: 0.7;
}

/* Chart Response Container */
.chart-response-container {
    margin: 20px 0;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    background: #fafafa;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.chart-header {
    background: linear-gradient(135deg, #f5f5f5 0%, #e8e8e8 100%);
    padding: 12px 16px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chart-header h4 {
    margin: 0;
    color: #333;
    font-size: 16px;
    font-weight: 600;
}

.chart-info {
    display: flex;
    gap: 12px;
    align-items: center;
}

.chart-type {
    background: #007bff;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
}

.chart-confidence {
    background: #28a745;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.chart-rows {
    background: #6c757d;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.chart-reasoning {
    padding: 8px 16px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    font-style: italic;
    color: #666;
    font-size: 14px;
}

.chart-wrapper {
    padding: 20px;
    background: white;
    position: relative;
}

.chart-wrapper canvas {
    max-width: 100%;
    height: auto;
}

.chart-actions {
    padding: 12px 16px;
    background: #f5f5f5;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.chart-actions button {
    padding: 6px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.chart-actions button:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.chart-actions button:active {
    transform: translateY(1px);
}

/* Chart Error Styles */
.chart-error-container {
    margin: 15px 0;
    padding: 16px;
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    color: #721c24;
}

.chart-error h4 {
    margin: 0 0 8px 0;
    font-size: 16px;
}

.chart-error p {
    margin: 0;
    font-size: 14px;
}

.chart-placeholder {
    padding: 20px;
    text-align: center;
    background: #f8f9fa;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
    color: #6c757d;
}

/* Chart Analysis Modal */
.chart-analysis-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1050;
}

.chart-analysis-modal .modal-content {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.chart-analysis-modal .modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

.chart-analysis-modal .modal-header h3 {
    margin: 0;
    color: #333;
    font-size: 18px;
}

.chart-analysis-modal .modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6c757d;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-analysis-modal .modal-close:hover {
    color: #000;
}

.chart-analysis-modal .modal-body {
    padding: 20px;
}

.chart-analysis-modal .modal-footer {
    padding: 16px 20px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    background: #f8f9fa;
    border-radius: 0 0 8px 8px;
}

/* Analysis Summary */
.analysis-summary {
    background: #e7f3ff;
    padding: 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    border: 1px solid #b3d9ff;
}

.analysis-summary p {
    margin: 8px 0;
    font-size: 14px;
}

.analysis-summary strong {
    color: #0056b3;
}

/* Chart Recommendations */
.chart-recommendations {
    margin-bottom: 20px;
}

.chart-recommendation {
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 12px;
    background: #f9f9f9;
    transition: box-shadow 0.2s;
}

.chart-recommendation:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.chart-recommendation strong {
    color: #007bff;
    font-size: 16px;
}

.chart-recommendation .confidence {
    float: right;
    background: #28a745;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.chart-recommendation p {
    margin: 8px 0;
    color: #666;
    font-size: 14px;
}

.btn-generate-recommended,
.btn-generate-manual {
    background: #28a745;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 8px;
    font-size: 14px;
    transition: background-color 0.2s;
}

.btn-generate-recommended:hover,
.btn-generate-manual:hover {
    background: #218838;
}

/* Manual Chart Section */
.manual-chart-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.manual-chart-section h4 {
    margin-top: 0;
    color: #495057;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #495057;
    font-size: 14px;
}

.form-group select,
.form-group input,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group select:focus,
.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Manual Chart Message */
.manual-chart {
    border-left: 4px solid #17a2b8;
    background: rgba(23, 162, 184, 0.05);
}

/* Copy Notification */
.copy-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #28a745;
    color: white;
    padding: 12px 20px;
    border-radius: 6px;
    z-index: 1100;
    font-size: 14px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s;
    animation-fill-mode: both;
}

@keyframes slideIn {
    from { 
        transform: translateX(100%);
        opacity: 0;
    }
    to { 
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from { 
        opacity: 1;
    }
    to { 
        opacity: 0;
        transform: translateX(100%);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .chart-analysis-modal .modal-content {
        width: 95%;
        margin: 10px;
    }
    
    .chart-header {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }
    
    .chart-info {
        align-self: stretch;
        justify-content: space-between;
    }
    
    .chart-actions {
        flex-direction: column;
    }
    
    .chart-actions button {
        width: 100%;
    }
    
    .chart-recommendation .confidence {
        float: none;
        display: inline-block;
        margin-left: 8px;
    }
}

@media (max-width: 480px) {
    .chart-wrapper {
        padding: 10px;
    }
    
    .chart-analysis-btn {
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .analysis-summary,
    .manual-chart-section {
        padding: 12px;
    }
}

/* Multi-chart specific styles */
.multi-chart-indicator {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
}

.chart-carousel {
    position: relative;
    overflow: hidden;
}

.carousel-controls {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
}

.carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    transition: all 0.2s;
    cursor: pointer;
}

.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10;
}

.carousel-nav:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-50%) scale(1.1);
}

.carousel-prev { left: 8px; }
.carousel-next { right: 8px; }

.tab-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.tab-buttons {
    display: flex;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 16px;
    flex-shrink: 0;
}

.tab-btn {
    padding: 8px 16px;
    border: none;
    background: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.tab-btn.active {
    border-bottom-color: #3b82f6;
    color: #3b82f6;
}

.tab-content {
    flex: 1;
    min-height: 0;
}

.modal-chart-container {
    height: 400px;
    position: relative;
}

@media (min-width: 768px) {
    .modal-chart-container {
        height: 500px;
    }
}