/* Syncfusion Spreadsheet Editor Customization */

.spreadsheet-section {
    margin-bottom: 1rem;
}

.spreadsheet-controls {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.spreadsheet-wrapper {
    position: relative;
}

.spreadsheet-container {
    border: 1px solid #dee2e6;
    border-radius: 6px;
    overflow: hidden;
    background: white;
    min-height: 500px;
}

/* Fullscreen mode for spreadsheet */
.spreadsheet-section.pseudo-fullscreen {
    position: fixed;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    z-index: 99999;
    background: #fff;
    overflow: hidden;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
}

.spreadsheet-section.pseudo-fullscreen .spreadsheet-wrapper {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.spreadsheet-section.pseudo-fullscreen .spreadsheet-container {
    flex: 1;
    height: auto !important;
    border-radius: 0;
    border: none;
    margin: 0;
}

.fullscreen-topbar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: auto;
    padding: 8px;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    z-index: 10;
    box-sizing: border-box;
}

.fullscreen-topbar-inner {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-end;
    width: 100%;
}

/* Hide original controls when in fullscreen */
.spreadsheet-section.pseudo-fullscreen .spreadsheet-controls {
    display: none;
}

/* Ensure Syncfusion spreadsheet fills container properly */
.spreadsheet-container .e-spreadsheet {
    height: 100% !important;
}

/* Customize Syncfusion theme to match app style */
.e-spreadsheet .e-toolbar {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.e-spreadsheet .e-sheet-tab-panel {
    background-color: #f8f9fa;
    border-top: 1px solid #dee2e6;
}

/* Loading state styling */
.spreadsheet-container.loading::before {
    content: 'Loading spreadsheet...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1rem;
    color: #6c757d;
    z-index: 10;
}

/* Ensure spreadsheet is responsive */
@media (max-width: 768px) {
    .spreadsheet-container {
        min-height: 400px;
    }
}

/* In two-column layout (with stimulus), ensure proper sizing */
#sql-question-page[data-layout='two-column'] .spreadsheet-container {
    height: 500px;
}

/* In single-column layout, ensure proper sizing */
#sql-question-page[data-layout='single'] .spreadsheet-container {
    height: 600px;
}
