/* ===== MODERN PII-SHIELD DESIGN SYSTEM ===== */

/* CSS Reset & Base */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Modern Color Palette - Updated */
  --primary: #9810fa;
  --primary-hover: #7a0dcc;
  --primary-light: rgba(152, 16, 250, 0.15);
  --secondary: #4c8bca;
  --secondary-hover: #3a6da2;
  --accent: #4c8bca;
  --accent-hover: #3a6da2;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --warning: #f59e0b;
  --warning-hover: #d97706;
  
  /* Neutral Colors - Updated */
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #3a4050;
  --gray-700: #2f3f57;
  --gray-800: #201f27;
  --gray-900: #1a1920;
  
  /* Semantic Colors - Dark Theme Default */
  --background: #201f27;
  --surface: #2f3f57;
  --surface-hover: #3a4050;
  --border: rgba(76, 139, 202, 0.2);
  --border-focus: #9810fa;
  --text-primary: #e5e7eb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  
  /* Spacing Scale */
  --space-1: 0.25rem;   /* 4px */
  --space-2: 0.5rem;    /* 8px */
  --space-3: 0.75rem;   /* 12px */
  --space-4: 1rem;      /* 16px */
  --space-5: 1.25rem;   /* 20px */
  --space-6: 1.5rem;    /* 24px */
  --space-8: 2rem;      /* 32px */
  --space-10: 2.5rem;   /* 40px */
  --space-12: 3rem;     /* 48px */
  --space-16: 4rem;     /* 64px */
  --space-20: 5rem;     /* 80px */
  
  /* Border Radius */
  --radius-sm: 0.375rem;  /* 6px */
  --radius-md: 0.5rem;    /* 8px */
  --radius-lg: 0.75rem;   /* 12px */
  --radius-xl: 1rem;      /* 16px */
  --radius-2xl: 1.5rem;   /* 24px */
  --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 -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  
  /* Typography */
  --font-sans: 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
  --font-display: 'Space Grotesk', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  
  /* Font Sizes */
  --text-xs: 0.75rem;     /* 12px */
  --text-sm: 0.875rem;    /* 14px */
  --text-base: 1rem;      /* 16px */
  --text-lg: 1.125rem;    /* 18px */
  --text-xl: 1.25rem;     /* 20px */
  --text-2xl: 1.5rem;     /* 24px */
  --text-3xl: 1.875rem;   /* 30px */
  --text-4xl: 2.25rem;    /* 36px */
  --text-5xl: 3rem;       /* 48px */
  --text-6xl: 3.75rem;    /* 60px */
  
  /* Line Heights */
  --leading-tight: 1.25;
  --leading-snug: 1.375;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;
  --leading-loose: 2;
  
  /* Font Weights */
  --weight-light: 300;
  --weight-normal: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --weight-extrabold: 800;
  --weight-black: 900;
  
  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Z-index */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal: 1040;
  --z-tooltip: 1070;
}

/* Dark Theme */
[data-theme="dark"] {
  --background: #201f27 !important;
  --surface: #2f3f57;
  --surface-hover: #3a4050;
  --border: rgba(76, 139, 202, 0.2);
  --text-primary: #e5e7eb;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --primary-light: rgba(152, 16, 250, 0.15);
  --border-focus: #9810fa;
}

/* Light Theme */
[data-theme="light"] {
  --background: #ffffff !important;
  --surface: #f8f9fa;
  --surface-hover: #e9ecef;
  --border: rgba(0, 0, 0, 0.1);
  --text-primary: #212529;
  --text-secondary: #6c757d;
  --text-muted: #adb5bd;
  --primary-light: rgba(255, 0, 255, 0.1);
  --border-focus: #ff00ff;
}

/* Theme-specific body backgrounds */
[data-theme="dark"] body,
html[data-theme="dark"] body {
  background-color: #201f27 !important;
  background: #201f27 !important;
}

[data-theme="light"] body,
html[data-theme="light"] body {
  background-color: #ffffff !important;
  background: #ffffff !important;
  color: #212529 !important;
}

/* Dark theme specific component styles */
[data-theme="dark"] .stat-card {
  background: var(--surface);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .stat-highlight {
  background: var(--surface);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  color: var(--text-primary);
}

[data-theme="dark"] .results-container {
  background: var(--surface) !important;
  border-color: var(--border) !important;
  color: var(--text-primary);
}

/* Base Styles */
html {
  font-family: var(--font-sans);
  line-height: var(--leading-normal);
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--background) !important;
  color: var(--text-primary) !important;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--weight-normal);
  line-height: var(--leading-normal);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ===== TYPOGRAPHY ===== */

