:root {
    --background-dark: #353637;
    --background-light-dark: #333;
    --background-darker: #2c2c2e; /* Even darker grey for menu items */
    --border-color: #4a4b50;
    --text-color: #f8f8f2;
    --accent-color: #9B242B;
    --accent-hover: #6C0F11;
    --placeholder-color: #888;
    --input-padding: 0.5rem;
    --input-focus-color: #9B242B; /* New variable for focus color */
    --background-header: #2c2c2e; /* A distinct dark grey for the card header */
    --header-border-color: #2c2c2e; /* Slightly lighter border for headers for subtle contrast */
    --background-hover: #3a3a3c; /* Slightly lighter grey for hover effect */
}

body {
    background-color: var(--background-dark);
    color: var(--text-color);
}

.table th,
.table td,
.card.bg-dark,
.list-group-item,
.table-dark,
.table-dark th,
.table-dark td {
    background-color: var(--background-dark);
    color: var(--text-color);
    border-color: var(--border-color);
}

/* Redefining card-header */
.card-header {
    background-color: var(--background-header); /* A distinct background color for the header */
    color: var(--text-color);
    padding: 1rem; /* Add more padding for visual comfort */
    border-bottom: 2px solid var(--header-border-color); /* A subtle border to separate from the card body */
    margin-bottom: -1px; /* Optional: Adjusts the space between the header and the body of the card */
}

/* Ensure the <h3> inside the card-header is also styled appropriately */
.card-header > h3 {
    margin-bottom: 0; /* Removes default margin */
    font-size: 1.5rem; /* Adjusts the size as needed */
    font-weight: normal; /* Adjusts the weight as needed */
    color: inherit; /* Ensures text color is inherited from the card-header */
}

.list-group-item:hover,
.table-dark tbody tr:hover {
    background-color: var(--background-dark);
}

/* Buttons have a shared style, with differences only on hover */
/* Force all .btn-dark and .btn-primary states to show RedMimicry colors,
   including the "while-clicked" appearance */

.btn-dark,
.btn-primary {
    background-color: var(--accent-color) !important;
    border-color: var(--accent-hover) !important;
    color: var(--text-color) !important;
}

/* Hover states */
.btn-dark:hover,
.btn-primary:hover {
    background-color: var(--accent-hover) !important;
    border-color: var(--accent-hover) !important;
}

/* Active / Focus states (including .btn-check scenarios) */
.btn-dark:active,
.btn-dark:focus,
.btn-dark:active:focus,
.btn-dark.active,
.show > .btn-dark.dropdown-toggle,
.btn-check:focus + .btn-dark,
.btn-check:active + .btn-dark,
.btn-primary:active,
.btn-primary:focus,
.btn-primary:active:focus,
.btn-primary.active,
.show > .btn-primary.dropdown-toggle,
.btn-check:focus + .btn-primary,
.btn-check:active + .btn-primary {
    background-color: var(--accent-hover) !important;
    border-color: var(--accent-hover) !important;
    box-shadow: none !important;
    outline: none !important;
}

/*
Labels and Form controls - uncomment if you want to set a default background for form elements:
.form-label,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
.form-select {
    color: var(--text-color);
    font-weight: 500;
    background-color: var(--background-darker);
}
*/

/* Unified hover/focus state for input and select elements */
input:hover,
input[type="text"]:hover,
input[type="email"]:hover,
input[type="password"]:hover,
input[type="number"]:hover,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus {
    outline: none; /* Removes the default outline */
}

/* Placeholder text color */
input::placeholder,
input[type="text"]::placeholder,
input[type="email"]::placeholder,
input[type="password"]::placeholder,
input[type="number"]::placeholder {
    color: var(--placeholder-color);
}

/* Input padding */
.form-control,
.form-select,
input,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"] {
    padding: 0.4em;
}

/* Focus styles */
input:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
.form-select:focus,
.form-control:focus {
    border: 1px solid var(--input-focus-color); /* Use the accent color for focus */
    box-shadow: 0 0 0 0.2rem rgba(155, 36, 43, 0.25); /* Optional: add a shadow with transparency */
}

/* Redefining bg-dark for a slightly darker grey */
.bg-dark {
    background-color: var(--background-darker) !important; /* A bit darker than the page background */
    color: var(--text-color) !important;
    border: 0 !important;
}

/* Style for menu items without the red hover effect */
.list-group-item-action.bg-dark.text-white {
    border-color: var(--border-color); /* Consistent border color */
    border: 0 !important;
}

/* Adjusting the hover state for menu items */
.list-group-item-action.bg-dark.text-white:hover {
    background-color: var(--background-darker) !important; /* Slightly darker on hover */
    color: var(--text-color);
    border-color: var(--border-color);
    border: 0 !important;
}

/* Focus state for menu items */
.list-group-item-action.bg-dark.text-white:focus {
    color: var(--text-color);
    background-color: var(--background-darker) !important;
    border-color: var(--border-color);
    outline: none;
    box-shadow: none;
    border: 0 !important;
}

