* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

html {
    color-scheme: dark;
    font-size: 16px;
}

body {
    font-family: sans-serif;
    color: var(--secondary);
    background: var(--background);
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 3rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1000;
    overflow: hidden;
    background: var(--secondary-background);
}

.sidebar:hover {
    width: 15rem;
}

.sidebar-header {
    padding: 1.25rem 0.938rem 1.25rem 0.563rem;
    border-bottom: 1px solid darkgrey;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 4.375rem;
}

.sidebar-header i {
    font-size: 1.5rem;
    color: var(--secondary);
    min-width: 1.875rem;
    text-align: center;
}

.sidebar-header span {
    color: #fff;
    font-size: 1.125rem;
    font-weight: 600;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.sidebar:hover .sidebar-header span {
    opacity: 1;
}

.nav-items {
    flex: 1;
    padding: 0.625rem 0;
    display: flex;
    flex-direction: column;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.875rem 0.75rem 0.875rem 0.375rem;
    gap: 0.75rem;
    color: var(--secondary);
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    border-left: 0.188rem solid transparent;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.08);
    color: #fff;
    border-left-color: var(--secondary-highlight);
}

.nav-item.active {
    background-color: rgba(79, 195, 247, 0.15);
    color: var(--secondary-highlight);
    border-left-color: var(--secondary-highlight);
}


.nav-item i {
    font-size: 1.125rem;
    min-width: 1.875rem;
    text-align: center;
}

.nav-item span {
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.sidebar:hover .nav-item span {
    opacity: 1;
}

.nav-item-labels {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.nav-item-labels .nav-label2 {
    font-size: 0.75em;
    color: var(--secondary);
}

.nav-bottom {
    margin-top: auto;
    padding: 0.625rem 0;
}

/* Disable sidebar expansion on small screens */
@media (max-width: 48rem) {
    .sidebar:hover {
        width: 3rem;
    }

    .sidebar:hover .sidebar-header span,
    .sidebar:hover .nav-item span {
        opacity: 0;
    }
}

/* Main content */
.main-content {
    flex: 1;
    margin-left: 3rem;
    transition: margin-left 0.3s ease;
    display: flex;
    flex-direction: column;
}

.content-header {
    padding: 0.938rem 1.563rem;
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.content-header h1 {
    font-size: 1.25rem;
    color: var(--highlight);
    font-weight: 500;
}

.content-header i {
    color: var(--secondary);
}

.content-frame {
    flex: 1;
    border: none;
}

/* Center box */
.center-box {
    min-width: 15rem;
    width: 60%;
    align-content: center;
    margin-left: 15rem;
    margin-right: auto;
}

@media (max-width: 48rem) {
    .center-box {
        margin-left: 3rem;
    }
}

/* Tabs */
.tabs {
    display: flex;
}

.tab {
    flex: 30%;
    padding: 0.625rem 1.25rem;
    cursor: pointer;
    border: none;
    background: none;
    font-size: 1rem;
    color: var(--secondary);
    border-bottom: 0.2em solid var(--secondary-background);
    transition: all 0.2s ease;
    margin-top: 1em;
    margin-bottom: 0.5em;
}

.tab:hover {
    border-bottom-color: var(--highlight);
}

.tab.active {
    border-bottom-color: var(--highlight);
    font-weight: bold;
    color: var(--highlight);
}

/* Content panels */
#content {
    min-height: 12.5rem;
    display: flex;
    height: 40vh;
}

#subcontent {
    flex: 80%;
    padding: 1em;
    overflow: auto;
    scrollbar-color: var(--highlight) var(--secondary-background);
    scrollbar-width: thin;
}

.detail-list-panel {
    display: flex;
    margin-top: 1em;
}

#nav-pane {
    flex: 30%;
    direction: rtl;
    padding: 0;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-color: var(--highlight) var(--secondary);
    scrollbar-width: thin;
}

.list-pane {
    flex: 100%;
    display: flex;
    flex-direction: column;
}

.list-pane-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
}

.list-pane-header-entry {
    flex: 100%;
    display: flex;
    flex-direction: column;
}

/* Detail items */
.detail-data-item {
    display: flex;
    align-items: baseline;
    gap: 1rem;
}

.detail-data-item div:first-child {
    flex: 20%;
}

.detail-data-item div:nth-child(2) {
    flex: 90%;
}

/* List items */
ul li {
    list-style-type: none;
}

li.detail-link {
    display: flex;
    align-items: center;
    gap: 0.5em;
    color: var(--secondary);
    text-decoration: none;
    padding: 1em;
    margin: 1em;
    border-right: 0.1em solid var(--secondary-background);
}

li.detail-link i {
    font-size: 1.25em;
    min-width: 1.5em;
    text-align: center;
}

li.detail-link .detail-link-label {
    white-space: nowrap;
}

.detail-link-content {
    display: flex;
    flex-direction: column;
    gap: 0.25em;
}

.small {
    font-size: 0.85em;
}

