/* DeployHub SQL Multi Script - Redgate-style Multi-Database Studio Theme */

.sql-multi-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 80px);
    min-height: 650px;
    background-color: #12131a;
    color: #e2e8f0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Toolbar */
.sql-multi-toolbar {
    background-color: #181924;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 6px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    z-index: 10;
}

/* Studio Workspace Body */
.sql-multi-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* Left: SQL Editor Pane */
.sql-multi-editor-pane {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background-color: #1e1e1e;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
}

.sql-multi-editor-container {
    flex: 1;
    position: relative;
    width: 100%;
    height: 100%;
}

#sql-multi-monaco-editor {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

/* Right: Databases Selection Pane */
.sql-multi-db-pane {
    width: 380px;
    min-width: 320px;
    max-width: 460px;
    background-color: #151620;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sql-multi-db-header {
    padding: 8px 12px;
    background-color: #1a1b26;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sql-multi-db-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.sql-db-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    margin-bottom: 4px;
    border-radius: 4px;
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    cursor: pointer;
    transition: all 0.15s ease;
}

.sql-db-card:hover {
    background-color: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
}

.sql-db-card.selected {
    background-color: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.35);
}

/* Progress / Execution Summary Banner */
.sql-multi-progress-banner {
    background-color: #161722;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding: 6px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

/* Results / Bottom Tabs */
.sql-multi-results-pane {
    height: 380px;
    min-height: 220px;
    max-height: 75%;
    background-color: #13141d;
    display: flex;
    flex-direction: column;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    overflow: hidden !important;
    position: relative;
    transition: height 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.sql-multi-results-pane.maximized {
    height: calc(100% - 75px) !important;
    max-height: calc(100% - 75px) !important;
    position: absolute;
    bottom: 26px;
    left: 0;
    right: 0;
    z-index: 50;
    border-top: 2px solid #3b82f6;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.6);
}

/* Force MudTabs in results pane to properly flex and constrain child height */
.sql-multi-results-pane .mud-tabs {
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    flex: 1 1 100% !important;
    min-height: 0 !important;
}

.sql-multi-results-pane .mud-tabs-tabbar {
    flex-shrink: 0 !important;
    background-color: #161724 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.sql-multi-results-pane .mud-tabs-panels {
    flex: 1 1 auto !important;
    height: 100% !important;
    min-height: 0 !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
}

.sql-multi-results-pane .mud-tab-panel {
    height: 100% !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
}

/* Tab content scrollable containers */
.sql-multi-tab-content {
    height: 100%;
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: #12131a;
}

/* Dedicated Grid Scrollable Wrapper */
.sql-multi-grid-scroll {
    flex: 1 1 auto;
    min-height: 0;
    height: 100%;
    overflow: auto !important;
    position: relative;
    background-color: #12131a;
}

.sql-multi-grid-scroll::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
.sql-multi-grid-scroll::-webkit-scrollbar-track {
    background: #12131a;
}
.sql-multi-grid-scroll::-webkit-scrollbar-thumb {
    background: #2d3748;
    border-radius: 4px;
}
.sql-multi-grid-scroll::-webkit-scrollbar-thumb:hover {
    background: #4a5568;
}

/* SSMS-like Results Grid Table */
.sql-multi-grid-scroll .ssms-grid {
    width: 100%;
    border-collapse: collapse;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 0.8rem;
    color: #e2e8f0;
    user-select: text;
}

.sql-multi-grid-scroll .ssms-grid th {
    background-color: #1c1d29;
    color: #94a3b8;
    position: sticky;
    top: 0;
    z-index: 5;
    padding: 6px 10px;
    text-align: left;
    font-weight: 600;
    border-right: 1px solid #2d3748;
    border-bottom: 2px solid #3b82f6;
    white-space: nowrap;
}

.sql-multi-grid-scroll .ssms-grid th .th-datatype {
    font-size: 0.68rem;
    font-weight: normal;
    color: #64748b;
    margin-left: 4px;
}

.sql-multi-grid-scroll .ssms-grid td {
    padding: 4px 8px;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    white-space: nowrap;
    max-width: 400px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sql-multi-grid-scroll .ssms-grid tr:hover td {
    background-color: rgba(59, 130, 246, 0.12) !important;
}

.sql-multi-grid-scroll .ssms-grid .row-index {
    background-color: #181924;
    color: #64748b;
    text-align: right;
    padding: 4px 8px;
    width: 48px;
    min-width: 48px;
    user-select: none;
    font-size: 0.75rem;
    position: sticky;
    left: 0;
    z-index: 4;
    border-right: 1px solid #2d3748;
}

.sql-multi-grid-scroll .ssms-grid th.row-index {
    background-color: #1c1d29;
    position: sticky;
    top: 0;
    left: 0;
    z-index: 6;
    text-align: center;
    border-bottom: 2px solid #3b82f6;
}

.sql-multi-grid-scroll .ssms-grid .cell-null {
    color: #ffb86c;
    font-style: italic;
    font-weight: 500;
    opacity: 0.85;
}

/* Status Bar */
.sql-multi-statusbar {
    background-color: #181924;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    height: 26px;
    min-height: 26px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.72rem;
    color: #94a3b8;
    user-select: none;
}

.sql-multi-statusbar .status-item {
    display: flex;
    align-items: center;
    gap: 6px;
}