/* Ensure no borders or outlines for labels */
.form-label {
    border: none;
    outline: none;
}

.clickable {
    cursor: pointer;
}

/* Example for hover highlights on table rows (commented out):
.clickable:hover td,
.clickable:hover th {
    background-color: var(--background-hover) !important;
}
*/

/* Error container for alerts */
#error-container {
    display: none;
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1050; /* Ensuring it's above most elements */
}

#error-container .error-message {
    background-color: var(--accent-color);
    color: white;
    padding: 0.5rem 0.5rem 0 0 !important;
    margin: 0 !important;
    height: 3em;
    border-bottom: 2px solid var(--accent-hover);
    text-align: center;
    font-weight: bold;
    font-size: 0.9rem;
    transition: opacity 0.5s ease-out; /* Transition for fade out */
    opacity: 1; /* Start fully visible */
    cursor: pointer;
}

.fade-out {
    opacity: 0 !important; /* Fade to invisible */
}

.logo {
    max-width: 100%;
    height: auto;
}

/* Table action buttons */
.table-action-button {
    color: var(--text-color);
    background-color: var(--background-light-dark);
    border: 1px solid var(--border-color);
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    margin-right: 0.2rem;
    transition: background-color 0.3s, color 0.3s;
    cursor: pointer;
}

.table-action-button:hover,
.table-action-button:focus {
    background-color: var(--background-hover);
    color: var(--accent-color);
    border-color: var(--accent-color);
}

/* For the last button in the cell to avoid extra spacing */
.table-action-button:last-child {
    margin-right: 0;
}

/* Text and loader containers */
.text-container {
    padding: 1em;
    margin: 0.5em;
}

.loader-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: auto;
}

.loader {
    border: 10px solid var(--background-hover); /* Light grey ring */
    border-top: 10px solid var(--accent-color); /* Accent color on top */
    border-radius: 70%;
    width: 100px;
    height: 100px;
    animation: spin 2s linear infinite;
    margin: 3em;
}

.timer {
    position: absolute;
    font-size: 20px;
    font-family: Arial, sans-serif;
    text-align: center;
    line-height: 100px; /* Aligns text vertically */
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.scroll-indicator {
    opacity: 0.8;
    transition: opacity 0.3s;
}

/* Example table styling */
.custodian-table, .payload-table {
    width: 100%;
    table-layout: auto;
    background-color: var(--background-darker);
}

.custodian-table th:first-child,
.custodian-table td:first-child,
.payload-table th:first-child,
.payload-table td:first-child {
    background-color: var(--background-darker);
    white-space: nowrap;
}

.custodian-table th,
.payload-table th {
    max-width: 140px;
    overflow: hidden;
    background-color: var(--background-darker);
    text-overflow: ellipsis;
}

.custodian-table td,
.payload-table td {
    max-width: 140px;
    overflow: hidden;
    background-color: var(--background-darker);
    text-overflow: ellipsis;
    border-color: var(--background-darker);
}

.payload-table, .payload-table th, .payload-table td {
    border: none; /* Removes all borders */
}

/* Another example for a table with fixed layout columns */
.custodian-table {
    table-layout: fixed;
}

.custodian-table .col1 {
    width: 20%;
}

.custodian-table .col2 {
    width: 40%;
}

.custodian-table .col3 {
    width: 40%;
}

.custodian-table, .custodian-table th, .custodian-table td {
    border: none; /* Removes all borders */
}

.custodian-table th, .custodian-table td {
    text-align: left;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* Editable alias column */
.editable-alias input {
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    border: 1px solid #ccc;
    padding: 0 4px;
    margin: 0;
}

.editable-alias .edit-container {
    display: flex;
    gap: 4px;
    width: 100%;
    height: 1.4em;
    align-items: center;
}

.editable-alias input.alias-input {
    flex-grow: 1;
    border: 1px solid var(--border-color);
    background-color: var(--background-dark);
    color: var(--text-color);
    border-radius: 0.25rem;
    outline: none;
    margin: 0;
}

.editable-alias .confirm-edit {
    cursor: pointer;
    background-color: var(--accent-color);
    color: var(--text-color);
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    margin: 0;
}

.editable-alias .confirm-edit:hover {
    background-color: var(--accent-hover);
}

.editable-alias input.alias-input:focus {
    border-color: var(--input-focus-color);
    box-shadow: 0 0 0 0.2rem rgba(155, 36, 43, 0.25);
}

.editable-alias:hover {
    background-color: var(--background-hover);
    cursor: pointer;
}

/* Example user/group table styling */
.user-table,
.group-table {
    width: 100%;
    table-layout: fixed;
}

.user-table td div:hover,
.group-table td div:hover {
    cursor: pointer;
    background-color: var(--background-hover);
}

.user-table td div,
.group-table td div {
    display: inline;
}

.user-table .col1,
.group-table .col1 {
    width: 20%;
}

.user-table .col2,
.group-table .col2 {
    width: 40%;
}

.user-table .col3 {
    width: 40%;
}

.group-table .col1 {
    width: 60%;
}

.group-table .col2 {
    width: 40%;
}

.user-table,
.user-table th,
.user-table td,
.group-table,
.group-table th,
.group-table td {
    border: none;
    background-color: var(--background-darker);
}

/* Modal styling */
.modal {
    display: none;
    position: fixed;
    z-index: 1;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.4);
}

.modal-content {
    background-color: var(--background-dark);
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
}

.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

/* Session and API Key tables */
.session-time {
    width: 30%;
}

.session-ip {
    width: 20%;
}

.session-user {
    width: 50%;
}

.api-key-time {
    width: 20%;
}

.api-key-partial {
    width: 10%;
}

.api-key-comment {
    width: 30%;
}

.api-key-actions {
    width: 40%;
}

.api-key-table {
    width: 100%;
    table-layout: fixed;
}

.api-key-table td div {
    display: inline;
}

.api-key-table td div:hover {
    cursor: pointer;
    background-color: var(--background-hover);
}

.api-key-table,
.api-key-table th,
.api-key-table td {
    border: none;
    background-color: var(--background-darker);
}

#engagement-message div {
    display: flex;
    gap: 10px;
}

