/* Main Container */
.main-container {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: #f0f4f8;
}

/* Menu Bar */
.menu-bar {
    height: 18px;
    background: #f0f0f0;
    border-bottom: 1px solid #ccc;
    display: flex;
    align-items: center;
    padding: 0 5px;
    font-size: 11px;
}

.menu-item {
    position: relative;
    padding: 2px 8px;
    cursor: pointer;
}

.menu-item:hover {
    background: #e6e6e6;
}

.submenu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid #ccc;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    min-width: 100px;
    z-index: 1000;
}

.menu-item:hover .submenu {
    display: block;
}

.submenu a {
    display: block;
    padding: 5px 10px;
    text-decoration: none;
    color: #333;
}

.submenu a:hover {
    background: #e6e6e6;
}

/* Search Panel */
.search-panel {
    height: 42px;
    margin: 5px 10px 0 10px;
    border: 1px solid #ccc;
    background: white;
    display: flex;
    align-items: center;
    padding: 5px 10px;
}

.search-row {
    display: flex;
    width: 100%;
    align-items: center;
    gap: 20px;
}

.user-section {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
    justify-content: flex-end;
}

.database-section {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.search-section {
    flex: 1;
    display: flex;
    justify-content: flex-end;
}

.search-container {
    position: relative;
    width: 300px;
}

.search-textbox {
    width: 100%;
    height: 25px;
    border: 1.5px solid #ccc;
    border-radius: 10px;
    padding: 0 30px 0 20px;
    vertical-align: middle;
}

.search-textbox::before {
    content: "🔍";
    position: absolute;
    left: 5px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    color: #666;
}

.clear-search-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 2px;
    font-size: 14px;
    color: #666;
}

.clear-search-btn::before {
    content: "×";
}

/* Buttons */
.btn-style, .btn-ok-style {
    min-height: 25px;
    min-width: 30px;
    border-radius: 3px;
    border: 2px solid;
    cursor: pointer;
    padding: 2px;
    margin: 2px;
    text-align: center;
    vertical-align: center;
}

