
/* ===== DESIGN SYSTEM & COLOR PALETTE ===== */
:root {
  /* Primary Brand Colors */
  --primary-50: #f0fdf4;
  --primary-100: #dcfce7;
  --primary-200: #bbf7d0;
  --primary-300: #86efac;
  --primary-400: #4ade80;
  --primary-500: #00a651;
  --primary-600: #008c44;
  --primary-700: #166534;
  --primary-800: #14532d;
  --primary-900: #052e16;

  /* Neutral Colors */
  --neutral-50: #fafafa;
  --neutral-100: #f4f4f5;
  --neutral-200: #e4e4e7;
  --neutral-300: #d4d4d8;
  --neutral-400: #a1a1aa;
  --neutral-500: #71717a;
  --neutral-600: #52525b;
  --neutral-700: #3f3f46;
  --neutral-800: #27272a;
  --neutral-900: #18181b;

  /* Semantic Colors */
  --success-50: #f0fdf4;
  --success-500: #22c55e;
  --success-600: #16a34a;
  --success-700: #15803d;

  --warning-50: #fffbeb;
  --warning-500: #f59e0b;
  --warning-600: #d97706;
  --warning-700: #b45309;

  --error-50: #fef2f2;
  --error-500: #ef4444;
  --error-600: #dc2626;
  --error-700: #b91c1c;

  --info-50: #eff6ff;
  --info-500: #3b82f6;
  --info-600: #2563eb;
  --info-700: #1d4ed8;

  /* Component Colors - Light Mode */
  --background: var(--neutral-50);
  --surface: #ffffff;
  --surface-secondary: var(--neutral-100);
  --surface-tertiary: var(--neutral-200);
  
  --text-primary: var(--neutral-900);
  --text-secondary: var(--neutral-600);
  --text-muted: var(--neutral-500);
  
  --border-subtle: var(--neutral-200);
  --border-default: var(--neutral-300);
  --border-strong: var(--neutral-400);

  /* Shadows */
  --shadow-xs: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-sm: 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);

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;

  /* Border Radius */
  --radius-sm: 0.25rem;
  --radius-md: 0.375rem;
  --radius-lg: 0.5rem;
  --radius-xl: 0.75rem;
  --radius-2xl: 1rem;

  /* Typography */
  --font-family-sans: 'Segoe UI', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --font-size-2xl: 1.5rem;
  --font-size-3xl: 1.875rem;
  --font-size-4xl: 2.25rem;

  /* Transitions */
  --transition-fast: 0.15s ease-in-out;
  --transition-normal: 0.2s ease-in-out;
  --transition-slow: 0.3s ease-in-out;
}

/* ===== BASE STYLES ===== */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family-sans);
  margin: 0;
  padding: 0;
  background-color: var(--background);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: var(--font-size-base);
  transition: background-color var(--transition-slow), color var(--transition-slow);
  min-height: 100vh;
}

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4, h5, h6 {
  color: var(--text-primary);
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 var(--space-md) 0;
  letter-spacing: -0.025em;
}

h1 { font-size: var(--font-size-3xl); }
h2 { font-size: var(--font-size-2xl); }
h3 { font-size: var(--font-size-xl); }
h4 { font-size: var(--font-size-lg); }
h5 { font-size: var(--font-size-base); }
h6 { font-size: var(--font-size-sm); }

p {
  color: var(--text-secondary);
  margin: 0 0 var(--space-md) 0;
}

/* ===== LAYOUT COMPONENTS ===== */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.dashboard-container {
  max-width: 900px;
  margin: auto;
  padding: var(--space-xl);
}

.auth-container {
  max-width: 400px;
  margin: 2rem auto;
  padding: var(--space-2xl);
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-subtle);
}

/* ===== CARDS ===== */
.card {
  background: var(--surface);
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-subtle);
  transition: all var(--transition-normal);
}

.card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-default);
  transform: translateY(-1px);
}

.stat-card {
  background: var(--surface);
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-subtle);
  text-align: center;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary-500), var(--primary-400));
  opacity: 0;
  transition: opacity var(--transition-normal);
}

.stat-card:hover::before {
  opacity: 1;
}

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

