/* Modern CSS Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Custom Properties */
:root {
  /* Color Palette */
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --secondary: #f59e0b;
  --accent: #ec4899;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  
  /* Neutrals */
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  
  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --gradient-secondary: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
  --gradient-accent: linear-gradient(135deg, #ec4899 0%, #f43f5e 100%);
  --gradient-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);
  
  /* Border Radius */
  --radius-sm: 0.375rem;
  --radius: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  --radius-2xl: 2rem;
  
  /* Spacing */
  --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;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
}

/* Base Styles */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  line-height: 1.6;
  overflow-x: hidden;
}

/* Form Controls */
.form-control {
  width: 100%;
  padding: var(--space-3);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  background: white;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-control::placeholder {
  color: var(--gray-400);
}

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

.form-group label {
  display: block;
  margin-bottom: var(--space-2);
  font-weight: 500;
  color: var(--gray-700);
}

/* App Container */
.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--space-4) var(--space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.logo-icon {
  width: 48px;
  height: 48px;
  background: var(--gradient-primary);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
}

.logo-icon i {
  font-size: 1.5rem;
  color: white;
}

.logo h1 {
  font-size: 1.875rem;
  font-weight: 800;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-actions {
  display: flex;
  gap: var(--space-3);
}

/* Buttons */
.btn-outline {
  background: transparent;
  border: 2px solid var(--gray-300);
  color: var(--gray-700);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-primary {
  background: var(--gradient-primary);
  border: none;
  color: white;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  box-shadow: var(--shadow-md);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-xl);
}

.btn-secondary {
  background: var(--gray-100);
  border: none;
  color: var(--gray-700);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.btn-secondary:hover {
  background: var(--gray-200);
  transform: translateY(-1px);
}

.btn-process {
  background: var(--gradient-success);
  border: none;
  color: white;
  padding: var(--space-4) var(--space-6);
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  box-shadow: var(--shadow-lg);
}

.btn-process:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2xl);
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

/* Sidebar */
.sidebar {
  width: 280px;
  background: white;
  border-right: 1px solid var(--gray-200);
  padding: var(--space-6);
  position: sticky;
  top: 80px;
  height: calc(100vh - 80px);
  overflow-y: auto;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}

.nav-section h3 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-3);
}

.nav-section ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.nav-section li {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 500;
}

.nav-section li:hover {
  background: var(--gray-100);
  color: var(--primary);
}

.nav-section li.active {
  background: var(--primary);
  color: white;
  box-shadow: var(--shadow-md);
}

.nav-section li i {
  width: 20px;
  text-align: center;
}

/* Risk Indicators */
.risk-indicators {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.risk-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius);
  background: var(--gray-50);
  transition: all 0.2s ease;
}

.risk-item:hover {
  background: var(--gray-100);
  transform: translateX(4px);
}

.risk-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.risk-item.tier1 .risk-dot {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.1);
}

.risk-item.tier2 .risk-dot {
  background: var(--warning);
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.1);
}

.risk-item.tier3 .risk-dot {
  background: var(--secondary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.risk-item.tier4 .risk-dot {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
}

.risk-item span {
  flex: 1;
  font-weight: 500;
}

.risk-item .count {
  background: var(--gray-200);
  color: var(--gray-600);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
}

/* Content Area */
.content-area {
  flex: 1;
  padding: var(--space-6);
  background: var(--gray-50);
}

/* Page Header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-8);
  gap: var(--space-6);
}

.page-title h2 {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--gray-900);
  margin-bottom: var(--space-2);
}

.page-title p {
  color: var(--gray-600);
  font-size: 1.125rem;
}

.page-stats {
  display: flex;
  gap: var(--space-4);
}

.stat-card {
  background: white;
  padding: var(--space-4);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 160px;
  transition: all 0.2s ease;
}

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

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: white;
}

.stat-card:nth-child(1) .stat-icon {
  background: var(--gradient-primary);
}

.stat-card:nth-child(2) .stat-icon {
  background: var(--gradient-secondary);
}

.stat-card:nth-child(3) .stat-icon {
  background: var(--gradient-accent);
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-number {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--gray-900);
  line-height: 1;
}

.stat-label {
  font-size: 0.875rem;
  color: var(--gray-500);
  font-weight: 500;
}

/* Dashboard Widgets */
.dashboard-widgets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
  margin-top: var(--space-4);
}

.widget-card {
  background: white;
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--gray-100);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: var(--space-6);
  min-height: 120px;
}

