/* Dashboard V2 - Executive CMO Style */
/* Filosofía: Edward Tufte - "Menos es más" */

:root {
  /* Colors */
  --black: #0a0a0a;
  --white: #ffffff;
  --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;

  /* Status colors */
  --green: #10b981;
  --green-light: #d1fae5;
  --red: #ef4444;
  --red-light: #fee2e2;
  --yellow: #f59e0b;
  --yellow-light: #fef3c7;
  --gold: #d4af37;

  /* Platform colors */
  --facebook: #1877f2;
  --google: #4285f4;

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

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'SF Mono', 'Monaco', 'Inconsolata', monospace;
}

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

body {
  font-family: var(--font-sans);
  color: var(--black);
  background: var(--white);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Typography */
h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: var(--sp-md);
}

h2 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: var(--sp-md);
}

h3 {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: var(--sp-sm);
}

p {
  color: var(--gray-700);
  font-size: 0.875rem;
}

/* Layout */
.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: var(--sp-xl);
}

/* Navigation */
.nav {
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: var(--sp-md) var(--sp-xl);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--black);
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: var(--sp-lg);
  list-style: none;
}

.nav-link {
  color: var(--gray-600);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.875rem;
  transition: color 0.2s;
  padding: var(--sp-sm) var(--sp-md);
  border-radius: 6px;
}

.nav-link:hover {
  color: var(--black);
  background: var(--gray-50);
}

.nav-link.active {
  color: var(--black);
  background: var(--gray-100);
}

/* Header */
.page-header {
  margin-bottom: var(--sp-2xl);
  padding-bottom: var(--sp-lg);
  border-bottom: 1px solid var(--gray-200);
}

.page-subtitle {
  color: var(--gray-500);
  font-size: 0.875rem;
  margin-top: var(--sp-xs);
}

/* Grid */
.grid {
  display: grid;
  gap: var(--sp-lg);
}

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

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

.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 1024px) {
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }

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

@media (max-width: 640px) {

  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }
}

/* Cards */
.card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: var(--sp-lg);
}

.card-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--sp-sm);
}

/* Metrics */
.metric {
  display: flex;
  flex-direction: column;
  gap: var(--sp-xs);
}

.metric-value {
  font-family: var(--font-mono);
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1;
  color: var(--black);
}

.metric-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metric-change {
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-xs);
}

.metric-change.positive {
  color: var(--green);
}

.metric-change.negative {
  color: var(--red);
}

/* Semaphore/Alert Cards */
.alert {
  padding: var(--sp-md);
  border-radius: 6px;
  border-left: 4px solid;
  font-size: 0.875rem;
}

.alert-critical {
  background: var(--red-light);
  border-color: var(--red);
  color: #991b1b;
}

.alert-warning {
  background: var(--yellow-light);
  border-color: var(--yellow);
  color: #92400e;
}

.alert-success {
  background: var(--green-light);
  border-color: var(--green);
  color: #065f46;
}

.alert-title {
  font-weight: 600;
  margin-bottom: var(--sp-xs);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

thead {
  background: var(--gray-50);
}

th {
  text-align: left;
  font-weight: 600;
  color: var(--gray-700);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--gray-200);
}

td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-900);
}

tr:hover {
  background: var(--gray-50);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
}

.badge-green {
  background: var(--green-light);
  color: #065f46;
}

.badge-red {
  background: var(--red-light);
  color: #991b1b;
}

.badge-yellow {
  background: var(--yellow-light);
  color: #92400e;
}

.badge-gray {
  background: var(--gray-100);
  color: var(--gray-700);
}

.badge-form {
  background: #e0e7ff;
  color: #3730a3;
  margin-right: 4px;
}

.badge-call {
  background: #d1fae5;
  color: #065f46;
}

/* Priority indicators */
.priority {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  font-weight: 600;
}

.priority::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.priority-critical::before {
  background: var(--red);
}

.priority-high::before {
  background: var(--yellow);
}

.priority-medium::before {
  background: var(--green);
}

/* Section */
.section {
  margin-bottom: var(--sp-2xl);
}

.section-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: var(--sp-sm);
  /* Reduced margin to accommodate description */
  display: flex;
  align-items: center;
  gap: var(--sp-sm);
}

.section-description {
  font-size: 0.85rem;
  color: var(--gray-600);
  margin-bottom: var(--sp-lg);
  line-height: 1.5;
  max-width: 800px;
}

/* Utilities */
.text-mono {
  font-family: var(--font-mono);
}

.text-muted {
  color: var(--gray-500);
}

.text-small {
  font-size: 0.75rem;
}

.mb-0 {
  margin-bottom: 0;
}

.mb-sm {
  margin-bottom: var(--sp-sm);
}

.mb-md {
  margin-bottom: var(--sp-md);
}

.mb-lg {
  margin-bottom: var(--sp-lg);
}

.mt-0 {
  margin-top: 0;
}

.mt-sm {
  margin-top: var(--sp-sm);
}

.mt-md {
  margin-top: var(--sp-md);
}

.mt-lg {
  margin-top: var(--sp-lg);
}

/* Tooltips */
.tooltip {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: help;
  margin-left: 8px;
  color: var(--gray-500);
}

.tooltip .tooltip-text {
  display: none;
  width: 280px;
  background-color: #ffffff;
  color: var(--gray-800);
  text-align: left;
  border-radius: 8px;
  padding: 16px;
  position: absolute;
  z-index: 100;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.8125rem;
  line-height: 1.5;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  border: 1px solid var(--gray-200);
}

.tooltip:hover .tooltip-text {
  display: block;
}

.tooltip-text strong {
  color: var(--black);
  display: block;
  margin-bottom: 8px;
  font-size: 0.875rem;
}

.tooltip-text table {
  width: 100%;
  margin-top: 12px;
  border-collapse: collapse;
}

.tooltip-text td {
  border-bottom: 1px solid var(--gray-100);
  padding: 6px 0;
  color: var(--gray-600);
}

.tooltip-text b {
  color: var(--gold);
  font-weight: 700;
}