body {
    margin: 0;
    font-family: 'Roboto', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
}

.container {
    display: flex;
    height: 100vh;
}

.sidebar {
    width: 15rem;
    min-width: 15rem;
    background-color: var(--bg-color-box);
    box-shadow: 0 0 10px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    overflow-y: auto;
    overflow-x: hidden;
    border-top-right-radius: 10px;
    border-bottom-right-radius: 10px;
}

.sidebar-header {
    display: flex;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--accent-color);
    color: #ffffff;
}

.sidebar-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-color);
}

.sidebar-header a:hover {
    text-decoration: none;
}

ul {
    list-style-type: none;
}

.nav-menu {
    flex-grow: 1;
}

.nav-menu ul {
    padding: 0;
    margin: 0;
}

.nav-menu li a:hover,
.nav-menu li.active a {
    text-decoration: none;
    background-color: var(--bg-color-darker);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.nav-menu a {
    text-decoration: none;
    color: var(--text-color);
    display: flex;
    align-items: center;
    padding: 0.5rem;
    margin: 0.5rem;
    border-radius: 10px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.nav-icon {
    font-size: 1.5rem;
}

.nav-text {
    margin-left: 1rem;
    font-size: 1rem;
}

.sidebar .bottom {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
}

.main-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background-color: transparent;
    overflow-y: auto;
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    height: 3rem;
    background-color: transparent;
    color: var(--text-color);
    width: -webkit-fill-available;
}

.main-header h2 {
    margin: 0;
}

.user-icon {
    font-size: 1.5rem;
}

.content {
    padding-inline: 1rem;
    padding-bottom: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: space-between;
    align-items: flex-start;
}

.content:has(.content-card.dashboard) {
    align-items: unset;
}

.content-box {
    background-color: var(--bg-color-box);
    border-radius: 10px;
    padding: 1rem;
    box-shadow: 0 0 10px 6px rgba(0, 0, 0, 0.1);
    flex: 1 1 calc(33.333% - 2rem);
    overflow-x: auto;
}

.content-box .info {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.content-card {
    background-color: var(--bg-color-box);
    border-radius: 10px;
    padding: 1rem;
    box-shadow: 0 0 10px 6px rgba(0, 0, 0, 0.1);
    flex: 1 1 calc(33.333% - 2rem);
    min-width: 300px;
    box-sizing: border-box;
    word-wrap: break-word;
}

.content-card.dashboard {
    flex: 1 1 calc(50% - 2rem);
}

.content-card.single {
    flex: 1 1 calc(100% - 2rem);
}

.content-card h2 {
    margin-top: 0;
}

.breadcrumbs {
    font-size: 0.9rem;
    overflow-wrap: anywhere;
}

.breadcrumbs span:last-child {
    display: inline-block;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    vertical-align: middle;
}

.breadcrumbs a:hover {
    text-decoration: underline;
}

.search-box {
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-actions {
    display: inline-flex;
    gap: 2rem;
}

.search-box input {
    width: unset;
}

input,
select,
button.full {
    width: 100%;
    padding: 10px;
    height: 5vh;
    border: 1px solid var(--accent-color);
    border-radius: 10px;
    box-sizing: border-box;
    background: var(--bg-color);
    color: var(--text-color);
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
}

input[type="color"] {
    border: 1px solid var(--accent-color);
    border-radius: 10px;
    padding: 8px;
    width: 100%;
    cursor: pointer;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
    border-radius: 6px;
}

input[type="color"]::-webkit-color-swatch {
    border-radius: 4px;
    border: none;
}

.form-validate-error {
    background-color: var(--error-bg);
    color: var(--error-text);
    padding: 1rem;
    display: flex;
    justify-content: center;
    border-radius: 10px;
    margin-bottom: 10px;
}

.content-box h2 {
    margin: 0;
}

.log-box {
    padding: 1rem;
    background-color: black;
    border-radius: 10px;
}

#log-textarea {
    width: 100%;
    height: 100%;
    min-height: 75vh;
    line-height: 2;
    background-color: black;
    color: white;
    border-radius: 10px;
    border: none;
    padding: 1rem;
    font-family: 'Roboto Mono', monospace;
    font-size: medium;
    resize: none;
    box-sizing: border-box;
    text-wrap: nowrap;
    cursor: auto;
}

textarea::-webkit-scrollbar-track {
    background-color: black;
  }

#log-textarea.constrained {
    text-wrap: unset;
}

#log-textarea:focus {
    outline: none !important;
}

