/* Document Analyzer - Main Styles */

/* Main layout - 3-column structure */
.app-container {
    display: grid;
    grid-template-columns: 350px 350px 1fr;
    gap: 20px;
    padding: 20px;
    height: calc(100vh - 64px); /* Matches the height of unified nav */
}

/* Column styles */
.sidebar-column,
.settings-column,
.content-column {
    display: flex;
    flex-direction: column;
    height: 100%;
    gap: 20px;
    overflow-y: auto; /* Enable scrolling for columns */
    scrollbar-width: thin; /* Thinner scrollbars */
    padding-right: 5px; /* Add some space for the scrollbar */
}

/* Settings panels: base styles are defined in utilities.css */

.settings-panel.statistics-panel {
    margin-top: 0;
}

.settings-panel.visualization-panel {
    margin-top: 0;
    margin-bottom: 20px;
}

/* Inherit flex behavior for panels inside content column from utilities.css */

/* header rules are defined in utilities.css */

.settings-content {
    padding: 15px;
    overflow-y: visible; /* Changed from auto to let column handle scrolling */
    flex: 1;
}

/* File list styles */
.files-container {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    height: auto;
    max-height: calc(100vh - 200px);
    flex: 1;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    min-height: 48px;
    transition: background-color 0.2s;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    cursor: pointer;
}

.file-item:hover {
    background-color: var(--color-surface-hover);
}

.file-item.selected {
    background-color: var(--color-brand-primary-15);
    position: relative;
}

.file-item.selected::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background-color: var(--color-brand-primary);
}

.file-item-name {
    font-size: 14px;
    color: var(--color-text-primary);
}

.file-size {
    font-size: 12px;
    color: var(--color-text-secondary);
}

/* Settings styles */
.setting-group {
    margin-bottom: 20px;
}

.setting-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: var(--color-text-primary);
}

/* Number controls - using base.css styles */
.number-control {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.number-control input[type="number"] {
    text-align: center;
    border: 1px solid var(--color-border);
    border-radius: 0;
    padding: 6px 8px;
}

.number-control button {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    color: var(--color-text-primary);
    cursor: pointer;
    font-size: 14px;
    padding: 6px 12px;
    white-space: nowrap;
}

.number-control button:hover {
    background-color: var(--color-surface-hover);
}

/* Query input container styling - app specific */
.query-input-container {
    display: flex;
    margin-bottom: 10px;
}

.query-input-container textarea {
    flex: 1;
    resize: vertical;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    padding: 8px;
    font-size: 14px;
}

.query-input-container button {
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--color-border);
    border-left: none;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
}

/* Query history */
.query-history {
    margin-bottom: 15px;
}

.query-history h4 {
    font-size: 14px;
    margin: 0 0 8px 0;
    color: var(--color-text-secondary);
}

.query-list {
    max-height: 150px;
    overflow-y: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
}

.query-item {
    padding: 8px 10px;
    border-bottom: 1px solid var(--color-border);
    cursor: pointer;
    font-size: 13px;
    transition: background-color 0.2s;
}

.query-item:last-child {
    border-bottom: none;
}

.query-item:hover {
    background-color: var(--color-surface-hover);
}

/* Candy bar visualization */
.visualization-section {
    margin-bottom: 15px;
}

.visualization-section h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 500;
}

.visualization-wrapper {
    height: 30px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 15px;
}

.candy-bar-visualization {
    display: flex;
    height: 100%;
    width: 100%;
}

.candy-bar-segment {
    height: 100%;
    background-color: #eee;
    border-right: 1px solid rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: transform 0.2s;
}

.candy-bar-segment:hover {
    transform: scaleY(1.2);
    z-index: 2;
}

/* Relevance score */
.relevance-score {
    margin-left: auto;
    font-size: 12px;
    color: var(--color-brand-primary);
    font-weight: 500;
}

/* Document sections */
.document-section {
    margin-bottom: 15px;
    padding: 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background-color: #f9f9f9;
    transition: background-color 0.3s;
}

.section-header {
    display: flex;
    justify-content: space-between;
    padding-bottom: 10px;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--color-border);
    font-weight: 500;
}

.section-content {
    font-family: monospace;
    white-space: pre-wrap;
    font-size: 13px;
    margin: 0;
    padding: 8px;
    background-color: rgba(255, 255, 255, 0.5);
    border-radius: 3px;
    max-height: 300px;
    overflow-y: auto;
}

.section-token-count {
    font-size: 12px;
    color: var(--color-text-secondary);
}

/* Toggle buttons - use base.css styles */
.toggle-group {
    display: flex;
    overflow: hidden;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    margin-top: 10px;
    justify-content: center;
}

.toggle-group button {
    background-color: var(--color-surface);
    color: var(--color-text-primary);
    border: none;
    border-right: 1px solid var(--color-border);
    border-radius: 0;
    padding: 8px 12px;
    font-size: 14px;
    cursor: pointer;
    flex: 1;
}

.toggle-group button:last-child {
    border-right: none;
}

.toggle-group button:hover {
    background-color: var(--color-surface-hover);
}

.toggle-group button.active {
    background-color: var(--color-brand-primary);
    color: var(--color-on-brand-primary);
}

/* Make the main columns scrollable but nested elements not */
.sidebar-column,
.settings-column,
.content-column {
    /* Make main columns scrollable */
    overflow-y: auto;
    scrollbar-width: thin;
}

/* Remove scroll from nested elements */
.files-container,
.query-list,
.section-content {
    /* Don't make these scrollable */
    overflow-y: visible;
    height: auto;
    max-height: none;
}

/* Override any other height constraints */
.files-container {
    height: auto;
    max-height: none;
}

.query-list {
    max-height: none;
}

.section-content {
    max-height: none;
}

.results-header {
    margin-bottom: 1em;
}

/* Loading state */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--color-text-secondary);
    font-size: 14px;
}

/* Add file button */
.action-buttons {
    padding: 15px;
    border-top: 1px solid var(--color-border);
}
