/**
 * YetiForce CRM Dashboard - Design System
 * Natural Color Palette & Component Tokens
 * Following CLAUDE.md Guidelines (NO EMOJIS, Natural Colors, Full Borders)
 */

/* ============================================
   1. CSS CUSTOM PROPERTIES (TOKENS)
   ============================================ */

:root {
  /* === EARTH TONES === */
  --earth-900: #2C2416;
  --earth-800: #3D3426;
  --earth-700: #54483A;
  --earth-600: #6B5D4F;
  --earth-500: #8B7865;

  /* === SAGE GREENS === */
  --sage-700: #5A6C57;
  --sage-600: #7A8F76;
  --sage-500: #9BAF96;
  --sage-400: #BFD0BA;

  /* === CLAY ACCENTS === */
  --clay-700: #B85C50;
  --clay-600: #D17A6F;
  --clay-500: #E09B92;

  /* === SAND TONES === */
  --sand-600: #C9B59A;
  --sand-500: #E3D3BC;
  --sand-400: #F0E6D6;

  /* === STONE NEUTRALS === */
  --stone-50: #FAFAF9;
  --stone-100: #F5F5F3;
  --stone-200: #E8E7E3;
  --stone-300: #D4D2CC;
  --stone-400: #A8A59E;
  --stone-500: #78756F;
  --stone-600: #5C5A56;
  --stone-700: #42413E;

  /* === SEMANTIC COLORS === */
  --success: #7A8F76;
  --warning: #D8A558;
  --error: #B85C50;
  --info: #6B8E9E;

  /* === BACKGROUNDS === */
  --bg-primary: #FFFFFF;
  --bg-secondary: var(--stone-50);
  --bg-tertiary: var(--stone-100);
  --bg-hover: rgba(122, 143, 118, 0.05);
  --bg-active: rgba(122, 143, 118, 0.1);

  /* === BORDERS === */
  --border-light: var(--stone-200);
  --border-base: var(--stone-300);
  --border-strong: var(--stone-400);
  --border-accent: var(--sage-600);
  --border-width-thin: 0.8px;
  --border-width-base: 1px;
  --border-width-thick: 1.5px;

  /* === BORDER RADIUS === */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-2xl: 16px;
  --radius-full: 9999px;

  /* === SHADOWS (SUBTLE, NATURAL) === */
  --shadow-xs: 0 1px 2px rgba(44, 36, 22, 0.04);
  --shadow-sm: 0 1px 3px rgba(44, 36, 22, 0.06), 0 1px 2px rgba(44, 36, 22, 0.03);
  --shadow-md: 0 4px 6px rgba(44, 36, 22, 0.05), 0 2px 4px rgba(44, 36, 22, 0.03);
  --shadow-lg: 0 10px 15px rgba(44, 36, 22, 0.06), 0 4px 6px rgba(44, 36, 22, 0.03);
  --shadow-xl: 0 20px 25px rgba(44, 36, 22, 0.08), 0 10px 10px rgba(44, 36, 22, 0.02);

  /* === 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 */

  /* === TYPOGRAPHY === */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --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 */

  --weight-light: 300;
  --weight-normal: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  --line-tight: 1.25;
  --line-normal: 1.5;
  --line-relaxed: 1.75;

  /* === TRANSITIONS === */
  --transition-fast: 0.15s ease-out;
  --transition-base: 0.2s ease-out;
  --transition-slow: 0.3s ease-in-out;

  /* === Z-INDEX === */
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;

  /* === LAYOUT === */
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 60px;
  --header-height: 60px;
  --max-content-width: 1600px;
}

/* ============================================
   2. DARK THEME
   ============================================ */

[data-theme="dark"] {
  --bg-primary: var(--earth-900);
  --bg-secondary: var(--earth-800);
  --bg-tertiary: var(--earth-700);
  --bg-hover: rgba(122, 143, 118, 0.08);
  --bg-active: rgba(122, 143, 118, 0.15);

  --border-light: var(--earth-700);
  --border-base: var(--earth-600);
  --border-strong: var(--earth-500);

  --text-primary: var(--stone-50);
  --text-secondary: var(--stone-300);
  --text-tertiary: var(--stone-400);
}

/* ============================================
   3. BASE STYLES
   ============================================ */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-sm);
  line-height: var(--line-normal);
  color: var(--earth-900);
  background-color: var(--bg-secondary);
  overflow-x: hidden;
}

/* Remove default focus outline, add custom */
*:focus {
  outline: none;
}

/* ============================================
   4. TYPOGRAPHY
   ============================================ */

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--weight-semibold);
  line-height: var(--line-tight);
  color: var(--earth-900);
  margin-bottom: var(--space-3);
}

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

p {
  margin-bottom: var(--space-3);
  color: var(--stone-600);
}

a {
  color: var(--sage-600);
  text-decoration: none;
  transition: all var(--transition-fast);
}