/* General table styles */
table {
    width: -webkit-fill-available; /* Remove the fixed width */
    border-collapse: collapse;
    margin: 0 auto; /* Center the table */
    table-layout: fixed;
}

thead {
    color: var(--bg-color);
    position: sticky;
    top: 0;
    z-index: 1;
}

thead th:first-child {
    border-top-left-radius: 10px;
}

thead th:last-child {
    border-top-right-radius: 10px;
}

form th, 
form td {
    border-bottom: none;
    word-wrap: break-word;
}

tr {
    border-bottom: 1px solid var(--accent-color);
}

tr:last-child {
    border-bottom: none;
}

tbody tr:only-child {
    border-bottom: 1px solid var(--accent-color);
}

th, td {
    padding: 0.75rem;
    text-align: left;
    white-space: nowrap;
}

table.add-role {
    table-layout: auto;
}

table.add-role tr td:last-child {
    text-align: right;
}

th[data-sort]:after {
    content: "";
    display: inline-block;
    width: 1em;
    text-align: right; 
}

th[data-sort].ascending:after {
    content: " ▲";
}

th[data-sort].descending:after {
    content: " ▼";
}

th {
    background-color: var(--accent-color);
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

td {
    white-space: normal;
    word-wrap: normal;
}

form table tr {
    border-bottom: none !important;
}

.content-card .table-box {
    max-height: 40vh;
    overflow-x: hidden;
}

.table-box {
    max-height: calc(100vh - 200px);;
    overflow-y: auto;
}

.table-box th, .table-box td {
    white-space: normal;
    word-wrap: break-word;
}

.table-box th {
    max-width: none;
    word-wrap: unset;
}

.add-role-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    padding-inline: 1rem;
    background-color: var(--accent-color);
    border-top-right-radius: 10px;
    border-top-left-radius: 10px;
    color: white;
}

.table-box.role {
    overflow-x: auto;
    width: 100%;
}

.menu-toggle {
    font-size: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-color);
    transition: transform 0.3s ease;
}

.sidebar.closed {
    width: 66px;
    min-width: 66px;
}

.sidebar.closed .bottom{
    visibility: hidden;
}

.sidebar-title {
    margin-left: 1rem;
}

.sidebar .menu-toggle svg *,
.sidebar.closed .menu-toggle svg * {
    transition: all 0.3s ease;
}

.sidebar.closed .menu-toggle svg rect:nth-child(1) {
    width: 8px;
}
.sidebar.closed .menu-toggle svg rect:nth-child(2) {
    width: 12px;
}

a {
    text-decoration: none;
    color: var(--accent-color);
    cursor: pointer;
}

a:hover {
    text-decoration: underline;
}

.icon-button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    padding: 0 5px;
}

.usage-row {
    display: flex;
}

.cpu-usage, .ram-usage, .load-average, .io-operations {
    flex: 1;
    padding: 0 1rem;
}

.stat-table {
    border-collapse: collapse;
    table-layout: unset;
}

.stat-table td {
    width: 50%;
}