.stat-value {
  font-size: var(--font-size-2xl);
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.stat-label {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ===== FORMS ===== */
.form-group {
  margin-bottom: var(--space-lg);
}

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

input, select, textarea {
  width: 100%;
  padding: 0.75rem var(--space-md);
  font-size: var(--font-size-base);
  border: 2px solid var(--border-default);
  border-radius: var(--radius-md);
  background-color: var(--surface);
  color: var(--text-primary);
  transition: all var(--transition-normal);
  font-family: inherit;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 3px rgb(0 166 81 / 0.1);
  background-color: var(--surface);
}

input::placeholder {
  color: var(--text-muted);
}

input:disabled, select:disabled {
  background-color: var(--surface-secondary);
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.6;
}


/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 0.75rem var(--space-lg);
  font-size: var(--font-size-base);
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition-normal);
  min-height: 44px;
  font-family: inherit;
  position: relative;
  overflow: hidden;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

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

.btn-secondary:hover:not(:disabled) {
  background-color: var(--surface-secondary);
  border-color: var(--primary-500);
  color: var(--primary-600);
}

.btn-success {
  background: linear-gradient(135deg, var(--success-500), var(--success-600));
  color: white;
}

.btn-warning {
  background: linear-gradient(135deg, var(--warning-500), var(--warning-600));
  color: white;
}

.btn-error {
  background: linear-gradient(135deg, var(--error-500), var(--error-600));
  color: white;
}

button {
  background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
  color: white;
  border: none;
  padding: 0.75rem var(--space-lg);
  font-size: var(--font-size-base);
  font-weight: 600;
  margin: var(--space-sm);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-normal);
  font-family: inherit;
  box-shadow: var(--shadow-sm);
}

button:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* Reveal*/
.reveal {
  opacity: 0;
  transform: translateY(8px);
  animation: reveal 0.9s ease forwards;
}

.d1 { animation-delay: 0.2s; }
.d2 { animation-delay: 0.6s; }
.d3 { animation-delay: 1s; }
.d4 { animation-delay: 1.5s; }
.d5 { animation-delay: 2s; }

@keyframes reveal {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}


/* ===== TABLES ===== */
.table-container {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  margin-bottom: var(--space-lg);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  background: linear-gradient(135deg, var(--surface-secondary), var(--surface-tertiary));
  color: var(--text-primary);
  font-weight: 600;
  padding: var(--space-md);
  text-align: left;
  border-bottom: 1px solid var(--border-default);
  font-size: var(--font-size-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

td {
  padding: var(--space-md);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

tr:hover td {
  background-color: var(--surface-secondary);
}

tr:last-child td {
  border-bottom: none;
}

/* ===== STATUS INDICATORS ===== */
.status-active, .active, .positive {
  color: var(--success-600);
  font-weight: 600;
}

.status-pending, .pending {
  color: var(--warning-600);
  font-weight: 600;
}

.status-cancelled, .cancelled, .error {
  color: var(--error-600);
  font-weight: 600;
}

/* ===== ALERTS & FEEDBACK ===== */
.alert {
  padding: var(--space-md);
  border-radius: var(--radius-md);
  border: 1px solid;
  margin-bottom: var(--space-lg);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.alert-success {
  background-color: var(--success-50);
  color: var(--success-700);
  border-color: var(--success-200);
}

.alert-warning {
  background-color: var(--warning-50);
  color: var(--warning-700);
  border-color: var(--warning-200);
}

.alert-error {
  background-color: var(--error-50);
  color: var(--error-700);
  border-color: var(--error-200);
}

.alert-info {
  background-color: var(--info-50);
  color: var(--info-700);
  border-color: var(--info-200);
}

#feedback {
  padding: var(--space-md);
  border-radius: var(--radius-md);
  margin: var(--space-md) 0;
  font-weight: 500;
  display: none;
  transition: all var(--transition-normal);
}

#feedback.show {
  display: block;
  animation: slideIn 0.3s ease-out;
}

#feedback.success {
  background-color: var(--success-50);
  color: var(--success-700);
  border: 1px solid var(--success-200);
}

#feedback.error {
  background-color: var(--error-50);
  color: var(--error-700);
  border: 1px solid var(--error-200);
}

#feedback.info {
  background-color: var(--info-50);
  color: var(--info-700);
  border: 1px solid var(--info-200);
}

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

/* ===== LOADING STATES ===== */
.loading {
  position: relative;
  overflow: hidden;
}

.loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  animation: shimmer 1.5s ease-in-out infinite;
}

@keyframes shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
  .container {
    padding: 0 var(--space-md);
  }
  
  .dashboard-container {
    padding: var(--space-lg);
  }
  
  .auth-container {
    margin: 1rem;
    padding: var(--space-lg);
  }
  
  .btn {
    width: 100%;
    justify-content: center;
  }
  
  h1 { font-size: var(--font-size-2xl); }
  h2 { font-size: var(--font-size-xl); }
  h3 { font-size: var(--font-size-lg); }
  
  .table-container {
    overflow-x: auto;
  }
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

.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;
}

/* Focus indicators */
*:focus-visible {
  outline: 2px solid var(--primary-500);
  outline-offset: 2px;
}
