/* Essential CSS Variables for the application */
:root {
  /* Color Palette - keeping used colors */
  --primary-50: #f8fafc;
  --primary-100: #f1f5f9;
  --primary-200: #e2e8f0;
  --primary-300: #cbd5e1;
  --primary-400: #94a3b8;
  --primary-500: #64748b;
  --primary-600: #475569;
  --primary-700: #334155;
  --primary-800: #1e293b;
  --primary-900: #0f172a;
  
  /* Neutral Colors */
  --neutral-50: #fafafa;
  --neutral-100: #f5f5f5;
  --neutral-200: #e5e5e5;
  --neutral-300: #d4d4d4;
  --neutral-400: #a3a3a3;
  --neutral-500: #737373;
  --neutral-600: #525252;
  --neutral-700: #404040;
  --neutral-800: #262626;
  --neutral-900: #171717;
  
  /* Semantic Colors */
  --success-500: #22c55e;
  --success-600: #16a34a;
  --error-50: #fef2f2;
  --error-500: #ef4444;
  --error-600: #dc2626;
  --warning-50: #fffbeb;
  --warning-500: #f59e0b;
  --info-500: #3b82f6;
  --info-600: #2563eb;
  
  /* Layout */
  --header-height: 80px;
  
  /* Spacing Scale - commonly used values */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  
  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  
  /* Typography */
  --font-family-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  
  /* Transitions */
  --transition-fast: 0.15s ease-in-out;
  --transition-normal: 0.2s ease-in-out;
}

/* Import Inter font */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* Base Typography */
html, body {
  font-family: var(--font-family-sans);
  font-size: var(--font-size-base);
  line-height: 1.5;
  color: var(--neutral-900);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Layout Components - Used in MainLayout and ApplicationHeader */
.page {
  height: 100%;
  font-family: var(--font-family-sans);
}

.modern-header {
  height: var(--header-height);
  background: white;
  border-bottom: 1px solid var(--neutral-200);
  box-shadow: var(--shadow-sm);
  position: relative;
  z-index: 100;
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 var(--space-6);
}

.header-left {
  display: flex;
  align-items: center;
  min-width: 0;
  flex-shrink: 0;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.menu-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--neutral-600);
  flex-shrink: 0;
}

.menu-toggle-btn:hover {
  background-color: var(--neutral-100);
  color: var(--neutral-900);
  transform: translateY(-1px);
}

.menu-toggle-btn:active {
  transform: translateY(0);
}

.brand-info {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.brand-name {
  font-size: var(--font-size-lg);
  font-weight: 600;
  color: var(--neutral-900);
  white-space: nowrap;
}

.header-center {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 0 var(--space-4);
  min-width: 0;
}

.admin-selector-container {
  max-width: 320px;
  width: 100%;
}

.admin-selector-wrapper {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-6);
  background: var(--primary-50);
  border: 1px solid var(--primary-200);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-fast);
  min-height: 56px;
}