.widget-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-2xl);
  border-color: var(--primary-light);
}

.widget-card[onclick] {
  cursor: pointer;
}

.widget-icon {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: white;
  flex-shrink: 0;
}

.widget-card:nth-child(1) .widget-icon {
  background: var(--gradient-primary);
}

.widget-card:nth-child(2) .widget-icon {
  background: var(--gradient-secondary);
}

.widget-card:nth-child(3) .widget-icon {
  background: var(--gradient-accent);
}

.widget-info {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.widget-number {
  font-size: 3rem;
  font-weight: 800;
  color: var(--gray-900);
  line-height: 1;
}

.widget-label {
  font-size: 1.125rem;
  color: var(--gray-600);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

@media (max-width: 1024px) {
  .dashboard-widgets {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }
  
  .widget-card {
    padding: var(--space-6);
    min-height: 100px;
  }
  
  .widget-icon {
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
  }
  
  .widget-number {
    font-size: 2.5rem;
  }
  
  .widget-label {
    font-size: 1rem;
  }
}

@media (max-width: 768px) {
  .dashboard-widgets {
    gap: var(--space-3);
  }
  
  .widget-card {
    padding: var(--space-4);
    gap: var(--space-4);
    min-height: 80px;
  }
  
  .widget-icon {
    width: 50px;
    height: 50px;
    font-size: 1.25rem;
  }
  
  .widget-number {
    font-size: 2rem;
  }
  
  .widget-label {
    font-size: 0.875rem;
  }
}

/* Upload Container */
.upload-container {
  background: white;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--gray-200);
  overflow: hidden;
}

.upload-form {
  padding: var(--space-8);
}

/* Form Sections */
.form-section {
  margin-bottom: var(--space-8);
}

.form-section:last-child {
  margin-bottom: 0;
}

.section-header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.section-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: white;
  background: var(--gradient-primary);
  box-shadow: var(--shadow-md);
}

.section-info h3 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: var(--space-1);
}

.section-info p {
  color: var(--gray-600);
}

/* Form Grid */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--space-6);
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-field label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 600;
  color: var(--gray-700);
}

.form-field label i {
  color: var(--primary);
}

.form-field input {
  padding: var(--space-4);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 1rem;
  transition: all 0.2s ease;
  background: white;
}

.form-field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-field input::placeholder {
  color: var(--gray-400);
}

/* Upload Grid */
.upload-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: var(--space-6);
}

.upload-card {
  background: var(--gray-50);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  transition: all 0.2s ease;
}

.upload-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

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

.upload-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: white;
  background: var(--gradient-secondary);
}

.upload-info h4 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: var(--space-1);
}

.upload-info p {
  color: var(--gray-600);
  font-size: 0.875rem;
}

/* Upload Area */
.upload-area {
  position: relative;
}

.upload-zone {
  border: 3px dashed var(--gray-300);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  text-align: center;
  background: white;
  cursor: pointer;
  transition: all 0.2s ease;
}

.upload-zone:hover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.02);
  transform: scale(1.02);
}

.upload-zone.dragover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.05);
  transform: scale(1.02);
}

.upload-zone i {
  font-size: 3rem;
  color: var(--primary);
  margin-bottom: var(--space-4);
}

.upload-zone h5 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: var(--space-2);
}

.upload-zone p {
  color: var(--gray-600);
  margin-bottom: var(--space-2);
}

.upload-zone small {
  color: var(--gray-500);
  font-size: 0.875rem;
}

.upload-area input[type="file"] {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

/* File Preview */
.file-preview {
  margin-top: var(--space-4);
  padding: var(--space-4);
  background: white;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  min-height: 60px;
}

.file-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.file-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--gray-50);
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  animation: slideIn 0.3s ease;
}

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

.file-item i {
  color: var(--success);
  font-size: 1.25rem;
}

.file-info {
  flex: 1;
}

.file-name {
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: var(--space-1);
}

.file-size {
  color: var(--gray-500);
  font-size: 0.875rem;
}