.progress-bar {
    position: relative;
    height: 20px;
    background-color: var(--bg-color);
    border: 1px solid var(--accent-color);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress {
    height: 100%;
    background-color: var(--accent-color);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.usage-text {
    text-align: center;
    font-size: 1rem;
    color: var(--text-color);
}

.dashboard-button {
    background-color: var(--bg-color);
    color: var(--text-color);
    border: 1px solid grey;
    border-radius: 10px;
    padding: 2rem;
    font-size: 1.2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    flex: 1 1;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.dashboard-button:hover {
    border: 1px solid var(--accent-color);
    color: var(--text-color);
    text-decoration: none;
}

.buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--accent-color);
}

.loading-spinner.hidden *{
    opacity: 0;
    transition: all 0.3s ease;
}

/* Info page */

.title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    overflow-wrap: anywhere;
}

.page-title {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.5rem;
}

hr {
    border: 0;
    border-top: 1px solid var(--accent-color);
}

.user-details h2{
    margin-bottom: 0;
}

.user-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.user-panel {
    width: 0;
    height: 100%;
    border-radius: 10px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    overflow: hidden;
    display: flex;
    justify-content: space-between;
    background-color: var(--bg-color-box);
    align-items: center;
}

.user-panel > * {
    text-overflow: ellipsis;
    overflow: hidden;
    max-width: 80px;
}

.user-panel #logout {
    font-size: 0;
}

.user-panel.open {
    width: 150px;
    padding: 0.5rem;
    box-shadow: 0 0 10px 6px rgba(0, 0, 0, 0.1);
}

a#logout {
    border-radius: 5px;
}

a#logout:hover {
    text-decoration: none;
    background-color: var(--bg-color-darker);
    transition: all 0.3s ease;
}

.flash-messages {
    position: fixed;
    bottom: 5vh;
    right: 100px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 20vw;
}

.flash-message {
    background-color: var(--accent-color);
    color: var(--bg-color);
    padding: 1rem;
    border-radius: 10px;
    font-size: large;
    box-shadow: 0 0 10px 6px rgba(0, 0, 0, 0.1);
    opacity: 0;
    animation: slideUp 0.5s cubic-bezier(0.25, 0.8, 0.25, 1) forwards, fadeOut 0.5s 3.5s ease-in-out forwards;
    text-align: center;
}

.flash-message.info {
    background-color: var(--info-bg);
    color: var(--info-text);
}

.flash-message.success {
    background-color: var(--success-bg);
    color: var(--success-text);
}

.flash-message.error {
    background-color: var(--error-bg);
    color: var(--error-text);
}

input[type="text"][disabled] {
    border: 1px solid grey;
    cursor: not-allowed;
}

input[type="submit"][disabled],
button[disabled] {
    border: 1px solid grey;
    cursor: not-allowed;
    background-color: grey;
}

input[type="checkbox"] {
    display: none;
}

input[type="checkbox"] + label {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
    background-color: var(--bg-color);
    border: 1px solid var(--accent-color);
    border-radius: 20px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    vertical-align: middle;
    cursor: pointer;
}

