/* General Styles */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: #f8f9fa; /* Light background */
}

main {
    flex: 1; /* Allows main content to grow and push footer down */
    padding-bottom: 60px; /* Prevent content from hiding behind footer */
}

/* Wider page shell than Bootstrap .container (~5% side margin each side). Use 95vw for ~2.5% each side. */
.content-shell {
     width: 80vw;
    margin-left: auto;
    margin-right: auto;
}

.footer {
    position: relative; /* Changed from fixed/sticky to relative for simplicity */
    bottom: 0;
    width: 100%;
    background-color: #e9ecef; /* Slightly darker footer */
}


/* Homepage Styles */
.home-logo {
    max-width: 150px; /* Adjust logo size as needed */
    height: auto;
}

/* Dashboard Styles */
#loadingIndicator, #errorIndicator {
    margin-top: 1rem;
}

.table th {
    white-space: nowrap; /* Prevent header text wrapping */
}

.table td {
    vertical-align: middle;
}

/* Style boolean columns for better readability */
.table td.boolean-true {
    color: #dc3545; /* Red for true/exceeds */
    font-weight: bold;
    text-align: center;
}

.table td.boolean-false {
    color: #198754; /* Green for false/not exceeds */
    text-align: center;
}

/* Style data cells based on threshold checks */
.table td.text-danger { /* <-- NEW CLASS */
    color: #dc3545 !important; /* Red for true/exceeds */
    /* Optional: Add font-weight back if desired */
    /* font-weight: bold; */
}

.table td.text-success { /* <-- NEW CLASS */
    color: #198754 !important; /* Green for false/not exceeds */
}

/* Responsive table */
.table-responsive {
    margin-top: 1rem;
}

/* Add some spacing for controls */
.form-label {
    margin-bottom: 0.5rem;
}

/* Style data cells based on threshold checks */
.table td.text-danger { /* <-- NEW CLASS */
    color: #dc3545 !important; /* Red for true/exceeds */
    /* Optional: Add font-weight back if desired */
    /* font-weight: bold; */
}

.table td.text-success { /* <-- NEW CLASS */
    color: #198754 !important; /* Green for false/not exceeds */
}

/* Navbar logo */
.navbar-brand img {
    margin-top: -2px; /* Fine-tune logo vertical alignment */
}

/* Make refresh button slightly smaller on smaller screens if needed */
@media (max-width: 767.98px) {
    #refreshBtn {
        font-size: 0.9rem;
        padding: 0.375rem 0.75rem;
    }
    .table {
        font-size: 0.9rem; /* Slightly smaller table text */
    }
}

/* Add spacing for grouped dashboard elements */
#grouped-data-container h3 {
    margin-top: 2rem; /* Space above customer heading */
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #dee2e6; /* Subtle line below heading */
    font-size: 1.4rem; /* Slightly larger heading */
}

/* Add margin below each table wrapper in the grouped view */
#grouped-data-container .table-responsive {
    margin-bottom: 2rem;
}

/* Make text in smaller grouped tables slightly smaller */
#grouped-data-container .table-sm {
    font-size: 0.9rem;
}
#grouped-data-container .table-sm th {
    white-space: normal; /* Allow headers in small tables to wrap if needed */
}

/* Style for the button inside the collapsible header */
.collapsible-header {
    cursor: pointer;
    color: #0d6efd; /* Bootstrap primary blue, or choose another color */
    border-bottom: 1px dashed #ccc; /* Add a visual cue */
    display: inline-block; /* Prevent it taking full width */
    padding-bottom: 2px;
    margin-bottom: 5px; /* Space between header and table */
}

.collapsible-header:hover {
    color: #0a58ca; /* Darker blue on hover */
    text-decoration: underline !important; /* Ensure underline on hover */
}

/* Optional: Style for when the collapse is open (might not be needed with btn-link) */
/*
.collapsible-header[aria-expanded="true"] {
    font-weight: bold;
}
*/

/* Adjust spacing if needed */
#grouped-data-container h3 {
    margin-top: 1.5rem; /* Reduce top margin slightly */
    margin-bottom: 0; /* Remove bottom margin as wrapper handles it */
}

/* Force color overrides for specific table cells */
#grouped-data-container .table td.text-danger {
    color: #dc3545 !important; /* Use Bootstrap's red */
}

#grouped-data-container .table td.text-success {
    color: #198754 !important; /* Use Bootstrap's green */
}

/* Magma detail: certificate expiring within 90 days (not expired) */
.table.table-sm tbody tr.table-cert-expiring,
.table.table-sm tbody tr.table-cert-expiring > td {
    background-color: #ffe5cc !important;
}

/*
  Disabled runset rows (audit log, customer logs, daily averages) and usage-disabled cert rows.
  Previously audit used inline tr color #adb5bd + opacity 0.5; cert used the same on every td, which
  stacked with striping and dense text and was harder to read. Single rule: Bootstrap secondary grey,
  italic, full opacity on text (no row background).
*/
tbody tr.table-row-disabled-muted td {
    color: #6c757d !important;
    font-style: italic;
}

/* Narrow cert tables to the page: wrap long paths/subjects (overrides global .table th nowrap in these wrappers) */
.cert-table-responsive {
    max-width: 100%;
}
.cert-table-responsive .table-cert-table {
    table-layout: fixed;
    width: 100%;
    margin-bottom: 0;
}
.cert-table-responsive .table-cert-table th,
.cert-table-responsive .table-cert-table td {
    white-space: normal;
    word-break: break-word;
    overflow-wrap: anywhere;
    vertical-align: top;
}
.cert-table-responsive .table-cert-table th:first-child,
.cert-table-responsive .table-cert-table td:first-child {
    width: 2.25rem;
}

/* Exported licence snapshot: avoid horizontal page scroll from long strings */
.exported-licence-container {
    max-width: 100%;
    overflow-x: hidden;
}
.exported-licence-container .exported-licence-dl dt,
.exported-licence-container .exported-licence-dl dd {
    overflow-wrap: anywhere;
    word-break: break-word;
}