/* Headings */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  margin: 0 0 var(--space-4) 0;
  color: var(--text-primary);
}

h1 {
  font-size: var(--text-4xl);
  font-weight: var(--weight-extrabold);
  letter-spacing: -0.025em;
}

h2 {
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
  letter-spacing: -0.02em;
}

h3 {
  font-size: var(--text-2xl);
  font-weight: var(--weight-semibold);
  letter-spacing: -0.01em;
}

h4 {
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
}

h5 {
  font-size: var(--text-lg);
  font-weight: var(--weight-medium);
}

h6 {
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Text elements */
p {
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  margin: 0 0 var(--space-4) 0;
  color: var(--text-primary);
}

small {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-normal);
}

/* Brand typography */
.brand-title {
  font-family: var(--font-display);
  font-size: var(--text-6xl);
  font-weight: var(--weight-black);
  letter-spacing: -0.04em;
  line-height: var(--leading-tight);
  background: linear-gradient(135deg, #9810fa, #4c8bca);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-align: center;
}

.welcome-title {
  font-family: var(--font-display);
  font-size: var(--text-5xl);
  font-weight: var(--weight-extrabold);
  letter-spacing: -0.03em;
  line-height: var(--leading-tight);
  background: linear-gradient(135deg, #9810fa, #4c8bca);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.welcome-subtitle {
  font-size: var(--text-lg);
  font-weight: var(--weight-normal);
  line-height: var(--leading-relaxed);
  color: var(--text-secondary);
  margin-top: var(--space-2);
}

/* Code and monospace */
code, pre, .code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--surface);
  padding: 0.125em 0.25em;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

pre {
  padding: var(--space-4);
  overflow-x: auto;
  line-height: var(--leading-relaxed);
}

/* Interactive text */
a {
  color: var(--primary);
  text-decoration: none;
  font-weight: var(--weight-medium);
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* Form text styling */
label {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
  display: block;
}

/* Button typography */
.btn {
  font-family: var(--font-sans);
  font-weight: var(--weight-medium);
  font-size: var(--text-sm);
  letter-spacing: 0.025em;
}

.btn-primary {
  font-weight: var(--weight-semibold);
}

/* Utility text classes */
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.text-3xl { font-size: var(--text-3xl); }
.text-4xl { font-size: var(--text-4xl); }

.font-light { font-weight: var(--weight-light); }
.font-normal { font-weight: var(--weight-normal); }
.font-medium { font-weight: var(--weight-medium); }
.font-semibold { font-weight: var(--weight-semibold); }
.font-bold { font-weight: var(--weight-bold); }
.font-extrabold { font-weight: var(--weight-extrabold); }

.leading-tight { line-height: var(--leading-tight); }
.leading-normal { line-height: var(--leading-normal); }
.leading-relaxed { line-height: var(--leading-relaxed); }

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }

/* ===== LAYOUT COMPONENTS ===== */

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

.section {
  padding: var(--space-8) 0;
}

/* Grid System */
.grid {
  display: grid;
  gap: var(--space-6);
}

.grid-cols-1 { grid-template-columns: 1fr; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }

@media (min-width: 768px) {
  .md\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
  .md\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 1024px) {
  .lg\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
}

/* Flex Utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }

/* ===== HEADER COMPONENT ===== */

.app-header {
  background: var(--background);
  border-bottom: 1px solid var(--border);
  padding: var(--space-4) 0;
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  backdrop-filter: blur(8px);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.header-logo {
  width: 40px;
  height: 40px;
  color: var(--primary);
}

.header-title {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  margin: 0;
}

.header-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin: 0;
}

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

/* ===== CARD COMPONENT ===== */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  overflow: hidden;
  transition: all var(--transition-normal);
}

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