.btn-style {
    background: linear-gradient(to bottom, #71cff1 20%, #40baf3 85%, #19a9ec 100%);
    border-color: #0085c8;
    color: white;
    font-size: 11px;
}

.btn-style:hover {
    border-color: #016da3;
}

.btn-style.disabled {
    background: linear-gradient(to bottom, #86d2ee 20%, #68c5f0 85%, #5bc2f0 100%);
    border-color: #25aeeb;
    color: #ceecf7;
    cursor: not-allowed;
}

.btn-ok-style {
    background: linear-gradient(to bottom, #cde805 20%, #aec800 85%, #a1b400 100%);
    border-color: #bce06a;
    color: white;
    min-width: 75px;
}

.btn-ok-style:hover {
    border-color: #738703;
}

.btn-ok-style.disabled, .btn-ok-style:disabled {
    background: linear-gradient(to bottom, #e0e0e0 20%, #cccccc 85%, #bdbdbd 100%);
    border-color: #b3b3b3;
    color: #777777;
    cursor: not-allowed;
}

/* Tab Control */
.tab-control {
    flex: 1;
    margin: 10px 10px 0 10px;
    display: flex;
    flex-direction: column;
}

.tab-headers {
    display: flex;
    border-bottom: 1px solid #6e99d2;
    background: transparent;
    padding-left: 10px;
    margin-bottom: -1px;
}

.tab-header {
    position: relative;
    margin-right: -8px;
    cursor: pointer;
    z-index: 10;
}

.tab-header.active {
    z-index: 100;
}

.tab-header .tab-content {
    background: #adcdf2;
    border: 1px solid #6e99d2;
    border-bottom: none;
    padding: 8px 15px;
    border-radius: 15px 10px 0 0;
    display: flex;
    align-items: center;
    gap: 5px;
    color: #2f589a;
    min-width: 115px;
    height: 20px;
    justify-content: center;
}

.tab-header.active .tab-content {
    background: #e9f0f9;
    border-color: #e9f0f9;
}

.tab-icon {
    width: 11px;
    height: 11px;
    font-size: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tab-icon::before {
    content: "✓";
    color: green;
}

.tab-icon.cancel::before {
    content: "×";
    color: red;
}

.tab-text {
    font-size: 12px;
    font-weight: normal;
}

.close-tab-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    margin-left: 15px;
    font-size: 12px;
    color: #666;
}

.close-tab-btn::before {
    content: "×";
}

.tab-content-area {
    flex: 1;
    background: #e9f0f9;
    border: 1px solid #6e99d2;
    border-radius: 0 0 3px 3px;
    padding: 4px;
    min-height: 0; /* allow child panes to shrink and scroll */
    overflow: hidden; /* confine overflow to inner scroll areas */
}

.tab-pane {
    display: none;
    height: 100%;
    min-height: 0; /* enable inner scroll */
    overflow: hidden; /* prevent outer overflow */
}

.tab-pane.active {
    display: block;
}

/* Dimension Control */
.dimension-control {
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
}

.dimension-row {
    flex: 1;
    display: flex;
    gap: 5px;
    min-height: 0; /* allow children to shrink and scroll */
}

.available-section, .selected-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0; /* allow inner panels to scroll */
}

.control-buttons {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 5px;
    gap: 5px;
}

.control-buttons .spacer {
    margin-top: 30px;
}

/* Group Box */
.group-box {
    border: 1px solid #ccc;
    background: white;
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0; /* enable scrolling in children */
}

.group-box-header {
    background: #f0f0f0;
    border-bottom: 1px solid #ccc;
    padding: 5px 10px;
    font-weight: bold;
    font-size: 12px;
    display: flex;
    align-items: center;
}

.group-box-header .checkbox-label {
    margin-left: auto;
}

.dimension-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 5px;
    min-height: 0; /* allow available-content to scroll */
    overflow: hidden; /* confine overflow to inner panels */
}

.available-content {
    flex: 1;
    display: flex;
    min-height: 0; /* allow tree/items sections to scroll */
    overflow: hidden; /* prevent outer overflow */
}

.tree-section {
    flex: 1 1 0;
    border: 1px solid #ccc;
    background: white;
    overflow-y: auto;
    padding: 5px;
    min-height: 0;
}

.splitter {
    width: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f0f0;
    border: 1px solid #ccc;
    cursor: col-resize;
}

.splitter-button {
    background: linear-gradient(to bottom, #71cff1 20%, #40baf3 85%, #19a9ec 100%);
    border: 1px solid #0085c8;
    color: white;
    height: 50px;
    width: 100%;
    cursor: col-resize;
    border-radius: 1px;
}

.items-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0; /* allow items-list to scroll */
    overflow: hidden; /* confine scroll to items-list */
}

.items-header, .selected-items-header {
    display: flex;
    background: #f3f3f3;
    border: 1px solid #ccc;
    height: 20px;
    align-items: center;
}

.items-title {
    flex: 1;
    padding: 0 5px;
    font-size: 12px;
}

.items-count {
    padding: 0 5px;
    font-size: 12px;
    text-align: right;
}

.items-list {
    flex: 1 1 0;
    border: 1px solid #ccc;
    border-top: none;
    background: white;
    overflow-y: auto;
    padding: 2px;
    min-height: 0;
}

.item {
    padding: 2px 5px;
    cursor: pointer;
    font-size: 12px;
    border: 1px solid transparent;
}

.item:hover {
    background: #e6f3ff;
}

.item.selected {
    background: #316AC5;
    color: white;
}

/* Tree View */
.tree-view {
    font-size: 12px;
}

.tree-node {
    margin: 1px 0;
}

.tree-node-content {
    display: flex;
    align-items: center;
    padding: 1px 2px;
    cursor: pointer;
}

.tree-node-content:hover {
    background: #e6f3ff;
}

.tree-node-content.selected {
    background: #316AC5;
    color: white;
}

.tree-node-content.selected .tree-label {
    color: white;
}

.tree-expander {
    width: 12px;
    height: 12px;
    display: inline-block;
    cursor: pointer;
    text-align: center;
    font-size: 10px;
    line-height: 12px;
}

.tree-icon {
    width: 16px;
    height: 16px;
    display: inline-block;
    margin-right: 4px;
    background-size: contain;
}

.tree-icon.folder-icon {
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="%23ffcc00" d="M7 3H1v10h14V5H8L7 3z"/></svg>');
}

.tree-icon.folder-icon.has-selected {
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="%2300aa00" d="M7 3H1v10h14V5H8L7 3z"/><path fill="white" d="M4 8l2 2 5-5"/></svg>');
}

.tree-checkbox {
    margin-right: 4px;
    vertical-align: middle;
}

.tree-label {
    margin-left: 2px;
    font-size: 12px;
    user-select: none;
    cursor: pointer;
    flex: 1;
}

.tree-label:hover {
    text-decoration: underline;
}

.tree-context-menu {
    margin-left: auto;
    cursor: pointer;
    padding: 0 4px;
    font-size: 10px;
    opacity: 0.6;
}

.tree-context-menu:hover {
    opacity: 1;
    background: #ddd;
    border-radius: 2px;
}

.tree-children {
    margin-left: 16px;
    border-left: 1px dotted #ccc;
    padding-left: 4px;
}

/* Context Menu Popup */
.tree-context-menu-popup {
    background: white;
    border: 1px solid #999;
    border-radius: 3px;
    box-shadow: 2px 2px 10px rgba(0,0,0,0.2);
    font-size: 12px;
    min-width: 120px;
}

.context-menu-item {
    padding: 6px 12px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
}

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

.context-menu-item:hover {
    background: #e6f3ff;
}

/* Selected Section */
.rename-section {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 5px;
    height: 25px;
}

.rename-textbox {
    flex: 1;
    height: 20px;
    border: 1px solid #ccc;
    padding: 2px 5px;
    font-size: 11px;
}

.checkbox-label {
    display: inline;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    margin-left: 5px;
}

/* Bottom Panel */
.bottom-panel {
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 5px 10px;
}

.bottom-buttons {
    display: flex;
    gap: 10px;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.loading-content {
    background: white;
    padding: 20px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Report Control */
.report-control {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.report-toolbar {
    height: 40px;
    display: flex;
    align-items: center;
    padding: 10px;
}

.report-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.report-data-container {
    flex: 1;
    overflow: auto;
    padding: 10px;
}

.pivot-grid-container {
    height: 100%;
    overflow: auto;
}

.loading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 10px;
    font-size: 14px;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .search-section {
        flex: 0 0 auto;
    }
    
    .search-container {
        width: 200px;
    }
    
    .dimension-row {
        flex-direction: column;
        height: auto;
    }
    
    .control-buttons {
        flex-direction: row;
        padding: 10px;
    }
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
} 

/* Search section styles */
.search-section {
    padding: 10px;
   /* background: #f8f9fa;*/
    border-bottom: 1px solid #dee2e6;
}

.search-container {
    position: relative;
    width: 300px;
}

.search-textbox {
    width: 100%;
    padding: 8px 35px 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
}

.btn-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 16px;
    color: #666;
}

.btn-clear::before {
    content: "×";
}

/* Cube Status Panel */
.cube-status-panel {
    padding: 8px 10px;
    /*background: #e9f3ff;*/
    border-bottom: 1px solid #b3d9ff;
    display: flex;
    align-items: center;
}

.cube-status-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cube-status-label {
    font-size: 12px;
    font-weight: bold;
    color: #2f589a;
}

.cube-status-text {
    font-size: 12px;
    color: #666;
    font-family: monospace;
}

.cube-status-text.connected {
    color: #28a745;
}

.cube-status-text.disconnected {
    color: #dc3545;
}

.cube-status-text.loading {
    color: #ffc107;
}

.btn-cube-menu {
    background: #6e99d2;
    border: 1px solid #5a7ba8;
    border-radius: 3px;
    color: white;
    cursor: pointer;
    padding: 4px 8px;
    font-size: 12px;
    transition: background 0.2s;
}

.btn-cube-menu:hover {
    background: #5a7ba8;
}

/* Cube Menu Popup */
.cube-menu-popup {
    position: absolute;
    z-index: 1000;
    background: white;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 2px 2px 8px rgba(0,0,0,0.15);
    min-width: 200px;
}

.cube-menu-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    font-size: 13px;
}

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

.cube-menu-item:hover {
    background: #f0f8ff;
}

.cube-menu-separator {
    height: 1px;
    background: #ddd;
    margin: 4px 0;
} 

/* Dimension blocking overlay */
.dim-block-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.6);
    z-index: 500; /* above inner panels but below global loading overlay */
}

.dim-block-overlay .spinner {
    width: 20px;
    height: 20px;
    border-width: 2px;
    margin-right: 8px;
}