/**
 * BASE.CSS - Sistema de Design IAMKT
 * Design system base para a plataforma IAMKT
 */

/* ========================================
   1. VARIÁVEIS CSS (Design Tokens)
   ======================================== */

:root {
  /* ========================================
     PALETA BASE (Raw Colors)
     Cores brutas para referência interna
     ======================================== */
  --color-purple-600: #7a3d8a;
  --color-purple-500: #9b59b6;
  --color-purple-100: #b6e1f3;
  
  --color-teal-500: #7ab2ca;
  --color-teal-600: #00bca4;
  
  --color-gray-50: #f5f5f7;
  --color-gray-500: #77767c;
  --color-gray-900: #34343a;
  
  --color-white: #ffffff;
  --color-black: #000000;
  
  /* ========================================
     CORES SEMÂNTICAS (Design Tokens)
     Use estas variáveis nos componentes
     ======================================== */
  --color-primary: var(--color-purple-600);
  --color-primary-hover: var(--color-purple-500);
  --color-primary-light: var(--color-purple-100);
  
  --color-secondary: var(--color-teal-500);
  --color-accent: var(--color-teal-600);
  
  --color-text: var(--color-gray-900);
  --color-text-muted: var(--color-gray-500);
  --color-text-inverse: var(--color-white);
  
  --color-background: var(--color-white);
  --color-surface: var(--color-gray-50);
  --color-surface-dark: var(--color-gray-900);
  
  /* Estados */
  --color-success: #22c55e;
  --color-warning: #f59e0b;
  --color-error: #ef4444;
  --color-info: #3b82f6;
  
  /* ========================================
     OPACIDADES (Overlays, borders, backgrounds)
     ======================================== */
  --white-90: rgba(255, 255, 255, 0.9);
  --white-50: rgba(255, 255, 255, 0.5);
  --white-20: rgba(255, 255, 255, 0.2);
  --white-10: rgba(255, 255, 255, 0.1);
  --white-05: rgba(255, 255, 255, 0.05);
  
  /* ========================================
     COMPATIBILIDADE (Deprecated - remover gradualmente)
     Mantido temporariamente para não quebrar código existente
     ======================================== */
  --iamkt-purple: var(--color-primary);
  --iamkt-purple-soft: var(--color-primary-light);
  --iamkt-green: var(--color-secondary);
  --iamkt-rose-soft: var(--color-primary-light);
  --iamkt-white: var(--color-white);
  --iamkt-gray-light: var(--color-surface);
  --iamkt-gray: var(--color-text-muted);
  --iamkt-gray-dark: var(--color-text);
  
  /* Femme design system compatibility */
  --femme-warning: var(--color-warning);
  --femme-error: var(--color-error);
  --femme-danger: var(--color-error);
  --femme-bg-alt: var(--color-surface);
  --femme-border: #e5e7eb;

  /* Sombras */
  --shadow-soft: 0 18px 40px rgba(20, 5, 36, 0.08);
  --shadow-subtle: 0 10px 24px rgba(20, 5, 36, 0.05);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

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

/* Card variants */
.card-warning {
  border-color: var(--femme-warning);
}

/* Text colors */
.text-warning {
  color: var(--femme-warning);
}

/* Background utilities */
.bg-alt {
  background: var(--femme-bg-alt);
}

/* Progress bars */
.progress-bar {
  width: 100%;
  background-color: #e5e7eb;
  border-radius: 9999px;
  height: 0.375rem;
}

.progress-fill {
  height: 0.375rem;
  border-radius: 9999px;
}

.progress-fill-success {
  background-color: var(--color-primary);
}

.progress-fill-warning {
  background-color: #eab308;
}

.progress-fill-danger {
  background-color: #ef4444;
}

/* Text utilities */
.text-muted-center {
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  text-align: center;
}

.text-muted-spaced {
  color: var(--color-text-muted);
  margin-top: var(--spacing-2);
}

:root {
  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-pill: 999px;

  /* Espaçamentos */
  --spacing-1: 0.25rem;
  --spacing-2: 0.5rem;
  --spacing-3: 0.75rem;
  --spacing-4: 1rem;
  --spacing-5: 1.25rem;
  --spacing-6: 1.5rem;
  --spacing-8: 2rem;
  --spacing-10: 2.5rem;
  --spacing-12: 3rem;

  /* Tipografia */
  --font-family: "Quicksand", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-size-xs: 0.625rem;   /* 10px */
  --font-size-sm: 0.6875rem;  /* 11px */
  --font-size-base: 0.75rem;  /* 12px */
  --font-size-md: 0.8125rem;  /* 13px */
  --font-size-lg: 0.875rem;   /* 14px */
  --font-size-xl: 0.9375rem;  /* 15px */
  --font-size-2xl: 1rem;      /* 16px */
  --font-size-3xl: 1.375rem;  /* 22px */

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

  --max-width: 1280px;
  --transition-base: 0.15s ease;
}

/* ========================================
   2. RESET CSS
   ======================================== */

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  background:
    radial-gradient(circle at top left, color-mix(in srgb, var(--color-primary) 8%, transparent), transparent 55%),
    radial-gradient(circle at bottom right, color-mix(in srgb, var(--color-accent) 6%, transparent), transparent 55%);
  color: var(--color-text);
  line-height: 1.5;
  min-height: 100vh;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
}

/* ========================================
   3. CLASSES UTILITÁRIAS
   ======================================== */

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

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