.card-header {
  padding: var(--space-6);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.card-header h3 {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  margin: 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.card-body {
  padding: var(--space-6);
}

/* ===== FORM COMPONENTS ===== */

.form-group {
  margin-bottom: var(--space-6);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  background: var(--surface);
  color: var(--text-primary);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.form-textarea {
  resize: vertical;
  min-height: 200px;
  line-height: 1.8;
  font-family: 'Cairo', 'Inter', 'Segoe UI', 'Roboto', Arial, sans-serif;
  font-size: 18px;
  font-weight: 450;
  direction: auto;
  unicode-bidi: bidi-override;
  text-align: start;
  padding: var(--space-6);
  background: linear-gradient(145deg, var(--background) 0%, rgba(59, 130, 246, 0.012) 50%, rgba(16, 185, 129, 0.008) 100%);
  border: 2px solid var(--border);
  border-radius: var(--radius-xl);
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  letter-spacing: 0.01em;
  box-shadow: 
    inset 0 2px 4px rgba(0, 0, 0, 0.03),
    0 4px 12px rgba(0, 0, 0, 0.04),
    0 0 0 1px rgba(59, 130, 246, 0.02);
}

.form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 
    0 0 0 4px rgba(59, 130, 246, 0.12),
    inset 0 2px 4px rgba(0, 0, 0, 0.02),
    0 8px 24px rgba(59, 130, 246, 0.12),
    0 0 0 1px rgba(59, 130, 246, 0.08);
  background: linear-gradient(145deg, var(--background) 0%, rgba(59, 130, 246, 0.025) 50%, rgba(16, 185, 129, 0.015) 100%);
  transform: translateY(-2px) scale(1.01);
  outline: none;
}

.form-textarea::placeholder {
  color: var(--text-muted);
  font-style: italic;
  opacity: 0.65;
  font-size: 17px;
  letter-spacing: 0.005em;
  transition: opacity 0.2s ease;
}
.form-textarea:focus::placeholder {
  opacity: 0.4;
  transform: translateY(-2px);
}

/* Arabic text specific enhancements */
.form-textarea[lang="ar"],
.form-textarea:lang(ar) {
  direction: rtl;
  text-align: right;
  font-family: 'Cairo', 'Amiri', 'Noto Sans Arabic', 'Traditional Arabic', Arial, sans-serif;
  font-size: 20px;
  line-height: 2.0;
  letter-spacing: 0.025em;
  font-weight: 500;
}

/* Enhanced input styles */
.form-input {
  font-family: 'Cairo', 'Segoe UI', 'Tahoma', Arial, sans-serif;
  padding: var(--space-3) var(--space-4);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--background) 0%, rgba(59, 130, 246, 0.01) 100%);
  transition: all var(--transition-normal);
  box-shadow: 
    inset 0 1px 2px rgba(0, 0, 0, 0.02),
    0 1px 1px rgba(0, 0, 0, 0.02);
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 
    0 0 0 3px rgba(59, 130, 246, 0.1),
    inset 0 1px 2px rgba(0, 0, 0, 0.02),
    0 2px 8px rgba(59, 130, 246, 0.06);
  transform: translateY(-1px);
}

.form-checkbox {
  width: 16px;
  height: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  cursor: none !important;
  transition: all var(--transition-fast);
}

.form-checkbox:checked {
  background: var(--primary);
  border-color: var(--primary);
}

.form-checkbox:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* ===== BUTTON COMPONENTS ===== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  text-decoration: none;
  cursor: none !important;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, #9810fa, #4c8bca);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #7a0dcc, #3a6da2);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(152, 16, 250, 0.4);
}

.btn-secondary {
  background: var(--surface-hover);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--surface-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-success {
  background: var(--accent);
  color: white;
}

.btn-success:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background: var(--danger-hover);
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-base);
}

.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
}

/* ===== THEME TOGGLE ===== */

.theme-toggle {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  width: 48px;
  height: 24px;
  position: relative;
  cursor: none !important;
  transition: background-color var(--transition-normal);
  padding: 0;
}

.theme-toggle-slider {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  background: var(--background);
  border-radius: var(--radius-full);
  transition: transform var(--transition-normal);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .theme-toggle-slider {
  transform: translateX(24px);
}

/* ===== STATISTICS COMPONENTS ===== */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: var(--space-3);
}

.stat-card {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  text-align: center;
  transition: all var(--transition-normal);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  font-size: var(--text-2xl);
  margin-bottom: var(--space-2);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  margin: 0 auto var(--space-2);
}

.stat-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-1);
}

.stat-value {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  margin: 0;
}

/* ===== RESULTS COMPONENTS ===== */