.secondary {
    color: var(--secondary);
}

li.detail-link:hover {
    cursor: pointer;
    border-right-color: lightslategrey;
}

li.detail-link.active {
    cursor: default;
    border-right-color: lightslategrey;
    color: var(--highlight);
}


@media (max-width: 48rem) {
    li.detail-link .detail-link-label {
        display: none;
    }
}

/* Header and rows */
header {
    border-top: 0.1em solid var(--secondary-background);
    border-bottom: 0.1em solid var(--secondary-background);
    font-weight: bold;
}

header, .row {
    padding-top: 0.5em;
    padding-bottom: 0.5em;
    display: flex;
}

.col {
    flex: 1 1 0;
    min-width: 0;
    padding: 0 0.5em;
    overflow: hidden;
    text-overflow: ellipsis;
}

.col:not(:last-child) {
    border-right: 1px solid var(--secondary-background);
}

/* Buttons */
button.delete {
    cursor: pointer;
    border: none;
    background: none;
    color: var(--secondary);
    margin: 0;
    padding: 0.5em;
    white-space: nowrap;
}

button.delete i {
    color: var(--danger);
}

button.add {
    cursor: pointer;
    border: none;
    background: none;
    color: var(--secondary);
    margin: 0;
    padding: 0.5em;
    white-space: nowrap;
}

button.add i {
    color: var(--info);
}

button.edit {
    cursor: pointer;
    border: none;
    background: none;
    color: var(--secondary);
    margin: 0;
    padding: 0.5em;
    white-space: nowrap;
}

button.edit i {
    color: var(--info);
}

button.save {
    cursor: pointer;
    border: none;
    background: none;
    color: var(--secondary);
    margin: 0;
    padding: 0.5em;
    white-space: nowrap;
}

button.save i {
    color: var(--info);
}

button.cancel {
    cursor: pointer;
    border: none;
    background: none;
    color: var(--secondary);
    margin: 0;
    padding: 0.5em;
    white-space: nowrap;
}

button.cancel i {
    color: var(--danger);
}

/* Actions column */
.actions-col {
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
}

.actions-col button {
    padding: 0.25em;
}

/* Typography */
h1 {
    color: var(--highlight);
}

a {
    color: var(--highlight);
}

.highlight {
    color: var(--highlight);
}

/* Modal dialog */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-dialog {
    background: var(--background);
    border: 1px solid var(--secondary-background);
    border-radius: 0.5rem;
    padding: 1.5rem;
    min-width: 20rem;
    max-width: 90%;
    animation: fadeIn 0.2s ease-out;
}

.modal-content {
    margin-bottom: 1.5rem;
    color: var(--secondary);
}

.modal-content h3 {
    color: var(--highlight);
    margin-bottom: 0.5rem;
}

.modal-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* Notifications */
.notification {
    position: fixed;
    top: 1rem;
    right: 1rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.25rem;
    z-index: 2000;
    animation: slideIn 0.3s ease-out;
}

.notification.info {
    background: var(--secondary-background);
    border: 1px solid var(--info);
    color: var(--info);
}

.notification.error {
    background: var(--secondary-background);
    border: 1px solid var(--danger);
    color: var(--danger);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(1rem);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Select hint */
.select-hint {
    margin: 1em;
    padding: 1em;
    color: var(--secondary);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-0.5rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* Custom select */
.select-wrapper {
    position: relative;
    display: inline-block;
}

.select-wrapper select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: transparent;
    border: none;
    border-bottom: 0.15em solid var(--secondary);
    color: var(--highlight);
    padding: 0.5rem 0.25rem;
    font-size: 1rem;
    cursor: pointer;
    outline: none;
}

.select-wrapper select:focus {
    border-bottom-color: var(--highlight);
}

.select-wrapper select option {
    background: var(--background);
    color: var(--secondary);
}

/* Input wrapper */
.input-wrapper input {
    background: transparent;
    border: none;
    border-bottom: 0.15em solid var(--secondary);
    color: var(--highlight);
    padding: 0.5rem 0.25rem;
    font-size: 1rem;
    outline: none;
}

.input-wrapper input:focus {
    border-bottom-color: var(--highlight);
}

.input-wrapper input::placeholder {
    color: var(--secondary);
    opacity: 0.6;
}

/* New user form */
.new-user-form {
    padding: 1rem;
    margin: 0.5rem 0;
    border: 1px solid var(--secondary-background);
    border-radius: 0.25rem;
}

.new-user-form .detail-data-item {
    margin-bottom: 1rem;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 1rem;
}

.form-field label {
    color: var(--secondary);
    font-size: 0.875rem;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}

.form-row .form-field {
    margin-bottom: 0;
    flex: 1 1 8rem;
    min-width: 0;
}

.form-row .form-field input {
    width: 100%;
}

.compact-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 100%;
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--secondary);
    cursor: pointer;
}

.checkbox-wrapper input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: var(--highlight);
    cursor: pointer;
}

.form-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-left: auto;
}