/* Spacing */
.mb-2 { margin-bottom: var(--spacing-2); }
.mb-3 { margin-bottom: var(--spacing-3); }
.mb-4 { margin-bottom: var(--spacing-4); }
.mb-6 { margin-bottom: var(--spacing-6); }
.mb-8 { margin-bottom: var(--spacing-8); }
.mt-2 { margin-top: var(--spacing-2); }
.mt-3 { margin-top: var(--spacing-3); }
.mt-4 { margin-top: var(--spacing-4); }
.mt-6 { margin-top: var(--spacing-6); }

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

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

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

/* Deprecated - usar .text-primary */
.text-purple { color: var(--color-primary); }

/* Outros */
.w-full { width: 100%; }
.transition-fast { transition: all var(--transition-base); }

/* Gradientes */
.bg-gradient-primary {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark, #2563eb) 100%);
}

.bg-gradient-blue {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

/* Content Blocks */
.content-block {
  background: white;
  border: 1px solid var(--color-border, #e5e7eb);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.block-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 1.5rem 0;
  color: var(--color-text, #111827);
}

/* Padrão visual unificado para formulários */
.form-input-filter {
  width: 100%;
  height: 44px; /* Altura fixa para todos os campos */
  padding: 0 16px;
  background: #ffffff;
  border: 1px solid #e5e7eb; /* Borda unificada de 1px */
  border-radius: 8px; /* Border-radius consistente */
  color: #374151;
  font-size: 14px;
  font-weight: 400;
  font-family: "Quicksand", system-ui, sans-serif;
  transition: all 0.2s ease;
  box-sizing: border-box;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

/* Textarea com mesmo estilo */
.form-input-filter[type="textarea"],
textarea.form-input-filter {
  height: auto;
  min-height: 100px;
  padding: 12px 16px;
  resize: vertical;
  line-height: 1.5;
}

/* Estilo específico para input type="date" */
.form-input-filter[type="date"] {
  cursor: pointer;
  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 2v3m0 0v3m0-3h6m-6 0H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V7a2 2 0 00-2-2h-2m-6 0V7m6-3v3'/%3e%3c/svg%3e");
  background-position: right 12px center;
  background-repeat: no-repeat;
  background-size: 16px;
  padding-right: 40px;
}

/* Remove setas do Chrome/Safari */
.form-input-filter[type="date"]::-webkit-calendar-picker-indicator {
  opacity: 0;
  cursor: pointer;
}

.form-input-filter[type="date"]::-webkit-inner-spin-button,
.form-input-filter[type="date"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.form-input-filter::placeholder {
  color: #9ca3af;
  font-weight: 400;
}

.form-input-filter:focus {
  outline: none;
  border-color: #3b82f6;
  background: #ffffff;
  color: #1f2937;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-input-filter:hover {
  border-color: #d1d5db;
}

/* Wrapper para inputs com ícones */
.form-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.form-input-wrapper .form-input-filter {
  padding-right: 44px; /* Espaço para ícone */
}

.form-input-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #9ca3af;
  pointer-events: none;
  font-size: 14px;
  z-index: 1;
}

/* Labels unificados */
.form-label {
  display: block;
  margin-bottom: 6px;
  color: #374151;
  font-size: 14px;
  font-weight: 500;
  font-family: "Quicksand", system-ui, sans-serif;
}

.form-label i {
  font-size: 12px;
  opacity: 0.7;
  margin-right: 4px;
}

/* Título de bloco */
.block-title {
  font-size: 16px;
  font-weight: 600;
  color: #374151;
  margin: 0;
  padding: 0;
  font-family: "Quicksand", system-ui, sans-serif;
}

/* Campos do modal */
.field {
  margin-bottom: 20px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  color: #374151;
  font-size: 14px;
  font-weight: 500;
  font-family: "Quicksand", system-ui, sans-serif;
}

.field label i {
  font-size: 12px;
  opacity: 0.7;
  margin-right: 4px;
}

.field .text-danger {
  color: #ef4444;
  margin-left: 2px;
}

.field-hint {
  margin-top: 4px;
  font-size: 12px;
  color: #6b7280;
  line-height: 1.4;
}

/* Botões unificados */
.btn {
  height: 44px; /* Mesma altura dos inputs */
  padding: 0 20px;
  border-radius: 8px; /* Mesmo border-radius */
  font-size: 14px;
  font-weight: 500;
  font-family: "Quicksand", system-ui, sans-serif;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-sizing: border-box;
  vertical-align: middle;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.btn-primary {
  background: #3b82f6;
  color: white;
}

.btn-outline-secondary {
  background: white;
  color: #6b7280;
  border: 1px solid #e5e7eb; /* Borda de 1px como os inputs */
}

.btn-outline-secondary:hover {
  border-color: #d1d5db;
  background: #f9fafb;
}

/* Header estilo perfil */
.perfil-header {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  padding: 3rem 2rem;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Modal header com posicionamento correto */
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px;
  border-bottom: 1px solid #e5e7eb;
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 600;
  color: #374151;
  margin: 0;
  font-family: "Quicksand", system-ui, sans-serif;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #6b7280;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.15s ease;
  margin-left: auto;
}

.modal-close:hover {
  background: #f3f4f6;
  color: #374151;
}

.perfil-header .header-content {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 2rem;
}

.perfil-header .header-text {
  flex: 1;
}

.perfil-header .header-actions {
  flex-shrink: 0;
}

/* Responsivo */
@media (min-width: 768px) {
  .md\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

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