/* Agent-specific styles for Agent Data */

/* Specific Grid Layout */
.data-agent-container {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: var(--space-6);
    /* Min height to ensure robustness */
    min-height: calc(100vh - 200px); 
}

@media (max-width: 992px) { /* Platform Standard Breakpoint LG */
    .data-agent-container {
        grid-template-columns: 1fr;
    }
}

/* Sidebar */
.data-sidebar {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    border: 1px solid var(--border-color);
    height: fit-content;
}

.sidebar-section {
    margin-bottom: var(--space-6);
}

.sidebar-section h3 {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-4);
}

/* Dataset list */
.dataset-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.dataset-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    background: var(--bg-hover);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.dataset-item:hover {
    background: var(--bg-body); /* Changed to valid token */
    border-color: var(--primary); /* Subtle hover hint */
}

/* Specific gradient hint for active state, aligned with platform */
.dataset-item.active {
    border-color: var(--primary);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15), rgba(118, 75, 162, 0.15));
}

.dataset-icon {
    font-size: 1.5rem;
}

.dataset-info {
    flex: 1;
    min-width: 0;
}

.dataset-name {
    font-weight: var(--font-weight-medium);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dataset-meta {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

/* Upload zone */
.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary);
    background: var(--bg-hover);
}

.upload-zone i {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: var(--space-3);
}

.upload-zone p {
    color: var(--text-secondary);
    margin: 0;
}

.upload-zone .formats {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-top: var(--space-2);
    display: block;
}

/* Main content */
.data-main {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

/* Workflow header */
.workflow-header .workflow-steps {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
}

.step-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    min-width: 200px;
}
.step-icon { font-size: 1.2rem; }
.step-title { font-weight: var(--font-weight-semibold); }
.step-sub { font-size: var(--font-size-xs); color: var(--text-muted); }

/* Generic sections added */
.profiling-section,
.strategy-section,
.code-section,
.dashboard-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    border: 1px solid var(--border-color);
}

/* Dashboard controls: compact, elegant inputs/buttons */
.dashboard-controls label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.dashboard-controls .query-input[type="number"],
.dashboard-controls input[type="number"].query-input {
    width: 64px;
    height: 36px;
    padding: 6px 10px;
    border-radius: 9999px; /* pill */
    text-align: center;
}

/* Hide default spinners for cleaner look */
.dashboard-controls input[type="number"]::-webkit-outer-spin-button,
.dashboard-controls input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.dashboard-controls input[type="number"] { -moz-appearance: textfield; }

/* Ensure buttons in this row look compact and aligned */
.dashboard-controls .btn-platform { 
    /* fallback spacing in case global css differs */
    padding: 0.55rem 0.9rem;
    border-radius: 10px;
}

/* Resolution selector compact styling */
.dashboard-controls .resolution-select {
    padding: 6px 12px;
    border-radius: 9999px;
}

/* Query section */
.query-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    border: 1px solid var(--border-color);
}

.query-input-container {
    display: flex;
    gap: var(--space-3);
}

.query-input {
    flex: 1;
    padding: var(--space-4);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-body);
    color: var(--text-primary);
    font-size: var(--font-size-base);
    resize: none;
    min-height: 60px;
    font-family: inherit;
}

.query-input:focus {
    outline: none;
    border-color: var(--primary);
}

.query-options {
    display: flex;
    gap: var(--space-4);
    margin-top: var(--space-4);
    align-items: center;
}

.query-option {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    cursor: pointer;
}

.query-option input[type="checkbox"] {
    accent-color: var(--primary);
    width: 16px;
    height: 16px;
}

/* Results section */
.results-section {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    border: 1px solid var(--border-color);
    flex: 1;
    min-height: 400px; /* Minimum height for results area */
    display: flex;
    flex-direction: column;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-4);
}

.results-header h2 {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    margin: 0;
}

.result-content {
    background: var(--bg-body);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    min-height: 200px;
    white-space: pre-wrap;
    font-family: var(--font-mono);
    font-size: var(--font-size-sm);
    line-height: 1.6;
    overflow-x: auto;
    color: var(--text-primary);
    border: 1px solid var(--border-color); /* Added consistency */
}

.result-chart {
    max-width: 100%;
    border-radius: var(--radius-md);
    margin-top: var(--space-4);
    border: 1px solid var(--border-color);
}

/* Loading state */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    padding: var(--space-8);
    color: var(--text-secondary);
    width: 100%;
    height: 100%;
}

.loading i {
    animation: spin 1s linear infinite;
    font-size: 1.5rem;
}

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

/* Empty state */
.empty-state {
    text-align: center;
    padding: var(--space-10);
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: var(--space-4);
    opacity: 0.5;
}

/* Data preview table */
.data-preview {
    overflow-x: auto;
    margin-top: var(--space-4);
    border: 1px solid var(--border-color); /* Added border */
    border-radius: var(--radius-md);
}

/* Using Platform Tokens for Table */
.data-preview table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--font-size-sm);
}

.data-preview th,
.data-preview td {
    padding: var(--space-2) var(--space-3);
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-preview th {
    background: var(--bg-hover);
    font-weight: var(--font-weight-semibold);
    white-space: nowrap;
    position: sticky;
    top: 0;
}

.data-preview td {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-secondary);
}

/* Column descriptions layout (chat v2) */
.columns-list {
    list-style: none;
    padding: 0;
    margin: var(--space-3) 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.column-entry {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    width: 100%;
}

.column-name {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--text-primary);
}

.column-desc-input {
    width: 100%;
    max-width: 100%;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-body);
}

/* Modal Styling Improvements */
.modal {
    display: none; 
    position: fixed; 
    z-index: 1050; 
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    overflow: auto; 
    background-color: rgba(0,0,0,0.5); 
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    max-width: 500px;
    margin: 10% auto;
    box-shadow: var(--box-shadow-lg);
    border: 1px solid var(--border-color);
}

/* Toast notifications - keeping specific implementation but ensuring tokens */
.toast {
    position: fixed;
    bottom: var(--space-6);
    right: var(--space-6);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--space-4) var(--space-6);
    box-shadow: var(--box-shadow-lg);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1060;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.info { border-left: 4px solid var(--info); }
