/* --- Global & Layout --- */
:root {
    --ms-primary-color: #F48F12; /* MicroStrategy Mosaic Primary Orange */
    --ms-hover-color: #fcecdb; /* Lighter shade of primary for subtle hover */
    --ms-active-text-color: white; /* Text color for active elements */
}

body {
    overflow: hidden; /* Prevent body scrollbars */
    font-size: 0.9rem; /* Global font size reduction */
}

#left-pane {
    height: calc(100vh - 56px); /* 56px is the navbar height */
    font-size: 0.85rem; /* Make left pane slightly smaller */
    border-right: 1px solid #dee2e6;
}

.left-pane-main {
    overflow-y: auto; /* Make this main area scrollable */
    flex-grow: 1;
    min-height: 0; /* Important for flex-grow in a scrolling container */
    padding-bottom: 2rem; /* Add breathing room at bottom */
}

#right-pane {
    overflow-y: auto;
    height: calc(100vh - 56px);
}

.sidebar-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    color: #343a40; /* Darker for higher prominence */
    margin-bottom: 0.6rem;
    letter-spacing: 0.08em;
}

.column-selection-actions a {
    font-size: 0.65rem;
    text-decoration: none;
    color: var(--ms-primary-color);
    font-weight: 700;
    letter-spacing: 0.05em;
}

.column-selection-actions a:hover {
    text-decoration: underline;
}

.sidebar-footer {
    padding-top: 1rem;
    margin-top: auto;
    border-top: 1px solid #dee2e6;
    background-color: #f8f9fa;
}

h5, h6 {
    font-size: 1.1rem;
}

h6 {
    font-size: 0.9rem;
    font-weight: bold;
    margin-top: 0.5rem;
}

/* --- Delete Zone Styles --- */
.data-view-wrapper {
    display: inline-block;
    min-width: 100%;
    vertical-align: top;
}

.delete-zone {
    position: sticky;
    top: -1rem; /* Aligns with the padding of the right-pane */
    width: 100%;
    height: 40px; /* Reduced height for a sleeker look */
    display: none; /* Hidden by default until a table exists */
    flex-direction: row; /* Horizontal for a professional look */
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    
    /* Subtle resting state */
    background-color: #f8f9fa; 
    border: 1px dashed #dee2e6;
    color: #adb5bd;
    pointer-events: none;
    
    transition: all 0.2s ease-in-out;
}

.delete-zone.drag-active {
    background-color: #fff5f5;
    border-color: #ffa8a8;
    color: #fa5252;
    pointer-events: all !important;
}

.delete-zone.drag-over {
    background-color: #fa5252 !important;
    border-color: #e03131;
    color: white !important;
    transform: scale(1.005);
}

/* Ensure children NEVER catch events */
.delete-zone * {
    pointer-events: none !important;
}

.delete-zone i {
    font-size: 1rem;
    margin-right: 0.5rem;
    margin-bottom: 0;
}

.delete-zone div {
    font-size: 0.75rem; /* Reduced font size (12px) */
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* --- Loading & Feedback Styles --- */
@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

.loading-pulse {
    animation: pulse 1.5s infinite ease-in-out;
}

#loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1100;
    background: rgba(255, 255, 255, 0.8);
    padding: 2rem;
    border-radius: 10px;
    display: none;
}

#right-pane.loading {
    position: relative;
}

#right-pane.loading .data-view-wrapper {
    filter: blur(2px);
    pointer-events: none;
    opacity: 0.6;
}

.inline-loader {
    font-size: 0.8rem;
    color: #6c757d;
    padding: 0.5rem;
    display: flex;
    align-items: center;
}

.inline-loader .spinner-border {
    width: 1rem;
    height: 1rem;
    border-width: 0.15em;
    margin-right: 0.5rem;
}

.btn-loading {
    pointer-events: none;
    opacity: 0.8;
}

/* --- Row Limit Styles --- */
.row-limit-section {
    margin-top: 2rem;
    padding-top: 0.5rem;
}

.row-limit-section .input-group-text {
    background-color: #f8f9fa;
    border-right: none;
    color: #adb5bd;
}

.row-limit-section .form-control {
    border-left: none;
    font-size: 0.85rem;
}

.row-limit-section .form-control:focus {
    border-color: var(--ms-primary-color);
    box-shadow: 0 0 0 0.2rem rgba(244, 143, 18, 0.15);
    z-index: 3;
}

.row-limit-help {
    font-size: 0.7rem;
    color: #adb5bd;
    margin-top: 0.3rem;
}

/* --- Tree View Styles --- */
.tree-item {
    cursor: pointer;
    padding: 0.15rem 0.35rem; /* Reduced padding */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tree-item:hover {
    background-color: var(--ms-hover-color);
}

.tree-item.active > span, .tree-item.active > i {
    color: var(--ms-active-text-color) !important;
}
.tree-item.active {
    background-color: var(--ms-primary-color);
    border-radius: 0.25rem;
}

.tree-item-children {
    padding-left: 1.25rem;
    display: none; /* Initially hidden */
}

/* --- Column Selector Styles --- */
#column-selector {
    max-height: 180px; /* Slightly smaller max-height */
    overflow-y: auto;
    border: 1px solid #dee2e6;
    padding: 0.5rem;
    border-radius: 0.25rem;
}

/* --- Data Table Styles --- */
#table-container {
    position: relative; /* For positioning the delete zone */
}

#data-table {
    font-size: 0.85rem; /* Smaller font for the table */
}

#data-table th, #data-table td {
    padding: 0.25rem 0.4rem; /* Reduced cell padding */
}

#data-table th {
    cursor: grab;
    position: relative; /* Ensure it's a positioned element for z-index */
    white-space: nowrap;
    user-select: none; /* Block selection to allow drag */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    z-index: 1; /* Ensure it's above other non-positioned elements */
}

#data-table th.dragging {
    opacity: 0.5;
    background: var(--ms-hover-color);
}

/* --- Button Styles --- */
.btn-primary { /* Target Bootstrap's primary button class */
    background-color: var(--ms-primary-color);
    border-color: var(--ms-primary-color);
    transition: filter 0.15s ease-in-out;
}

.btn-primary:hover {
    background-color: var(--ms-primary-color);
    border-color: var(--ms-primary-color);
    filter: brightness(90%);
}

/* Navbar Branding */
.navbar-brand {
    display: flex;
    align-items: center;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: white !important;
}

.brand-logo {
    height: 24px;
    width: auto;
    margin-right: 10px;
    filter: brightness(0) invert(1); /* Make it white to match navbar text initially */
}

.brand-mosaic {
    color: var(--ms-primary-color);
    text-transform: uppercase;
    margin-right: 5px;
}

.navbar-brand {
    color: var(--ms-primary-color) !important;
}

.column-selection-actions a {
    font-size: 0.75rem; /* Make select/deselect links smaller (10px) */
}

/* --- Toast Message Styles --- */
.toast-message {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10000;
    padding: 8px 24px;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    font-weight: 500;
    font-size: 0.85rem;
    animation: toast-fadein 0.4s ease-out, toast-fadeout 0.4s ease-in 2.6s forwards;
    border: none;
}

@keyframes toast-fadein {
    from { top: -60px; opacity: 0; }
    to { top: 20px; opacity: 1; }
}

@keyframes toast-fadeout {
    from { top: 20px; opacity: 1; }
    to { top: -60px; opacity: 0; }
}

/* Force brand color on spinners */
.spinner-border.text-primary {
    color: var(--ms-primary-color) !important;
}
