/* Basic reset and margin for body */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}


/* Make the body take up the full height of the viewport */
html, body {
    height: 100%;
}

/* Set up the layout to be a flex container */
body {
    display: flex;
    flex-direction: column;
}


/* Main content takes up the remaining space */
main {
    flex: 1; /* Makes the main content area take all available space */
}

/* Style the footer */
footer {
    background-color: #999999;
    color: white;
    text-align: center;
    padding: 10px;
}
footer p {
    margin-bottom: 0;
}

.cm-left {
    float: left;
    list-style-type: none;
    overflow: hidden;
    white-space: nowrap;
}
.cm-right {
    float: right;
    list-style-type: none;
    margin: 0 0 0 auto;
    padding: 0;
}

.active {
    color: white;
}

.nav-item.active .nav-link {
    color: #ffffff !important;
    font-weight: 600;
}




.sql-debug-log {
    font-size: 0.8em;
    margin-top: 20px;
    background: #f9f9f9;
    border-top: 1px solid #ddd;
    padding: 10px;
    overflow-x: auto;
}

.sql-debug-log table {
    width: 100%;
    border-collapse: collapse;
}

.sql-debug-log th, .sql-debug-log td {
    border: 1px solid #ddd;
    padding: 4px;
    text-align: left;
}

.sql-debug-log th {
    background-color: #f0f0f0;
}

.sql-debug-log pre {
    margin: 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

#sql-log-footer {
    z-index: 1050;
}

#sql-log-content {
    overflow-x: hidden; /* Prevent horizontal scroll */
    word-wrap: break-word;
    white-space: normal;
}

/* Icon-based action buttons styling */
#tableBody .btn-sm {
    width: 28px;
    height: 28px;
    padding: 0.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.25rem;
}

#tableBody .btn i {
    font-size: 0.875rem;
    vertical-align: middle;
}

/* Ensure action buttons container allows horizontal layout */
#tableBody td:last-child {
    white-space: nowrap;
    text-align: center;
    min-width: 120px; /* Increased from fixed 80px to accommodate extra actions */
    width: auto; /* Allow width to grow as needed */
}

/* CRUD List View Scrolling - Keep footer visible */
.container-xxl {
    height: calc(100vh - 125px); /* Account for header, nav, and footer */
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* List view container with scrollable content */
#list-view {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 10px; /* Space for scrollbar */
}

/* Table responsive container for list views */
.table-responsive {
    max-height: calc(100vh - 250px); /* Account for header, nav, footer, and controls */
    overflow-y: auto;
    overflow-x: auto;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
}

/* Ensure table doesn't cause horizontal overflow */
.table-responsive table {
    width: 100%;
    table-layout: auto; /* Allow columns to size based on content */
    min-width: 100%; /* Ensure table takes full width of container */
}

/* Action buttons spacing */
#tableBody .btn-sm {
    margin-right: 0.25rem;
    margin-bottom: 0.25rem;
}

#tableBody .btn-sm:last-child {
    margin-right: 0;
}

/* Sticky table header for list views */
.table-responsive table thead th {
    position: sticky;
    top: 0;
    background-color: #f8f9fa;
    z-index: 10;
    border-bottom: 2px solid #dee2e6;
}

/* Ensure pagination stays at bottom of scrollable area */
#pagination {
    margin-top: 10px;
    padding: 10px 0;
    border-top: 1px solid #dee2e6;
    background-color: #f8f9fa;
}

/* Modern footer link styling */
footer a {
    color: #ffffff !important;
    text-decoration: none !important;
    font-weight: 500;
    transition: all 0.3s ease;
    border-bottom: 1px solid transparent;
    padding-bottom: 1px;
}

footer a:hover {
    color: #e9ecef !important;
    border-bottom-color: #ffffff;
    transform: translateY(-1px);
}

footer a:focus {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
    border-radius: 2px;
}