/* Custom styles for DataFlow Pro */

/* Loading states */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

/* File upload styles */
.file-upload-area {
    border: 2px dashed var(--bs-border-color);
    border-radius: 0.375rem;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.file-upload-area:hover {
    border-color: var(--bs-primary);
    background-color: var(--bs-primary-bg-subtle);
}

.file-upload-area.dragover {
    border-color: var(--bs-success);
    background-color: var(--bs-success-bg-subtle);
}

/* Chart containers */
.chart-container {
    position: relative;
    height: 400px;
    margin-bottom: 1rem;
}

.chart-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    background: white;
    padding: 1rem;
}

/* Analysis results */
.analysis-results table {
    font-size: 0.875rem;
}

.analysis-results .table th {
    background-color: var(--bs-secondary-bg);
    border-top: none;
}

/* Sticky sidebar */
.sticky-top {
    top: 1rem !important;
}

/* Card hover effects */
.card:hover {
    transform: translateY(-2px);
    transition: transform 0.2s ease-in-out;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Button loading state */
.btn-loading {
    position: relative;
    pointer-events: none;
}

.btn-loading .btn-text {
    opacity: 0;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Progress indicators */
.progress-slim {
    height: 4px;
}

/* Table responsive improvements */
.table-responsive {
    max-height: 400px;
    overflow-y: auto;
}

/* Badge variations */
.badge-outline {
    border: 1px solid currentColor;
    background: transparent;
}

/* Visualization gallery */
.viz-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}

.viz-card {
    transition: all 0.3s ease;
}

.viz-card:hover {
    transform: scale(1.02);
}

/* Custom scrollbar for webkit browsers */
.custom-scrollbar::-webkit-scrollbar {
    width: 8px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: var(--bs-secondary-bg);
    border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: var(--bs-secondary);
    border-radius: 4px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: var(--bs-secondary-color);
}

/* Form enhancements */
.form-floating .form-control:focus ~ label,
.form-floating .form-control:not(:placeholder-shown) ~ label {
    color: var(--bs-primary);
}

/* Empty state illustrations */
.empty-state {
    padding: 3rem 1rem;
    text-align: center;
    color: var(--bs-secondary-color);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Modal improvements */
.modal-content {
    border: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

/* Notification improvements */
.alert {
    border: none;
    border-left: 4px solid;
}

.alert-success {
    border-left-color: var(--bs-success);
}

.alert-danger {
    border-left-color: var(--bs-danger);
}

.alert-warning {
    border-left-color: var(--bs-warning);
}

.alert-info {
    border-left-color: var(--bs-info);
}

/* Responsive text sizing */
@media (max-width: 768px) {
    .display-1 { font-size: 2.5rem; }
    .display-4 { font-size: 1.75rem; }
}

/* Dark mode specific adjustments */
[data-bs-theme="dark"] .file-upload-area {
    border-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .file-upload-area:hover {
    background-color: rgba(var(--bs-primary-rgb), 0.1);
}

[data-bs-theme="dark"] .table {
    --bs-table-bg: transparent;
}

[data-bs-theme="dark"] .chart-fullscreen {
    background: var(--bs-dark);
}

/* Chart visualization improvements */
#chartPreview {
    width: 100% !important;
    min-height: 550px;
    overflow: hidden;
}

#chartPreview .plotly-graph-div {
    width: 100% !important;
    height: 100% !important;
}

/* Fix y-axis text overlapping */
.js-plotly-plot .plotly .ytick text {
    font-size: 11px !important;
    text-anchor: end !important;
}

.js-plotly-plot .plotly .xtick text {
    font-size: 11px !important;
}

/* Improve chart margins for better text display */
.js-plotly-plot .plotly .main-svg {
    overflow: visible !important;
}

/* Chart title styling */
.js-plotly-plot .plotly .gtitle {
    font-size: 16px !important;
    font-weight: 600 !important;
    color: var(--bs-body-color) !important;
}

/* Axis label improvements */
.js-plotly-plot .plotly .xtitle,
.js-plotly-plot .plotly .ytitle {
    font-size: 13px !important;
    font-weight: 500 !important;
    color: var(--bs-body-color) !important;
}

/* Prevent text clipping on rotated labels */
.js-plotly-plot .plotly .xtick text[transform*="rotate"] {
    text-anchor: end !important;
    dominant-baseline: middle !important;
}

/* Responsive chart adjustments */
@media (max-width: 768px) {
    #chartPreview {
        min-height: 400px;
    }
    
    .js-plotly-plot .plotly .ytick text,
    .js-plotly-plot .plotly .xtick text {
        font-size: 9px !important;
    }
}

/* AI Insights styling */
.ai-insight-card {
    border-left: 4px solid var(--bs-primary);
    background: rgba(var(--bs-primary-rgb), 0.05);
}

.chat-message {
    max-width: 80%;
    word-wrap: break-word;
    border-radius: 1rem;
}

.insight-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
}