input[type="checkbox"] + label:before {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    left: 2px;
    bottom: 2px;
    background-color: var(--text-color);
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

input[type="checkbox"]:checked + label {
    background-color: var(--accent-color);
}

input[type="checkbox"]:checked + label:before {
    transform: translateX(20px);
    background-color: var(--bg-color);
}

input[type="checkbox"][disabled] + label {
    background-color: #ccc;
    color: #999;
    cursor: not-allowed;
    border: none;
}

input[type="checkbox"][disabled]:checked + label {
    background-color: #bbb;
}

input[type="checkbox"][disabled]:checked + label:before {
    background-color: #999;
    transform: translateX(20px);
}

input[type="checkbox"][disabled] + label:before {
    background-color: #ddd;
}

input[type="submit"],
button.full {
    background: var(--accent-color);
    color: var(--bg-color);
    border: none;
    font-size: medium;
    cursor: pointer;
}

button.full {
    margin-top: 1rem;
}

input[type="submit"]:hover,
button.full:hover {
    background: var(--accent-color-darken);
}

select {
    appearance: none;
    cursor: pointer;
    position: relative;
    display: inline-block;
    padding-right: 2.5em; /* Space for the custom arrows */
    background-image:
        /* Down arrow */
        linear-gradient(45deg, transparent 50%, gray 50%),
        linear-gradient(135deg, gray 50%, transparent 50%),
        /* Up arrow */
        linear-gradient(135deg, transparent 50%, gray 50%),
        linear-gradient(45deg, gray 50%, transparent 50%),
        /* Right border */
        linear-gradient(to right, #ccc, #ccc);
    background-position:
        /* Down arrow */
        calc(100% - 18px) calc(50% + 4px),
        calc(100% - 13px) calc(50% + 4px),
        /* Up arrow */
        calc(100% - 18px) calc(50% - 4px),
        calc(100% - 13px) calc(50% - 4px),
        /* Right border */
        calc(100% - 2.5em) 0.5em;
    background-size:
        5px 5px,
        5px 5px,
        5px 5px,
        5px 5px,
        1px 1.5em;
    background-repeat: no-repeat;
}

select:disabled {
    border: 1px solid var(--bg-color);
    cursor: not-allowed;
}

select:hover {
    background-color: var(--bg-color-box);
}

select option {
    background-color: var(--bg-color);
    color: var(--text-color);
}

.actions.disabled a {
    pointer-events: none;
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.content-card .actions {
    gap: unset;
    flex-direction: column;
    align-items: flex-end;
}

.actions a,
a.action {
    font-size: 0;
    border-radius: 5px;
}

.settings-revert-icon {
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 10px !important;
    height: 5vh;
    aspect-ratio: 1;
}

a span,
a svg {
    padding: 5px;
    flex-shrink: 0;
}

span.delete:hover {
    color: var(--error-bg) !important;
}

.role-badge {
    display: inline-block;
    background-color: var(--accent-color);
    color: var(--bg-color);
    padding: 5px 10px;
    border-radius: 10px;
    font-size: 0.8em;
}

.user-info p {
    font-size: 1.1em;
    align-items: center;
}

.user-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.terminal-wrapper {
    background-color: black;
    padding: 10px;
    border-radius: 10px;
}

#terminal-container {
    min-height: 80vh;
}

.status {
    padding: 5px 10px;
    border-radius: 10px;
}

.status.running {
    background-color: var(--success-bg);
    color: var(--success-text);
}

.status.stopped {
    background-color: var(--error-bg);
    color: var(--error-text)
}

.status.exited {
    background-color: var(--error-bg);
    color: var(--error-text)
}

.status.paused {
    background-color: var(--info-bg);
    color: var(--info-text)
}

.error-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.error-box {
    display: flex;
    align-items: center;
    gap: 1rem;
    height: 10vh;
}

.error-icon {
    font-size: 100px !important;
}

.error-code {
    font-size: 72px;
    font-weight: bold;
    margin: 0;
}

.error-text {
    font-size: x-large;
}

@keyframes slideUp {
    0% {
        transform: translateY(50px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    0% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}


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

@media all and (min-width:0px) and (max-width: 650px) {
    .sidebar {
        width: 100%;
        position: fixed;
        z-index: 2;
        height: -webkit-fill-available;
        backdrop-filter: blur(10px);
        background-color: var(--bg-color-transparent);
    }

    .sidebar.closed {
        background-color: var(--bg-color-box);
        transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    }

    .sidebar + .main-content {
        position: absolute;
        transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
        transform: translateX(0);
        overflow: hidden;
        width: 100vw;
        margin-inline: unset;
    }
    
    .sidebar.closed + .main-content {
        transform: translateX(15vw);
        width: 85vw;
        transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    }

    .flash-messages {
        left: 25vw;
        max-width: unset;
    }

    .nav-menu li, .nav-menu li:hover {
        border: none;
    }

    .actions div {
        gap: unset;
    }

    .search-box input {
        max-width: 50%;
    }

    .content-box form .table-box {
        width: unset;
        min-width: unset;
    }

    a, button {
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    }

    .table-actions {
        gap: unset;
    }

    .breadcrumbs span:last-child {
        max-width: 100px;
    }
}