.admin-selector-wrapper:hover {
  background: var(--primary-100);
  border-color: var(--primary-300);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.admin-selector-icon {
  color: var(--primary-600);
  font-size: 1.25rem;
  flex-shrink: 0;
}

.admin-selector-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.admin-selector-label {
  font-size: var(--font-size-sm);
  color: var(--primary-600);
  font-weight: 500;
  margin-bottom: 2px;
  line-height: 1.2;
}

.header-right {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.user-badge-container {
  position: relative;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  background: transparent;
  border: 1px solid var(--neutral-200);
  border-radius: var(--radius-2xl);
  cursor: pointer;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
  min-height: 56px;
}

.user-badge:hover {
  background-color: var(--neutral-50);
  border-color: var(--neutral-300);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.user-badge:active {
  transform: translateY(0);
}

.user-avatar {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: var(--font-size-sm);
  box-shadow: 0 2px 8px rgba(71, 85, 105, 0.3);
  flex-shrink: 0;
}

.user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}

.user-name {
  font-weight: 500;
  color: var(--neutral-900);
  font-size: var(--font-size-sm);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

.user-admin {
  font-size: 0.75rem;
  color: var(--neutral-500);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

.dropdown-arrow {
  color: var(--neutral-400);
  font-size: 0.75rem;
  transition: transform var(--transition-fast);
  flex-shrink: 0;
}

.user-badge:hover .dropdown-arrow {
  color: var(--neutral-600);
  transform: translateY(1px);
}

/* User Dropdown */
.user-dropdown {
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--neutral-200);
  overflow: hidden;
}

.user-dropdown-content {
  padding: var(--space-4);
}

.user-profile-section {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--neutral-200);
  margin-bottom: var(--space-4);
}

.profile-avatar {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(71, 85, 105, 0.3);
}

.profile-info h3 {
  margin: 0 0 4px 0;
  font-size: var(--font-size-base);
  font-weight: 600;
}

.profile-info p {
  margin: 0;
  font-size: var(--font-size-sm);
  color: var(--neutral-500);
}

.quick-actions {
  margin-bottom: var(--space-4);
}

.action-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  color: var(--neutral-700);
  cursor: pointer;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.action-item:hover {
  background-color: var(--neutral-100);
  color: var(--neutral-900);
  transform: translateX(2px);
}

.logout-section {
  border-top: 1px solid var(--neutral-200);
  padding-top: var(--space-4);
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--error-500);
  text-decoration: none;
  padding: var(--space-2) var(--space-3);
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.logout-btn:hover {
  color: var(--error-600);
  background-color: var(--error-50);
  transform: translateX(2px);
}

/* Navigation Sidebar */
#sidebar {
  background: white;
  height: 100%;
  border-right: 1px solid var(--neutral-200);
}

.nav-container {
  padding: var(--space-4);
}

.modern-treeview {
  border: none;
}

.nav-item {
  border-radius: var(--radius-md);
  transition: background-color var(--transition-fast);
}

.nav-item:hover {
  background-color: var(--neutral-50);
}

.nav-icon {
  width: 16px;
  height: 16px;
  margin-right: var(--space-2);
  color: var(--neutral-600);
}

.parent-item {
  font-weight: 500;
}

.child-item {
  margin-left: var(--space-6);
  font-size: var(--font-size-sm);
}

.main-content-area {
  padding: var(--space-6);
  background: var(--neutral-50);
  min-height: 100%;
}

/* Responsive Design for Header */
@media (max-width: 768px) {
  .header-container {
    padding: 0 var(--space-4);
  }
  
  .admin-selector-wrapper {
    padding: var(--space-3) var(--space-4);
    min-height: 48px;
  }
  
  .user-badge {
    padding: var(--space-2) var(--space-3);
    min-height: 48px;
  }
  
  .user-avatar {
    width: 36px;
    height: 36px;
  }
  
  .user-name, .user-admin {
    max-width: 100px;
  }
  
  .brand-name {
    font-size: var(--font-size-base);
  }
}

@media (max-width: 640px) {
  .header-center {
    padding: 0 var(--space-2);
  }
  
  .admin-selector-container {
    max-width: 240px;
  }
  
  .admin-selector-wrapper {
    padding: var(--space-2) var(--space-3);
  }
}

/* Form Validation - used by Blazor components */
.valid.modified:not([type=checkbox]) {
  outline: 1px solid var(--success-600);
}

.invalid {
  outline: 1px solid var(--error-500);
}

.validation-message {
  color: var(--error-500);
}

/* Error UI */
#blazor-error-ui {
  background: var(--warning-50);
  bottom: 0;
  box-shadow: var(--shadow-md);
  display: none;
  left: 0;
  padding: 0.6rem 1.25rem 0.7rem 1.25rem;
  position: fixed;
  width: 100%;
  z-index: 1000;
}

#blazor-error-ui .dismiss {
  cursor: pointer;
  position: absolute;
  right: 0.75rem;
  top: 0.5rem;
}

.blazor-error-boundary {
  background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD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5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, var(--error-500);
  padding: 1rem 1rem 1rem 3.7rem;
  color: white;
}

.blazor-error-boundary::after {
  content: "An error has occurred."
}

/* Loading Progress - used by Blazor */
.loading-progress {
  position: absolute;
  display: block;
  width: 8rem;
  height: 8rem;
  inset: 20vh 0 auto 0;
  margin: 0 auto;
}

.loading-progress circle {
  fill: none;
  stroke: var(--neutral-200);
  stroke-width: 0.6rem;
  transform-origin: 50% 50%;
  transform: rotate(-90deg);
}

.loading-progress circle:last-child {
  stroke: var(--primary-600);
  stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
  transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
  position: absolute;
  text-align: center;
  font-weight: bold;
  inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

.loading-progress-text:after {
  content: var(--blazor-load-percentage-text, "Loading");
}

/* Code styling */
code {
  color: var(--primary-700);
}

/* Form controls - DevExpress compatibility */
.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
  color: var(--neutral-500);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
  text-align: start;
}

.ai-chat-custom {
    height: 100%;
}

.ai-reports-tabs {
    height: 100%;
    display: flex;
    flex-direction: column;
}

#ai-report .dxbl-tabs-content-panel {
    height: calc(100% - 65px);
    display: flex;
    flex-direction: column;
    min-height: 0;
}

#ai-report .dxbl-tabs-content {
    flex: 1 1 auto;
    min-height: 0;
}

.ai-report-tab {
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.ai-report-approval-requests {
    height: 100%;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 15px 8px;
    box-sizing: border-box;
}

.ai-report-approval-grid {
    flex: 1 1 auto;
    min-height: 0;
}
