body {
    /* Use Bootstrap's --bs-body-bg so the body color flips with
       data-bs-theme="dark". The original rule hardcoded #ffffff
       which prevented the dark-mode toggle from changing the
       page background. The repeated tile is left in place (it
       has a long inline base64 GIF in the original; you can
       remove the line below if you want a flat color). */
    background: var(--bs-body-bg);
    background-repeat: no-repeat;
    color: var(--bs-body-color);
}

h1, h2, h3, h4, h5, h6 {
    color: var(--bs-heading-color);
}

.main-color {
    background-color: #0e76a8;
}

/* Tooltip styling */
.tooltip .tooltip-inner {
    background-color: #333333;  /* Dark background */
    color: #ffffff;             /* White text */
    border: 1px solid #666666;  /* Light border */
    padding: 8px 12px;          /* Comfortable padding */
    font-size: 14px;           /* Readable font size */
    max-width: 300px;          /* Wider tooltip */
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);  /* Subtle shadow */
}

/* Tooltip arrow colors */
.tooltip.bs-tooltip-top .tooltip-arrow::before {
    border-top-color: #333333;
}

.tooltip.bs-tooltip-bottom .tooltip-arrow::before {
    border-bottom-color: #333333;
}

.tooltip.bs-tooltip-start .tooltip-arrow::before {
    border-left-color: #333333;
}

.tooltip.bs-tooltip-end .tooltip-arrow::before {
    border-right-color: #333333;
}

/* Optional: Add fade transition */
.tooltip.fade {
    transition: opacity 0.15s linear;
}

/* Optional: Increase opacity */
.tooltip {
    opacity: 0.95 !important;
}

.password-field {
    position: relative;
}

.password-field .toggle-password {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
}

.bg-orange {
    background-color: #fd7e14;
}

.table-container {
    padding: 20px;
    background-color: var(--bs-card-bg);
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(0,0,0,0.1);
    margin: 20px 0;
}

/* Match Select2 height to Bootstrap form-select */
.select2-container--bootstrap-5 .select2-selection {
    min-height: 38px !important;
}

/* DataTable wrapper styles */
.dataTables_wrapper {
    width: 100%;
}

/* Top row padding */
.dataTables_wrapper > .row:first-child {
    padding: 0 0 15px 0;  /* Added bottom padding */
}

/* Bottom row padding */
.dataTables_wrapper > .row:last-child {
    padding: 15px 0 0 0;  /* Added top padding */
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

/* Fix for "Show entries" dropdown */
.dataTables_length {
    white-space: nowrap;
    padding-left: 15px;
}

.dataTables_length select {
    width: auto;
    display: inline-block;
    margin: 0 5px;
}

/* Search box styling */
.dataTables_filter {
    text-align: right;
    padding-right: 15px;
}

.dataTables_filter input {
    width: 200px;
    margin-left: 10px;
}

/* Bottom info and pagination styling */
.dataTables_info {
    padding-left: 15px;
    float: left;
    width: auto;
    white-space: nowrap;
}

.dataTables_paginate {
    padding-right: 15px;
    float: right;
    width: auto;
}

/* Table styles */
#tablePager {
    width: 100% !important;
    margin-bottom: 0;
}

/* Clear floats */
.dataTables_wrapper > .row {
    margin: 0;
    clear: both;
}

/* Rest of your table styles */
#tablePager tbody td {
    padding: 10px;
    vertical-align: middle;
}

#tablePager.table-striped tbody tr:nth-of-type(odd) {
    background-color: var(--bs-table-striped-bg, rgba(0,0,0,.02));
}

#tablePager.table-hover tbody tr:hover {
    background-color: var(--bs-table-hover-bg, rgba(0,0,0,.075));
}

[data-bs-theme="dark"] #tablePager.table-striped tbody tr:nth-of-type(odd) {
    background-color: var(--bs-table-striped-bg);
}

[data-bs-theme="dark"] #tablePager.table-hover tbody tr:hover {
    background-color: var(--bs-table-hover-bg);
}

/* Dashboard summary cards (Total/Up/Degraded/Down on index.php).
   The original layout used Bootstrap `display-6` (≈4.5rem) for
   the counts which visually dominated the page. `.stat-card` /
   `.stat-number` keep the cards as a compact, glanceable row so
   the Top-5-slowest and Down Monitors tables below can breathe.

   In dark mode we use Bootstrap 5.3's `-subtle` color tokens
   (`bg-success-subtle` / `text-success-emphasis`, etc.) instead
   of the saturated `text-bg-success/-warning/-danger` helpers
   -- the saturated variants stay bright in both modes and look
   out of place against a dark surface. The subtle tokens flip
   to a dark-friendly tinted background and a saturated text
   color automatically, which is what we want here. */
.stat-card .card-body {
    padding: 0.5rem 0.75rem;
}

.stat-card .stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stat-card .stat-number {
    font-size: 1.75rem;
    font-weight: 600;
    line-height: 1.1;
}

.stat-card .stat-sub {
    font-size: 0.8rem;
    font-weight: 400;
    opacity: 0.85;
    margin-left: 0.25rem;
}