a:hover {
  opacity: 0.8;
}

code, pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

/* ============================================
   5. BUTTONS (ALL NECESSARY ANIMATIONS)
   ============================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  border: var(--border-width-base) solid transparent;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
  user-select: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Primary Button */
.btn-primary {
  background-color: var(--sage-600);
  color: #FFFFFF;
  border-color: var(--sage-600);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  filter: brightness(1.05);
}

.btn-primary:active {
  transform: scale(0.98) translateY(0);
  box-shadow: var(--shadow-sm);
}

/* Secondary Button */
.btn-secondary {
  background-color: #FFFFFF;
  color: var(--sage-600);
  border-color: var(--sage-600);
}

.btn-secondary:hover {
  background-color: var(--bg-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:active {
  transform: scale(0.98);
}

/* Danger Button */
.btn-danger {
  background-color: var(--clay-700);
  color: #FFFFFF;
  border-color: var(--clay-700);
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  filter: brightness(1.05);
}

/* Ghost Button */
.btn-ghost {
  background-color: transparent;
  color: var(--earth-700);
  border-color: transparent;
}

.btn-ghost:hover {
  background-color: var(--bg-hover);
}

/* Button Sizes */
.btn-sm {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
}

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

/* Icon-only Button */
.btn-icon {
  padding: var(--space-2);
  width: 2.25rem;
  height: 2.25rem;
}

/* ============================================
   6. INPUTS (WITH ANIMATIONS)
   ============================================ */

.input,
.select,
.textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-sm);
  font-family: var(--font-sans);
  color: var(--earth-900);
  background-color: #FFFFFF;
  border: var(--border-width-base) solid var(--border-base);
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: var(--border-strong);
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--sage-600);
  box-shadow: 0 0 0 3px rgba(122, 143, 118, 0.15);
}

.input:disabled,
.select:disabled,
.textarea:disabled {
  background-color: var(--stone-100);
  color: var(--stone-500);
  cursor: not-allowed;
}

.input-error {
  border-color: var(--clay-700);
}

.input-error:focus {
  border-color: var(--clay-700);
  box-shadow: 0 0 0 3px rgba(184, 92, 80, 0.15);
}

.textarea {
  min-height: 100px;
  resize: vertical;
}

/* Input with icon */
.input-wrapper {
  position: relative;
}

.input-icon {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--stone-400);
  pointer-events: none;
}

.input-wrapper .input {
  padding-left: 2.5rem;
}

/* ============================================
   7. CARDS (WITH HOVER EFFECTS)
   ============================================ */

.card {
  background-color: var(--bg-primary);
  border: var(--border-width-base) solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
}

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

.card-compact {
  padding: var(--space-4);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: var(--border-width-base) solid var(--border-light);
}

.card-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--earth-900);
  margin: 0;
}

.card-body {
  font-size: var(--text-sm);
  line-height: var(--line-normal);
}

.card-footer {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: var(--border-width-base) solid var(--border-light);
}

/* ============================================
   8. BADGES & STATUS INDICATORS
   ============================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  border-radius: var(--radius-full);
  white-space: nowrap;
}

.badge-success {
  background-color: rgba(122, 143, 118, 0.15);
  color: var(--success);
}

.badge-warning {
  background-color: rgba(216, 165, 88, 0.15);
  color: var(--warning);
}

.badge-error {
  background-color: rgba(184, 92, 80, 0.15);
  color: var(--error);
}

.badge-info {
  background-color: rgba(107, 142, 158, 0.15);
  color: var(--info);
}

.badge-neutral {
  background-color: var(--stone-100);
  color: var(--stone-600);
}

/* Status Dot */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  display: inline-block;
}

.status-dot-success { background-color: var(--success); }
.status-dot-warning { background-color: var(--warning); }
.status-dot-error { background-color: var(--error); }
.status-dot-info { background-color: var(--info); }

/* ============================================
   9. LOADING & SKELETON
   ============================================ */

.skeleton {
  background: linear-gradient(90deg, var(--stone-100) 25%, var(--stone-200) 50%, var(--stone-100) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-md);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.spinner {
  width: 1.5rem;
  height: 1.5rem;
  border: 2px solid var(--stone-200);
  border-top-color: var(--sage-600);
  border-radius: var(--radius-full);
  animation: spin 0.6s linear infinite;
}

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

/* ============================================
   10. UTILITY CLASSES
   ============================================ */

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

/* Grid */
.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* Text */
.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-center { text-align: center; }
.text-right { text-align: right; }

/* Colors */
.text-primary { color: var(--earth-900); }
.text-secondary { color: var(--stone-600); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-error { color: var(--error); }

/* Spacing */
.m-0 { margin: 0; }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }

/* Display */
.hidden { display: none; }
.block { display: block; }
.inline-block { display: inline-block; }

/* Misc */
.cursor-pointer { cursor: pointer; }
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