/* Form Actions */
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-4);
  padding-top: var(--space-6);
  border-top: 1px solid var(--gray-200);
  margin-top: var(--space-8);
}

/* Responsive Design */
@media (max-width: 1024px) {
  .sidebar {
    width: 240px;
  }
  
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .page-stats {
    width: 100%;
    justify-content: space-between;
  }
  
  .stat-card {
    min-width: 120px;
  }
}

@media (max-width: 768px) {
  .main-content {
    flex-direction: column;
  }
  
  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--gray-200);
  }
  
  .sidebar-nav {
    flex-direction: row;
    gap: var(--space-4);
    overflow-x: auto;
  }
  
  .nav-section {
    min-width: 200px;
  }
  
  .upload-grid {
    grid-template-columns: 1fr;
  }
  
  .form-grid {
    grid-template-columns: 1fr;
  }
  
  .page-stats {
    flex-direction: column;
  }
  
  .stat-card {
    width: 100%;
  }
  
  .form-actions {
    flex-direction: column;
  }
}

/* Notifications */
.notification {
  position: fixed;
  top: var(--space-4);
  right: var(--space-4);
  background: white;
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  z-index: 1000;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  max-width: 400px;
}

.notification.show {
  transform: translateX(0);
}

.notification-error {
  border-left: 4px solid var(--danger);
}

.notification-error i {
  color: var(--danger);
}

.notification-info {
  border-left: 4px solid var(--primary);
}

.notification-info i {
  color: var(--primary);
}

.notification-close {
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  padding: var(--space-1);
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.notification-close:hover {
  background: var(--gray-100);
  color: var(--gray-600);
}

/* Loading States */
.btn-process:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none !important;
}

/* Client Form Grid Styles */
.client-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 2fr auto;
  gap: var(--space-4);
  align-items: end;
  margin-bottom: var(--space-6);
}

.client-form-grid .form-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.client-form-grid .form-field label {
  font-weight: 600;
  color: var(--gray-700);
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.client-form-grid .form-field label i {
  color: var(--primary);
  font-size: 0.875rem;
}

.client-form-grid .form-field input,
.client-form-grid .form-field textarea {
  padding: var(--space-3);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 0.875rem;
  transition: all 0.2s ease;
  background: white;
}

.client-form-grid .form-field input:focus,
.client-form-grid .form-field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgb(99 102 241 / 0.1);
}

.client-form-grid .form-field textarea {
  resize: vertical;
  min-height: 48px;
  max-height: 48px;
  font-family: inherit;
  overflow-y: hidden;
}

.client-form-grid .form-button {
  display: flex;
  align-items: flex-end;
}

.client-form-grid .form-button .btn-process {
  white-space: nowrap;
  height: fit-content;
  padding: var(--space-3) var(--space-5);
}

/* Responsive adjustments for client form */
@media (max-width: 1024px) {
  .client-form-grid {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto auto;
  }
  
  .client-form-grid .form-field:nth-child(3) {
    grid-column: 1 / -1;
  }
  
  .client-form-grid .form-button {
    grid-column: 1 / -1;
    justify-content: center;
  }
}

@media (max-width: 768px) {
  .client-form-grid {
    grid-template-columns: 1fr;
  }
  
  .client-form-grid .form-field:nth-child(3) {
    grid-column: 1;
  }
  
  .client-form-grid .form-button {
    grid-column: 1;
  }
}

/* Checkbox Group Styling */
.checkbox-group {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 1rem;
  max-height: 200px;
  overflow-y: auto;
}

.checkbox-item {
  display: flex;
  align-items: center;
  margin-bottom: 0.5rem;
  padding: 0.25rem 0;
}

.checkbox-item:last-child {
  margin-bottom: 0;
}

.checkbox-item input[type="checkbox"] {
  width: auto;
  margin: 0;
  margin-right: 0.5rem;
  accent-color: var(--primary);
}

.checkbox-item label {
  font-size: 0.9rem;
  font-weight: normal !important;
  color: var(--gray-700);
  cursor: pointer;
  margin: 0;
  text-transform: none !important;
  letter-spacing: normal !important;
}

.checkbox-item:hover {
  background-color: var(--gray-100);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.5rem;
  margin: 0 -0.5rem 0.5rem -0.5rem;
}