/* Professional Dark Theme - Email Gateway Admin UI */
:root {
    /* Dark Background Palette */
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --bg-elevated: #30363d;

    /* Accent Colors - CyberFrame Blue Gradient */
    --accent-primary: #2a96fb;
    --accent-danger: #f85149;
    --accent-success: #3fb950;
    --accent-warning: #d29922;
    --gradient-blue: linear-gradient(135deg, #2a96fb 0%, #1a7cd8 100%);

    /* Text Colors */
    --text-primary: #f0f6fc;
    --text-secondary: #c9d1d9;
    --text-muted: #b1bac4;

    /* Border & Divider */
    --border-color: #30363d;
    --border-hover: #484f58;
}

/* Global Styles */
* {
    box-sizing: border-box;
}

body {
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-weight: 500;
    min-height: 100vh;
    margin: 0 !important;
    padding: 0 !important;
}

/* Global Focus Styles */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.btn:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* Smooth Transitions — enumerate properties; transition:all forces the
   browser to track every animatable property on hover-heavy elements */
a, button, .btn, .card, .badge, .alert {
    transition: color 0.2s ease, background-color 0.2s ease,
                border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Table Column Visibility - Default visible until JavaScript loads preferences */
table th[data-column-id],
table td[data-column-id] {
    display: table-cell;
}

/* Navbar */
.navbar {
    background: linear-gradient(135deg, #1a2332 0%, #161b22 100%) !important;
    border-bottom: 2px solid var(--accent-primary);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    padding: 0.5rem 1rem !important;
}

.navbar-brand {
    font-weight: 900;
    color: var(--text-primary) !important;
    font-size: 1.2rem;
    letter-spacing: 0.02em;
}

.navbar-brand:hover {
    color: var(--text-primary) !important;
}

.nav-link {
    color: var(--text-secondary) !important;
    padding: 0.5rem 1rem !important;
}

.nav-link:hover,
.nav-link:focus {
    color: var(--text-primary) !important;
}

/* Dropdown Menus */
.dropdown-menu {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    border-radius: 0.375rem;
}


.dropdown-header {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.875rem;
}

.dropdown-item-text {
    color: var(--text-muted);
}

.dropdown-divider {
    border-top-color: var(--border-color);
}

/* Cards */
.card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}


.card-header {
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-weight: 600;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
}

.card-body {
    color: var(--text-secondary);
}


.stat-card .card-body {
    padding: 1.25rem;
}


/* Tables */
.table {
    --bs-table-bg: transparent !important;
    --bs-table-color: var(--text-secondary) !important;
    --bs-table-border-color: var(--border-color) !important;
    --bs-table-striped-bg: var(--bg-tertiary) !important;
    --bs-table-hover-bg: var(--bg-tertiary) !important;
    background: transparent !important;
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 0;
}

.table-responsive {
    background: transparent !important;
}

.table thead th {
    color: var(--text-primary) !important;
    background: var(--bg-tertiary) !important;
    border-bottom: 1px solid var(--border-color) !important;
    font-weight: 900;
    text-transform: uppercase;
    font-size: 1rem;
    letter-spacing: 0.025em;
    padding: 0.75rem 1rem;
}

.table tbody {
    background: transparent !important;
}

.table tbody tr {
    background: transparent !important;
    border-bottom: 1px solid var(--border-color) !important;
}

.table tbody tr:hover {
    background: var(--bg-tertiary) !important;
}

.table tbody td {
    background: transparent !important;
    padding: 0.75rem 1rem;
    vertical-align: middle;
    border-color: var(--border-color) !important;
}

.table-hover > tbody > tr:hover > * {
    --bs-table-bg-state: var(--bg-tertiary) !important;
    --bs-table-color-state: var(--text-secondary) !important;
    background: var(--bg-tertiary) !important;
    color: var(--text-secondary) !important;
}

/* Badges */
.badge {
    font-weight: 500;
    padding: 0.375rem 0.625rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
}


/* Premium Buttons */
.btn {
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    letter-spacing: 0.01em;
}

.btn:focus {
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.25);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    border-radius: 0.375rem;
}

.btn-group-sm > .btn {
    padding: 0.35rem 0.6rem;
    font-size: 0.8125rem;
}

/* Primary - CyberFrame Blue Gradient */
.btn-primary {
    background: linear-gradient(135deg, #2a96fb 0%, #1a7cd8 100%);
    border: none;
    color: #fff;
    box-shadow: 0 2px 8px rgba(42, 150, 251, 0.25);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #3da8ff 0%, #2a96fb 100%);
    color: #fff;
    box-shadow: 0 4px 16px rgba(42, 150, 251, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(88, 166, 255, 0.3);
}

/* Success - Green glow */
.btn-success {
    background: linear-gradient(135deg, #3fb950 0%, #2ea043 100%);
    border: none;
    color: #000;
    box-shadow: 0 2px 8px rgba(63, 185, 80, 0.25);
}

.btn-success:hover {
    background: linear-gradient(135deg, #56d364 0%, #3fb950 100%);
    color: #000;
    box-shadow: 0 4px 16px rgba(63, 185, 80, 0.4);
}

.btn-success:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(63, 185, 80, 0.3);
}

/* Danger - Red glow */
.btn-danger {
    background: linear-gradient(135deg, #f85149 0%, #da3633 100%);
    border: none;
    color: #fff;
    box-shadow: 0 2px 8px rgba(248, 81, 73, 0.25);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #ff7b72 0%, #f85149 100%);
    color: #fff;
    box-shadow: 0 4px 16px rgba(248, 81, 73, 0.4);
}

.btn-danger:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(248, 81, 73, 0.3);
}

/* Warning - Amber glow */
.btn-warning {
    background: linear-gradient(135deg, #d29922 0%, #bb8009 100%);
    border: none;
    color: #000;
    box-shadow: 0 2px 8px rgba(210, 153, 34, 0.25);
}

.btn-warning:hover {
    background: linear-gradient(135deg, #e3b341 0%, #d29922 100%);
    color: #000;
    box-shadow: 0 4px 16px rgba(210, 153, 34, 0.4);
}

.btn-warning:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(210, 153, 34, 0.3);
}

/* Secondary - Subtle */
.btn-secondary {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-secondary:hover {
    background: var(--bg-elevated);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.btn-secondary:active {
    transform: translateY(0);
}

/* Outline Primary - Glassy */
.btn-outline-primary {
    background: rgba(88, 166, 255, 0.08);
    border: 1px solid rgba(88, 166, 255, 0.5);
    color: #58a6ff;
}

.btn-outline-primary:hover {
    background: rgba(88, 166, 255, 0.15);
    border-color: #58a6ff;
    color: #79b8ff;
    box-shadow: 0 0 12px rgba(88, 166, 255, 0.3);
}

.btn-outline-primary:active {
    background: rgba(88, 166, 255, 0.2);
}

/* Outline Secondary */
.btn-outline-secondary {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-outline-secondary:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

/* Outline Success - Glassy */
.btn-outline-success {
    background: rgba(63, 185, 80, 0.08);
    border: 1px solid rgba(63, 185, 80, 0.5);
    color: #3fb950;
}

.btn-outline-success:hover {
    background: rgba(63, 185, 80, 0.15);
    border-color: #3fb950;
    color: #56d364;
    box-shadow: 0 0 12px rgba(63, 185, 80, 0.3);
}

.btn-outline-success:active {
    background: rgba(63, 185, 80, 0.2);
}

/* Outline Danger - Glassy */
.btn-outline-danger {
    background: rgba(248, 81, 73, 0.08);
    border: 1px solid rgba(248, 81, 73, 0.5);
    color: #f85149;
}

.btn-outline-danger:hover {
    background: rgba(248, 81, 73, 0.15);
    border-color: #f85149;
    color: #ff7b72;
    box-shadow: 0 0 12px rgba(248, 81, 73, 0.3);
}

.btn-outline-danger:active {
    background: rgba(248, 81, 73, 0.2);
}

/* Outline Warning - Glassy */
.btn-outline-warning {
    background: rgba(210, 153, 34, 0.08);
    border: 1px solid rgba(210, 153, 34, 0.5);
    color: #d29922;
}

.btn-outline-warning:hover {
    background: rgba(210, 153, 34, 0.15);
    border-color: #d29922;
    color: #e3b341;
    box-shadow: 0 0 12px rgba(210, 153, 34, 0.3);
}

.btn-outline-warning:active {
    background: rgba(210, 153, 34, 0.2);
}

/* Outline Info - Glassy (same as primary) */
.btn-outline-info {
    background: rgba(88, 166, 255, 0.08);
    border: 1px solid rgba(88, 166, 255, 0.5);
    color: #58a6ff;
}

.btn-outline-info:hover {
    background: rgba(88, 166, 255, 0.15);
    border-color: #58a6ff;
    color: #79b8ff;
    box-shadow: 0 0 12px rgba(88, 166, 255, 0.3);
}

.btn-outline-info:active {
    background: rgba(88, 166, 255, 0.2);
}

/* Button Group Polish */
.btn-group {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border-radius: 0.5rem;
}

.btn-group > .btn {
    border-radius: 0;
}

.btn-group > .btn:first-child {
    border-top-left-radius: 0.5rem;
    border-bottom-left-radius: 0.5rem;
}

.btn-group > .btn:last-child {
    border-top-right-radius: 0.5rem;
    border-bottom-right-radius: 0.5rem;
}

.btn-group-sm {
    border-radius: 0.375rem;
}

.btn-group-sm > .btn:first-child {
    border-top-left-radius: 0.375rem;
    border-bottom-left-radius: 0.375rem;
}

.btn-group-sm > .btn:last-child {
    border-top-right-radius: 0.375rem;
    border-bottom-right-radius: 0.375rem;
}

/* Forms */
.form-label {
    color: var(--accent-primary);
    font-weight: 600;
    margin-bottom: 0.375rem;
    font-size: 0.875rem;
}

.form-control, .form-select {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
}

.form-control:focus, .form-select:focus {
    background: var(--bg-tertiary);
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.2);
    color: var(--text-primary);
}

/* Multi-select specific styling */
.form-select[multiple] {
    background: var(--bg-tertiary);
}

.form-select[multiple] option {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 0.375rem 0.5rem;
}

.form-select[multiple] option:checked {
    background: var(--accent-primary);
    color: var(--text-primary);
}

.form-control::placeholder {
    color: var(--text-muted);
}

/* Alerts */
.alert {
    border: 1px solid;
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

.alert-danger {
    background: rgba(248, 81, 73, 0.1);
    border-color: var(--accent-danger);
    color: #ff7b72;
}

.alert-success {
    background: rgba(63, 185, 80, 0.1);
    border-color: var(--accent-success);
    color: #56d364;
}

.alert-warning {
    background: rgba(210, 153, 34, 0.1);
    border-color: var(--accent-warning);
    color: #e3b341;
}

.btn-close {
    filter: invert(1);
}

/* Footer */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* Login Page */
.min-vh-100 {
    min-height: 100vh;
    background: var(--bg-primary);
}

/* Top navigation progress bar — perceived-speed feedback for full-page loads.
   Slides 0→90% while a navigation is in flight; the page is replaced before it
   finishes, so it reads as "loading" without needing a completion signal. */
#seg-nav-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3px;
    width: 0;
    z-index: 20000;
    background: linear-gradient(90deg, var(--accent-primary), #5cb3ff);
    box-shadow: 0 0 8px rgba(42, 150, 251, 0.7);
    opacity: 0;
    pointer-events: none;
    transition: width 10s cubic-bezier(0.1, 0.7, 0.1, 1), opacity 0.2s ease;
}
#seg-nav-progress.is-active {
    opacity: 1;
    width: 90%;
}
@media (prefers-reduced-motion: reduce) {
    #seg-nav-progress { transition: opacity 0.15s ease; }
    #seg-nav-progress.is-active { width: 100%; }
}

/* Reserve height on lazy panes so the spinner→table swap doesn't jump the page
   (reduces layout shift / the "pop" when a fragment finishes loading). */
.tab-lazy {
    min-height: 220px;
}

/* Loading Spinner */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(13, 17, 23, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.spinner-border {
    border-color: var(--accent-primary);
    border-right-color: transparent;
}

.text-muted {
    color: var(--text-muted) !important;
}

/* CyberFrame Gradient Text */
.gradient-text {
    background: linear-gradient(135deg, #2a96fb 0%, #1a7cd8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 0.025em;
}

/* Section Headings (h6 with gradient text) */
h6.gradient-text {
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid rgba(42, 150, 251, 0.2);
}


/* Responsive */
@media (max-width: 768px) {
    .table-responsive {
        font-size: 0.8125rem;
    }

    .navbar-brand {
        font-size: 0.875rem;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* Bootstrap Utility Overrides for Dark Theme */
.bg-light {
    background: var(--bg-tertiary) !important;
}

.bg-white {
    background: var(--bg-secondary) !important;
}

.text-dark {
    color: var(--text-primary) !important;
}

/* Warning Badge - Ensure Readable on Dark */
.bg-warning {
    background: var(--accent-warning) !important;
    color: #000 !important;
}

/* Override for badges with explicit text-white class */
.badge.bg-warning.text-white {
    color: #fff !important;
}

/* Code Block Styling */
pre {
    background: var(--bg-tertiary) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-secondary) !important;
    border-radius: 0.375rem;
    padding: 1rem;
}

pre code {
    background: transparent !important;
    color: var(--text-secondary) !important;
    font-family: 'Courier New', Courier, monospace;
}

code {
    background: var(--bg-tertiary);
    color: var(--accent-primary);
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.875em;
}

/* Table Variants Override */
.table-light {
    --bs-table-bg: var(--bg-tertiary) !important;
    --bs-table-color: var(--text-primary) !important;
}

.table-warning {
    --bs-table-bg: rgba(210, 153, 34, 0.15) !important;
    --bs-table-color: var(--text-primary) !important;
}

/* Modal Dark Theme */
.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.modal-header {
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.modal-footer {
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-color);
}

.modal-body {
    color: var(--text-secondary);
}

/* Pagination Dark Theme */
.page-link {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.page-link:hover {
    background: var(--bg-elevated);
    border-color: var(--border-hover);
    color: var(--text-primary);
}

.page-item.active .page-link {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
    color: #000;
}

.page-item.disabled .page-link {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-muted);
}

/* Card Footer */
.card-footer {
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-color);
}

/* Form Check Dark Theme */
.form-check {
    margin-bottom: 0.75rem;
    padding-left: 1.5rem;
    min-height: 1.5rem;
    display: block;
}

.form-check-input {
    background-color: var(--bg-tertiary);
    border-color: var(--border-color);
    margin-top: 0.125rem;
    margin-left: -1.5rem;
    float: left;
}

.form-check-input:checked {
    background-color: var(--accent-primary);
    border-color: var(--accent-primary);
}

.form-check-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.2);
}

.form-check-label {
    color: var(--text-primary);
    padding-left: 0.5rem;
    line-height: 1.5;
    display: inline-block;
}

/* Breadcrumb Dark Theme */
.breadcrumb {
    background: transparent;
}

.breadcrumb-item a {
    color: var(--accent-primary);
    text-decoration: none;
}

.breadcrumb-item a:hover {
    color: #79b8ff;
}


/* Alert Info */
.alert-info {
    background: rgba(88, 166, 255, 0.1);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* Horizontal Rule */
hr {
    border-color: var(--border-color);
    opacity: 1;
}

/* Nav Tabs (for tenant detail page) */
.nav-tabs {
    border-bottom-color: var(--border-color);
    gap: 0.5rem;
}

.nav-tabs .nav-link {
    background: transparent;
    color: white;
    border: 1px solid transparent;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.5rem 0.75rem;
    letter-spacing: 0.01em;
}


.nav-tabs .nav-link.active {
    background: transparent;
    border-color: var(--border-color) var(--border-color) var(--bg-secondary);
    color: white;
    font-weight: 700;
}

/* Tab Content */
.tab-content {
    background: var(--bg-secondary);
}

/* Info Badge */
.nav-tabs .badge.bg-info {
    background: rgba(var(--accent-primary-rgb, 45, 127, 210), 0.15) !important;
    color: var(--accent-primary) !important;
    font-size: 0.9rem;
    font-weight: 700;
    padding: 0.25rem 0.5rem;
    border-radius: 0.5rem;
}

/* Main tenant tab counts — larger for at-a-glance scanning (sub-tabs keep default) */
#tenantTabs .nav-link .badge.bg-info {
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.18rem 0.45rem;
    vertical-align: middle;
}

/* Unscoped `.bg-info { transparent }` used to nuke Bootstrap's cyan globally;
   badges are styled explicitly elsewhere, so the only live effect was making
   modal headers invisible. Give those the quiet-header treatment instead. */
.modal-header.bg-info {
    background: var(--bg-elevated, #21262d) !important;
    color: var(--text-primary, #ecf1f8) !important;
    border-left: 3px solid var(--accent-primary);
}
.modal-header.bg-info .btn-close {
    filter: invert(1) grayscale(100%);
}

/* List Group (if used) */
.list-group-item {
    background: var(--bg-secondary);
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.list-group-item:hover {
    background: var(--bg-tertiary);
}

/* (Dead "Premium UI Components" block removed 2026-06-06 — classes referenced in no template/JS) */

/* === COMPACT LAYOUT OVERRIDES === */

/* Reduce Bootstrap container padding */
.container-fluid {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
    padding-top: 0 !important;
}

/* Reduce card spacing */
.card {
    margin-bottom: 1rem !important;
}

.card-body {
    padding: 1rem !important;
}

.card-header {
    padding: 0.625rem 1rem !important;
}

/* Reduce margin utilities */
.mb-1 {
    margin-bottom: 0.25rem !important;
}

.mb-2 {
    margin-bottom: 0.5rem !important;
}

.mb-3 {
    margin-bottom: 0.75rem !important;
}

.mb-4 {
    margin-bottom: 1rem !important;
}

.mt-1 {
    margin-top: 0.25rem !important;
}

.mt-2 {
    margin-top: 0.5rem !important;
}

.mt-3 {
    margin-top: 0.75rem !important;
}

.mt-4 {
    margin-top: 1rem !important;
}

.my-1 {
    margin-top: 0.25rem !important;
    margin-bottom: 0.25rem !important;
}

.my-2 {
    margin-top: 0.5rem !important;
    margin-bottom: 0.5rem !important;
}

.my-3 {
    margin-top: 0.75rem !important;
    margin-bottom: 0.75rem !important;
}

.my-4 {
    margin-top: 1rem !important;
    margin-bottom: 1rem !important;
}

/* Reduce padding utilities */
.p-2 {
    padding: 0.5rem !important;
}

.p-3 {
    padding: 0.75rem !important;
}

.p-4 {
    padding: 1rem !important;
}

/* Reduce row spacing */
.row {
    margin-left: -0.5rem !important;
    margin-right: -0.5rem !important;
}

.row > * {
    padding-left: 0.5rem !important;
    padding-right: 0.5rem !important;
}

/* Reduce table padding for more compact tables */
.table thead th {
    padding: 0.5rem 0.75rem !important;
}

.table tbody td {
    padding: 0.5rem 0.75rem !important;
}

/* Reduce form spacing */
.form-group {
    margin-bottom: 0.75rem !important;
}

/* Reduce hr spacing */
hr {
    margin-top: 0.75rem !important;
    margin-bottom: 0.75rem !important;
}

/* Reduce alert padding */
.alert {
    padding: 0.75rem 1rem !important;
    margin-bottom: 0.75rem !important;
}

/* Reduce button spacing in groups */
.btn-group, .btn-toolbar {
    gap: 0.25rem;
}

/* More compact breadcrumb */
.breadcrumb {
    padding: 0.5rem 0 !important;
    margin-bottom: 0.75rem !important;
}

/* Column Customization UI */
.sortable-column-item {
    cursor: grab;
    padding: 0.5rem 0.75rem;
    transition: background-color 0.15s ease, border-color 0.15s ease;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.sortable-column-item:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-hover);
}

.sortable-column-item[draggable="false"] {
    cursor: default;
}

.sortable-column-item:active {
    cursor: grabbing;
}

.drag-handle {
    cursor: grab;
    font-size: 1.1rem;
}

.drag-handle:active {
    cursor: grabbing;
}

/* Column visibility transitions — scoped to customizable columns only;
   a global table cell transition costs paint tracking on huge log tables */
table th[data-column-id],
table td[data-column-id] {
    transition: opacity 0.2s ease;
}

table th.d-none,
table td.d-none {
    display: none !important;
}

/* Modal styling for column customizer */
#columnCustomizerModal .modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

#columnCustomizerModal .modal-header {
    border-bottom: 1px solid var(--border-color);
}

#columnCustomizerModal .modal-footer {
    border-top: 1px solid var(--border-color);
}

#columnCustomizerModal .list-group-item {
    margin-bottom: 0.375rem;
    border-radius: 0.375rem;
}

#columnCustomizerModal .list-group-item:last-child {
    margin-bottom: 0;
}

/* Toast Notification - Floating Bubble
   Layout: [accent icon] [title + message] [close]. Calm shadow (no glow),
   accent supplied by a left bar + the icon colour only. */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;          /* container ignores clicks; toasts re-enable */
}

.toast-notification {
    pointer-events: auto;
    display: flex;
    align-items: flex-start;
    gap: 0.7rem;
    min-width: 300px;
    max-width: 420px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-hover);
    border-left: 3px solid var(--border-hover);
    border-radius: 0.5rem;
    padding: 0.7rem 0.85rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    animation: slideInRight 0.28s cubic-bezier(.2,.7,.3,1);
}

.toast-notification .toast-icon {
    flex-shrink: 0;
    font-size: 1.05rem;
    line-height: 1.4;
    margin-top: 1px;
}
.toast-notification .toast-text { flex: 1 1 auto; min-width: 0; }
.toast-notification .toast-title {
    font-weight: 600;
    font-size: 0.85rem;
    line-height: 1.3;
    margin-bottom: 0.1rem;
}
.toast-notification .toast-msg {
    font-size: 0.82rem;
    line-height: 1.4;
    color: var(--text-secondary);
    word-break: break-word;
    white-space: pre-line;          /* honour \n in multi-line reports */
    max-height: 50vh;
    overflow-y: auto;
}
.toast-notification .toast-close {
    flex-shrink: 0;
    background: none;
    border: 0;
    color: var(--text-secondary);
    opacity: 0.6;
    font-size: 1rem;
    line-height: 1;
    padding: 0 0.1rem;
    cursor: pointer;
    transition: opacity 120ms ease;
}
.toast-notification .toast-close:hover { opacity: 1; }

.toast-notification.toast-success { border-left-color: var(--accent-success); }
.toast-notification.toast-success .toast-icon { color: var(--accent-success); }
.toast-notification.toast-error   { border-left-color: var(--accent-danger); }
.toast-notification.toast-error   .toast-icon { color: var(--accent-danger); }
.toast-notification.toast-warning { border-left-color: var(--accent-warning); }
.toast-notification.toast-warning .toast-icon { color: var(--accent-warning); }
.toast-notification.toast-info    { border-left-color: var(--accent-primary); }
.toast-notification.toast-info    .toast-icon { color: var(--accent-primary); }

@keyframes slideInRight {
    from { transform: translateX(400px); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}
@keyframes fadeOut {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(40px); }
}
.toast-notification.hiding { animation: fadeOut 0.28s ease-out forwards; }

/* AJAX button busy state — inline spinner, preserves width so layout
   does not jump. Use with window.segBtnBusy(btn). */
.btn.seg-busy {
    pointer-events: none;
    position: relative;
    color: transparent !important;
}
.btn.seg-busy > * { visibility: hidden; }
.btn.seg-busy::after {
    content: "";
    position: absolute;
    top: 50%; left: 50%;
    width: 0.85em; height: 0.85em;
    margin: -0.45em 0 0 -0.45em;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    color: #fff;
    animation: segSpin 0.6s linear infinite;
}
@keyframes segSpin { to { transform: rotate(360deg); } }

/* Styled confirmation modal — replaces native confirm(). Danger variant
   tints the header bar + uses a red confirm button. */
#segConfirmModal .modal-content {
    background: var(--bg-card, #161b22);
    border: 1px solid var(--border-color);
    border-radius: 9px;
}
#segConfirmModal .modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 0.7rem 1rem;
    align-items: center;
    gap: 0.5rem;
}
#segConfirmModal .modal-header .seg-confirm-icon { font-size: 1.15rem; }
#segConfirmModal.seg-danger .modal-header .seg-confirm-icon { color: var(--accent-danger); }
#segConfirmModal.seg-warning .modal-header .seg-confirm-icon { color: var(--accent-warning); }
#segConfirmModal .modal-body { font-size: 0.9rem; line-height: 1.5; color: var(--text-secondary); white-space: pre-line; }
#segConfirmModal .modal-body strong { color: var(--text-primary); }
#segConfirmModal .modal-footer { border-top: 1px solid var(--border-color); padding: 0.6rem 1rem; }