.results-container {
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.results-empty {
  text-align: center;
  color: var(--text-muted);
}

.results-empty-icon {
  font-size: var(--text-4xl);
  margin-bottom: var(--space-4);
}

.results-text {
  line-height: 1.8;
  font-family: 'Cairo', 'Inter', 'Segoe UI', 'Roboto', Arial, sans-serif;
  font-size: 18px;
  font-weight: 450;
  background: linear-gradient(145deg, var(--surface) 0%, rgba(59, 130, 246, 0.015) 50%, rgba(16, 185, 129, 0.01) 100%);
  padding: var(--space-6);
  border-radius: var(--radius-xl);
  border: 2px solid var(--border);
  white-space: pre-wrap;
  word-break: break-word;
  direction: auto;
  unicode-bidi: bidi-override;
  text-align: start;
  min-height: 200px;
  letter-spacing: 0.01em;
  position: relative;
  overflow-wrap: break-word;
  box-shadow: 
    inset 0 2px 4px rgba(0, 0, 0, 0.025),
    0 4px 12px rgba(0, 0, 0, 0.04),
    0 0 0 1px rgba(59, 130, 246, 0.03);
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.results-text:hover {
  box-shadow: 
    inset 0 2px 4px rgba(0, 0, 0, 0.025),
    0 8px 24px rgba(59, 130, 246, 0.08),
    0 0 0 1px rgba(59, 130, 246, 0.05);
  transform: translateY(-1px);
  border-color: rgba(59, 130, 246, 0.2);
}

/* Arabic text in results */
.results-text:lang(ar),
.results-text[dir="rtl"] {
  direction: rtl;
  text-align: right;
  font-family: 'Cairo', 'Amiri', 'Noto Sans Arabic', 'Traditional Arabic', Arial, sans-serif;
  font-size: 20px;
  line-height: 2.0;
  letter-spacing: 0.025em;
  font-weight: 500;
}

/* Enhanced results container */
.results-container {
  min-height: 200px;
  display: flex;
  align-items: stretch;
  justify-content: center;
  padding: var(--space-3);
  background: linear-gradient(145deg, transparent 0%, rgba(59, 130, 246, 0.008) 50%, rgba(16, 185, 129, 0.005) 100%);
  border-radius: var(--radius-xl);
  position: relative;
}
.results-container::before {
  content: '';
  position: absolute;
  top: -1px;
  left: -1px;
  right: -1px;
  bottom: -1px;
  background: linear-gradient(145deg, rgba(59, 130, 246, 0.1), rgba(16, 185, 129, 0.1));
  border-radius: var(--radius-xl);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
}
.results-container:hover::before {
  opacity: 0.5;
}

/* Advanced visual effects for text areas */
.form-textarea,
.results-text {
  position: relative;
  overflow: hidden;
}

.form-textarea::before,
.results-text::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(59, 130, 246, 0.03),
    transparent
  );
  transition: left 0.5s ease;
  z-index: 0;
  pointer-events: none;
}

.form-textarea:focus::before,
.results-text:hover::before {
  left: 100%;
}

.form-textarea *,
.results-text * {
  position: relative;
  z-index: 1;
}

/* Advanced typing effect for textarea */
.form-textarea:focus {
  animation: textareaGlow 2s ease-in-out infinite alternate;
}

@keyframes textareaGlow {
  0% {
    box-shadow: 
      0 0 0 4px rgba(59, 130, 246, 0.12),
      inset 0 2px 4px rgba(0, 0, 0, 0.02),
      0 8px 24px rgba(59, 130, 246, 0.12),
      0 0 0 1px rgba(59, 130, 246, 0.08);
  }
  100% {
    box-shadow: 
      0 0 0 4px rgba(59, 130, 246, 0.15),
      inset 0 2px 4px rgba(0, 0, 0, 0.02),
      0 12px 32px rgba(59, 130, 246, 0.15),
      0 0 0 1px rgba(59, 130, 246, 0.12);
  }
}

/* Advanced hover effects for results */
.results-text {
  overflow: visible;
}

.results-text::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: conic-gradient(
    from 0deg,
    rgba(59, 130, 246, 0.1),
    rgba(16, 185, 129, 0.1),
    rgba(139, 92, 246, 0.1),
    rgba(59, 130, 246, 0.1)
  );
  border-radius: var(--radius-xl);
  opacity: 0;
  z-index: -1;
  transition: opacity 0.3s ease;
  animation: rotateGradient 4s linear infinite;
}

.results-text:hover::after {
  opacity: 0.3;
}

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

/* Enhanced entity highlighting with advanced effects */
.entity {
  position: relative;
  display: inline-block;
  animation: entityPulse 2s ease-in-out infinite;
}