/* Agent row styling and hover effect */
.agent-row {
    margin-left: 1rem;
    padding: 0.5rem;
}

.agent-row:hover {
    background-color: var(--background-hover);
    cursor: pointer;
}

.agent-process {
    margin-top: 0.25rem;
    font-size: 0.9rem;
    color: var(--text-color);
}

/* Disabled options in select elements */
select option:disabled {
    color: var(--accent-color) !important;
    font-style: italic;
    text-decoration: line-through;
    opacity: 0.7;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    font-size: 0.75rem;
    border-radius: 0.25rem;
    margin-left: 0.5rem;
}

.badge-green {
    background-color: #28a745;
    color: #fff;
}

.badge-orange {
    background-color: orange;
    color: #000;
}

.badge-red {
    background-color: #dc3545;
    color: #fff;
}

/* Dark table variant */
.table-dark-dark,
.table-dark-dark th,
.table-dark-dark td {
    background-color: var(--background-darker) !important;
    color: var(--text-color) !important;
    border-color: var(--border-color) !important;
}

/* Hover state for dark table variant */
.table-hover.table-dark-dark tbody tr:hover {
    background-color: var(--background-hover) !important;
}

/* Dark card variant */
.card.bg-dark-dark {
    background-color: var(--background-darker) !important;
    color: var(--text-color) !important;
    border: 0 !important;
}

/* ============================= */
/*       Progress Bar Styling    */
/* ============================= */

/* The container of the progress bar */
.progress {
    background-color: var(--background-light-dark) !important;
    border-radius: 0.25rem;
    height: 1rem; /* Default height can be adjusted */
    overflow: hidden;
}

/* The bar itself */
.progress-bar {
    background-color: var(--accent-color) !important;
    color: var(--text-color);
    transition: width 0.6s ease;
}

/* Striped progress bar */
.progress-bar-striped, .progress-bar-animated {
    background-image: linear-gradient(
            45deg,
            rgba(155, 36, 43, 0.25) 25%,
            transparent 25%,
            transparent 50%,
            rgba(155, 36, 43, 0.25) 50%,
            rgba(155, 36, 43, 0.25) 75%,
            transparent 75%,
            transparent
    ) !important;
    background-size: 1rem 1rem;
}

/* System Messages Styles */
.system-messages {
    margin-top: 15px;
}

.system-message {
    background-color: var(--background-darker);
    border-left: 4px solid var(--accent-color);
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 4px;
}

.message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 0.9em;
    color: #aaa;
}

.message-date {
    font-style: italic;
}

.message-component {
    font-weight: bold;
    color: var(--accent-color);
}

.message-title {
    font-size: 1.2em;
    margin-bottom: 10px;
    color: var(--text-color);
}

.message-content {
    white-space: pre-line;
    color: var(--text-color);
}

/* Info Bar Container and System Messages */
.info-bar-container {
    display: flex;
    align-items: center;
}

.user-info {
    display: inline-block;
}

.version-info {
    display: inline-block;
    margin-left: 0.8em;
}

.system-messages-container {
    display: inline-block;
    margin-left: 0.8em;
}

.info-bar-separator {
    display: inline-block;
    margin-left: 0.8em;
}

/* System Messages Indicator */
.system-messages-indicator {
    color: var(--text-color);
    text-decoration: none;
    padding: 0.2rem 0.5rem;
    border-radius: 0.25rem;
    transition: background-color 0.3s;
}

.system-messages-indicator:hover {
    background-color: var(--background-hover);
    color: var(--text-color);
    text-decoration: none;
}
