/* Data Analysis Card Styles */

.analysis-card {
    position: relative;
}

/* Analysis Actions - Compact button layout */
.analysis-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
}

.analysis-actions .btn-small {
    padding: 6px 12px;
    font-size: 0.85rem;
    flex: 0 1 auto;
    min-width: 100px;
    max-width: 150px;
}

.analysis-actions button {
    white-space: nowrap;
}

/* Analysis Steps */
.analysis-steps {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    padding: 10px;
    background: rgba(0, 122, 255, 0.05);
    border-radius: 8px;
}

.analysis-steps .step {
    flex: 1;
    padding: 8px 12px;
    background: #f0f0f0;
    border-radius: 6px;
    text-align: center;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.analysis-steps .step.active {
    background: #007aff;
    color: white;
    font-weight: 500;
}

.analysis-steps .step.completed {
    background: #4caf50;
    color: white;
}

/* Chart Viewer Container - Full width below cards */
.chart-viewer-container {
    margin-top: 30px;
    width: 100%;
}

.chart-viewer {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.viewer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background: linear-gradient(135deg, #007aff, #0051d5);
    color: white;
}

.viewer-header h4 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
}

.viewer-controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

.minimize-viewer,
.close-viewer {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 5px;
    transition: all 0.2s;
}

.minimize-viewer:hover {
    color: #ffd700;
    transform: scale(1.1);
}

.close-viewer:hover {
    color: #ff3b30;
    transform: scale(1.1);
}

/* Minimized state */
.chart-viewer-container.minimized .viewer-content {
    display: none !important;
}

.chart-viewer-container.minimized {
    height: auto;
}

.viewer-content {
    display: flex;
    height: 700px;
}

/* Chart Sidebar */
.chart-sidebar {
    width: 300px;
    background: #f8f9fa;
    border-right: 1px solid #e0e0e0;
    overflow-y: auto;
    padding: 15px 0;
}

.chart-categories {
    padding: 0;
}

/* Flat chart list (no categories) */
.chart-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.chart-item {
    padding: 12px 20px;
    margin: 0;
    background: white;
    border-bottom: 1px solid #e0e0e0;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.95rem;
    color: #333;
}

.chart-item:hover {
    background: #e3f2fd;
    color: #007aff;
    padding-left: 25px;
}

.chart-item.active {
    background: #007aff;
    color: white;
    font-weight: 500;
    border-left: 4px solid #0051d5;
}

.chart-item.active:hover {
    background: #0051d5;
    color: white;
}

/* Chart Display */
.chart-display {
    flex: 1;
    position: relative;
    background: white;
    display: flex;
    flex-direction: column;
}

#chart-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.btn-fullscreen {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 8px 15px;
    background: rgba(0, 122, 255, 0.9);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.btn-fullscreen:hover {
    background: #007aff;
}

/* Fullscreen Modal */
.chart-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
}

.chart-modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    width: 98vw;
    height: 96vh;
    max-width: 98vw;
    max-height: 96vh;
    background: white;
    border-radius: 12px;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    border-radius: 12px 12px 0 0;
    flex-shrink: 0;
}

.modal-header h3 {
    margin: 0;
    color: #333;
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    padding: 0 5px;
}

.modal-close:hover {
    color: #ff3b30;
}

.modal-body {
    flex: 1;
    padding: 0;
    overflow: hidden;
    display: flex;
}

.modal-body iframe {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 0 0 12px 12px;
}

/* Empty State */
.chart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #999;
}

.chart-empty .empty-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.chart-empty .empty-text {
    font-size: 1.1rem;
}

/* Loading State */
.chart-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007aff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .viewer-content {
        flex-direction: column;
        height: auto;
    }
    
    .chart-sidebar {
        width: 100%;
        height: 150px;
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }
    
    .chart-display {
        height: 500px;
    }
    
    .tool-actions .action-group {
        flex-direction: column;
    }
}