@keyframes entityPulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.02);
  }
}

.entity::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: linear-gradient(45deg, currentColor, transparent, currentColor);
  opacity: 0;
  z-index: -1;
  border-radius: var(--radius-sm);
  transition: opacity 0.2s ease;
}

.entity:hover::before {
  opacity: 0.1;
  animation: entityGlow 1s ease-in-out infinite alternate;
}

@keyframes entityGlow {
  0% {
    opacity: 0.1;
    transform: scale(1);
  }
  100% {
    opacity: 0.2;
    transform: scale(1.05);
  }
}

/* Entity Highlighting */
.entity {
  padding: 0.125rem 0.25rem;
  border-radius: var(--radius-sm);
  font-weight: var(--weight-medium);
  margin: 0 1px;
  position: relative;
}

.entity-PER { background: rgba(37, 99, 235, 0.1); color: #1d4ed8; }
.entity-LOC { background: rgba(16, 185, 129, 0.1); color: #059669; }
.entity-ORG { background: rgba(245, 158, 11, 0.1); color: #d97706; }
.entity-URL { background: rgba(239, 68, 68, 0.1); color: #dc2626; }
.entity-EMAIL { background: rgba(139, 92, 246, 0.1); color: #7c3aed; }
.entity-PHONE { background: rgba(6, 182, 212, 0.1); color: #0891b2; }
.entity-CIVIL-ID { background: rgba(34, 197, 94, 0.1); color: #16a34a; }
.entity-PASSPORT-ID { background: rgba(168, 85, 247, 0.1); color: #9333ea; }
.entity-CREDIT-CARD { background: rgba(236, 72, 153, 0.1); color: #db2777; }

/* ===== LOADING STATES ===== */

.loading-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top: 2px solid currentColor;
  border-radius: var(--radius-full);
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===== ALERTS ===== */

.alert {
  padding: var(--space-4);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
  border-left: 4px solid;
}

.alert-success {
  background: rgba(16, 185, 129, 0.1);
  border-left-color: var(--accent);
  color: var(--accent);
}

.alert-error {
  background: rgba(239, 68, 68, 0.1);
  border-left-color: var(--danger);
  color: var(--danger);
}

.alert-warning {
  background: rgba(245, 158, 11, 0.1);
  border-left-color: var(--warning);
  color: var(--warning);
}

/* ===== COUNTER COMPONENT ===== */

.total-counter {
  background: linear-gradient(135deg, #9810fa, #4c8bca);
  color: white;
  padding: var(--space-6);
  border-radius: var(--radius-xl);
  text-align: center;
  margin-bottom: var(--space-8);
  box-shadow: 0 10px 30px rgba(152, 16, 250, 0.3);
}

.total-counter-label {
  font-size: var(--text-sm);
  opacity: 0.9;
  margin-bottom: var(--space-2);
}

.total-counter-value {
  font-size: var(--text-4xl);
  font-weight: var(--weight-bold);
  margin: 0;
}

/* ===== ANIMATIONS ===== */

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.animate-fade-in { animation: fadeIn 0.3s ease-out; }
.animate-slide-up { animation: slideUp 0.3s ease-out; }
.animate-pulse { animation: pulse 0.6s ease-in-out; }

/* ===== ENTITY DICTIONARY STYLES ===== */

.entity-dictionary-card {
  min-width: 320px;
  position: relative;
}

.entity-filter-btn {
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  cursor: pointer !important;
  user-select: none;
}

.entity-filter-btn:hover {
  opacity: 0.8;
}

.entity-filter-btn.active {
  font-weight: var(--weight-semibold);
}

.entity-mapping-item {
  cursor: pointer;
}

.entity-group-header {
  position: sticky;
  top: 0;
  background: var(--background);
  z-index: 10;
}

.dictionary-empty {
  text-align: center;
  color: var(--text-muted);
}

/* Enhanced scrollbar for dictionary */
#entity-dictionary-content {
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

#entity-dictionary-content::-webkit-scrollbar {
  width: 6px;
}

#entity-dictionary-content::-webkit-scrollbar-track {
  background: transparent;
}

#entity-dictionary-content::-webkit-scrollbar-thumb {
  background-color: var(--border);
  border-radius: 3px;
}

#entity-dictionary-content::-webkit-scrollbar-thumb:hover {
  background-color: var(--text-muted);
}

/* ===== RESPONSIVE DESIGN ===== */

@media (max-width: 1200px) {
  /* Switch to 2-column layout on smaller screens */
  .container main > div[style*="grid-template-columns"] {
    grid-template-columns: 1fr 1fr !important;
  }
  
  .entity-dictionary-card {
    grid-column: 1 / -1;
    max-height: 400px !important;
  }
}

@media (max-width: 768px) {
  .container {
    padding: 0 var(--space-4);
  }
  
  .container main > div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }
  
  .grid-cols-2 {
    grid-template-columns: 1fr;
  }
  
  .header-content {
    flex-direction: column;
    gap: var(--space-4);
    text-align: center;
  }
  
  .header-brand {
    flex-direction: column;
    gap: var(--space-2);
  }
  
  .card-header,
  .card-body {
    padding: var(--space-4);
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
  }
  
  .btn {
    width: 100%;
  }
  
  .flex {
    flex-direction: column;
  }
  
  .flex.gap-4 {
    gap: var(--space-3);
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .total-counter {
    padding: var(--space-4);
  }
  
  .total-counter-value {
    font-size: var(--text-3xl);
  }
}

/* ===== UTILITY CLASSES ===== */

.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }

.font-medium { font-weight: var(--weight-medium); }
.font-semibold { font-weight: var(--weight-semibold); }
.font-bold { font-weight: var(--weight-bold); }

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }

.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }

.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }

.rounded { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }

.shadow { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

.w-full { width: 100%; }
.h-full { height: 100%; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}


/* Custom Select Dropdown */
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  background-position: right 12px center;
  background-repeat: no-repeat;
  background-size: 16px;
  padding-right: 40px;
  font-family: 'Cairo', 'Segoe UI', 'Tahoma', Arial, sans-serif;
  font-weight: 500;
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  background-color: linear-gradient(135deg, var(--background) 0%, rgba(59, 130, 246, 0.01) 100%);
  box-shadow: 
    inset 0 1px 2px rgba(0, 0, 0, 0.02),
    0 1px 1px rgba(0, 0, 0, 0.02);
  transition: all var(--transition-normal);
}

.form-select:focus {
  border-color: var(--primary);
  box-shadow: 
    0 0 0 3px rgba(59, 130, 246, 0.1),
    inset 0 1px 2px rgba(0, 0, 0, 0.02),
    0 2px 8px rgba(59, 130, 246, 0.06);
  transform: translateY(-1px);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%232563eb' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
}

.form-select:hover {
  border-color: rgba(59, 130, 246, 0.3);
  background-color: rgba(59, 130, 246, 0.01);
}

/* Custom Cursor Styles */
* {
  cursor: none !important;
}

button, a, .cursor-pointer {
  cursor: none !important;
}

input, textarea, select, select option, select:focus, select:active {
  cursor: none !important;
}

/* Custom Select Dropdown */
.custom-select-wrapper {
  position: relative;
  width: 100%;
}

.custom-select-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  background: var(--background);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  cursor: none !important;
  user-select: none;
  transition: all var(--transition-normal);
}

.custom-select-display:hover {
  border-color: rgba(59, 130, 246, 0.3);
  background: rgba(59, 130, 246, 0.01);
}

.custom-select-display:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.custom-select-text {
  flex: 1;
  font-size: var(--text-base);
  color: var(--text-primary);
  font-weight: 500;
}

.custom-select-arrow {
  transition: transform 0.2s ease;
  color: var(--text-secondary);
}

.custom-select-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--background);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 1000;
  max-height: 200px;
  overflow-y: auto;
}

.custom-select-option {
  padding: var(--space-3) var(--space-4);
  cursor: none !important;
  transition: background 0.2s ease;
  font-size: var(--text-base);
  color: var(--text-primary);
}

.custom-select-option:hover {
  background: var(--surface);
}

.custom-select-option-selected {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}

.form-select-hidden {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* Hover Magnification Effects */
.stat-card, .btn, .card {
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.stat-card:hover {
  transform: translateY(-4px) scale(1.05);
}

.btn:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.03);
}

.card:hover {
  transform: scale(1.01);
}

/* ===== PRINT STYLES ===== */

@media print {
  .app-header,
  .btn,
  .theme-toggle {
    display: none !important;
  }
  
  .card {
    border: 1px solid #000;
    box-shadow: none;
  }
  
  body {
    background: white;
    color: black;
  }
}