:root {
    /* Primary colors */
    --primary-color: #203864;
    --primary-light: #3498db;
    --primary-dark: #1a252f;

    /* Accent colors */
    --accent-color: #3498db;
    --accent-light: #5dade2;
    --accent-dark: #2980b9;

    /* Grays */
    --gray-lightest: #f8f9fa;
    --gray-light: #e9ecef;
    --gray-medium: #ced4da;
    --gray-dark: #6c757d;
    --gray-darkest: #343a40;

    /* Status colors */
    --success-color: #2ecc71;
    --warning-color: #f39c12;
    --error-color: #e74c3c;
    --info-color: #3498db;

    /* Interface elements */
    --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition-speed: 0.3s;
}

html,
body {
    font-family: 'Roboto', 'Segoe UI', sans-serif;
    margin: 0;
    padding: 0;
    height: 100%;
    color: var(--gray-darkest);
}

/* Improved error UI */
#blazor-error-ui {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2147483647; /* keep above dialogs/toasts */
  display: none;       /* Blazor toggles it when needed */
  padding: max(12px, env(safe-area-inset-bottom)) 12px 12px;
  background: rgba(20, 20, 20, 0.98);
  color: #fff;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 -8px 20px rgba(0, 0, 0, 0.25);
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 1rem;
    top: 0.75rem;
    opacity: 0.7;
    transition: opacity var(--transition-speed);
}

#blazor-error-ui .dismiss:hover {
    opacity: 1;
}

/* Loading spinner styling */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
}

.loading-progress {
    width: 60px;
    height: 60px;
    border: 3px solid var(--gray-light);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

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

    100% {
        transform: rotate(360deg);
    }
}

/* Dialog styling */
.dialog-backdrop {
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
    background-color: rgba(0, 0, 0, 0.5) !important;
    transition: all var(--transition-speed);
}

.mud-dialog {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25) !important;
}

.mud-dialog-title {
    background-color: var(--primary-color);
    color: white;
}

.primary-text-color {
    color: white;
}

/* User info card styling */
.user-info-card {
    border: 1px solid var(--gray-light);
    border-radius: 8px;
    transition: all var(--transition-speed);
}

.user-info-card:hover {
    box-shadow: var(--card-shadow);
}

/* Table improvements */
.mud-table {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    background-color: white;
}

.mud-table-container {
    border-radius: 8px;
}

.mud-table-head {
    background-color: var(--primary-color);
}

.mud-table-head .mud-table-cell {
    color: white !important;
    font-weight: 500;
    background-color: var(--primary-color) !important;
}

/* Fix for table sort label text visibility on hover */
.mud-table-head .mud-table-sort-label:hover {
    color: white !important;
}

.mud-table-head .mud-table-sort-label:hover .mud-table-sort-label-icon {
    color: white !important;
}

.mud-table-head .mud-table-sort-label div {
    color: white !important;
}

.mud-table-head .mud-table-sort-label:hover div {
    color: white !important;
}

.mud-table-head .mud-table-sort-label .mud-icon-root {
    color: white !important;
}

.mud-table-row {
    transition: background-color var(--transition-speed);
}

.mud-table-row:hover {
    background-color: var(--gray-lightest);
}

/* Buttons with hover effects */
.mud-button {
    transition: transform var(--transition-speed), box-shadow var(--transition-speed);
}

.mud-button-filled:hover,
.mud-button-outlined:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Custom drawer header styling */
.mud-drawer-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 8px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    color: white;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Smooth transitions for drawer elements */
.mud-drawer,
.mud-drawer-content {
    transition: width 0.3s, min-width 0.3s;
}

/* Avatar styling */
.mud-avatar {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

/* Nav item styling */
.mud-nav-link {
    border-radius: 4px;
    margin-bottom: 4px;
}

.mud-nav-link.active {
    font-weight: 500;
}

/* Table row hover styling */
.mud-table-row:hover .mud-table-cell {
    background-color: rgba(0, 0, 0, 0.02);
}

/* Card styling */
.mud-card {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Paper and card enhancements */
.mud-paper,
.mud-card {
    transition: all var(--transition-speed);
}

.mud-paper:hover,
.mud-card:hover {
    box-shadow: var(--card-shadow);
}

/* Status chip styling */
.mud-chip-color-success {
    background-color: rgba(46, 204, 113, 0.1) !important;
    color: var(--success-color) !important;
    border: 1px solid var(--success-color) !important;
}

.mud-chip-color-error {
    background-color: rgba(231, 76, 60, 0.1) !important;
    color: var(--error-color) !important;
    border: 1px solid var(--error-color) !important;
}

/* Override MudBlazor's default layout height to prevent unwanted scrollbars */
.mud-layout {
    height: unset !important;
    min-height: unset !important;
}

/* Drag and drop styles for form editing */
.mud-dragger {
    cursor: grab;
}

.mud-dragger:active {
    cursor: grabbing;
}

/* Prevent page dragging during drag operations */
.mud-drop-container {
    touch-action: none;
    position: relative;
}

/* Style the item when being dragged */
.mud-drop-item.mud-drop-item-dragged {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    z-index: 100;
}

/* Show visual cue for where item will be dropped */
.mud-drop-zone-active::before {
    content: '';
    display: block;
    height: 2px;
    background-color: var(--primary-color);
    margin: 4px 0;
}