/* Dark-mode adjustments for the header action buttons.
   --------------------------------------------------------------
   Bootstrap's saturated `btn-{color}` variants (primary, danger,
   warning, info, secondary) are the same vivid color in both
   light and dark modes. On a dark page they look out of place --
   the blue `btn-primary` and the medium-gray `btn-secondary`
   are both too bright and create a "screaming button" effect
   against the dark background.

   We don't want to rewrite the visual identity of the buttons
   in light mode, so we scope these overrides to
   `[data-bs-theme="dark"]` (set on <html> by the toggle in
   footer.php). In light mode the rules below match nothing
   and the buttons render with their default Bootstrap colors.

   In dark mode:
   - btn-secondary becomes a neutral dark surface using the
     `--bs-tertiary-bg` token (the same surface Bootstrap uses
     for cards in dark mode). Border + text come from the
     standard `--bs-border-color` / `--bs-body-color` tokens
     so the button still feels like a button.
   - btn-primary, btn-danger, btn-warning, btn-info each get
     a slightly darkened shade of their saturated color (and
     white text). This is the same "darker hover" shade the
     login page already uses for its custom `.btn-primary`,
     applied uniformly here. The hover variants stay where
     Bootstrap puts them (one step brighter). */
[data-bs-theme="dark"] .btn-secondary {
    background-color: var(--bs-tertiary-bg);
    border-color: var(--bs-border-color);
    color: var(--bs-body-color);
}
[data-bs-theme="dark"] .btn-secondary:hover,
[data-bs-theme="dark"] .btn-secondary:focus {
    background-color: var(--bs-secondary-bg);
    border-color: var(--bs-border-color-translucent);
    color: var(--bs-body-color);
}
[data-bs-theme="dark"] .btn-secondary:disabled,
[data-bs-theme="dark"] .btn-secondary.disabled {
    background-color: var(--bs-tertiary-bg);
    border-color: var(--bs-border-color);
    color: var(--bs-secondary-color);
    opacity: 0.65;
}

[data-bs-theme="dark"] .btn-primary {
    background-color: #0c6590;
    border-color: #0c6590;
    color: #fff;
}
[data-bs-theme="dark"] .btn-primary:hover,
[data-bs-theme="dark"] .btn-primary:focus {
    background-color: #0a557a;
    border-color: #0a557a;
    color: #fff;
}

[data-bs-theme="dark"] .btn-danger {
    background-color: #b02a37;
    border-color: #b02a37;
    color: #fff;
}
[data-bs-theme="dark"] .btn-danger:hover,
[data-bs-theme="dark"] .btn-danger:focus {
    background-color: #962432;
    border-color: #962432;
    color: #fff;
}

[data-bs-theme="dark"] .btn-warning {
    /* Slightly desaturated yellow so it isn't blinding on a
       dark page. Text stays dark for contrast (yellow is the
       one color that needs dark text in both modes). */
    background-color: #cc9a06;
    border-color: #cc9a06;
    color: #000;
}
[data-bs-theme="dark"] .btn-warning:hover,
[data-bs-theme="dark"] .btn-warning:focus {
    background-color: #b3890a;
    border-color: #b3890a;
    color: #000;
}

[data-bs-theme="dark"] .btn-info {
    background-color: #087990;
    border-color: #087990;
    color: #fff;
}
[data-bs-theme="dark"] .btn-info:hover,
[data-bs-theme="dark"] .btn-info:focus {
    background-color: #066477;
    border-color: #066477;
    color: #fff;
}

/* The outline-* variants on a dark page: their border + text
   inherit the saturated color in both modes, which can look
   loud. Tone the border down a touch in dark mode so they
   blend with the page. (The text still uses the saturated
   color so the semantic meaning -- e.g. "this is a danger
   action" -- stays clear.) */
[data-bs-theme="dark"] .btn-outline-secondary {
    color: var(--bs-body-color);
    border-color: var(--bs-border-color);
}
[data-bs-theme="dark"] .btn-outline-secondary:hover,
[data-bs-theme="dark"] .btn-outline-secondary:focus {
    background-color: var(--bs-tertiary-bg);
    color: var(--bs-body-color);
    border-color: var(--bs-border-color-translucent);
}
/* Beautification additions (2026-07-12) - smooth interactions and better dark-mode depth */

.btn {
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn:hover {
    transform: translateY(-1px);
}

.table-container {
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.table-container:hover {
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
    transform: translateY(-1px);
}

[data-bs-theme="dark"] .table-container:hover {
    box-shadow: 0 8px 25px rgba(0,0,0,0.45);
}

/* Tooltip uses theme vars instead of hardcoded colors */
.tooltip .tooltip-inner {
    background-color: var(--bs-tooltip-bg, #333333);
    color: var(--bs-tooltip-color, #ffffff);
    border: 1px solid var(--bs-border-color, #666666);
}

/* Flashier polish (July 2026) - hero gradient, pulsing badges, glassmorphism.
   Compatible with data-bs-theme dark. Incremental per wanportal skill. */
.hero-header {
    background: linear-gradient(135deg, #0e76a8 0%, #1e3a8a 100%);
    color: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 10px 30px rgba(14, 118, 168, 0.3);
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}
.hero-header::after {
    content: '';
    position: absolute;
    inset: -50%;
    background: radial-gradient(circle, rgba(255,255,255,0.2) 0%, transparent 70%);
    animation: shine 8s linear infinite;
}
@keyframes shine {
    0% { transform: translateX(-30%) translateY(-30%); }
    100% { transform: translateX(30%) translateY(30%); }
}

.badge-pulse {
    animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

.glass-card {
    background: rgba(255,255,255,0.08);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.18);
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
}
[data-bs-theme="dark"] .glass-card {
    background: rgba(0,0,0,0.35);
    border-color: rgba(255,255,255,0.12);
}
