/* ==============================================
   ESTILOS PRINCIPALES Y LAYOUT
   ============================================== */

/* === LAYOUT PRINCIPAL === */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  transition: margin-left var(--transition-base);
}

/* === PAGE HEADER === */
.page-header {
  padding: var(--spacing-xl) var(--spacing-2xl);
  border-bottom: 1px solid var(--border-primary);
  background: var(--bg-primary);
  position: sticky;
  top: 0;
  z-index: 10;
}

.page-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.8px;
  margin-bottom: var(--spacing-sm);
}

.page-subtitle {
  font-size: 15px;
  color: var(--text-muted);
  max-width: 600px;
}

/* === CONTENT SECTION === */
.content-section {
  padding: var(--spacing-2xl);
  max-width: var(--max-width-content);
}

.section-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--spacing-lg);
  letter-spacing: -0.5px;
}

.section-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: var(--spacing-xl);
}

/* === GRID LAYOUTS === */
.grid {
  display: grid;
  gap: var(--spacing-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);
}

/* === FLEX UTILITIES === */
.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.justify-center {
  justify-content: center;
}

.gap-sm {
  gap: var(--spacing-sm);
}

.gap-md {
  gap: var(--spacing-md);
}

.gap-lg {
  gap: var(--spacing-lg);
}

/* === SPACING UTILITIES === */
.p-0 { padding: 0; }
.p-sm { padding: var(--spacing-sm); }
.p-md { padding: var(--spacing-md); }
.p-lg { padding: var(--spacing-lg); }
.p-xl { padding: var(--spacing-xl); }

.m-0 { margin: 0; }
.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }
.mb-xl { margin-bottom: var(--spacing-xl); }

.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }
.mt-xl { margin-top: var(--spacing-xl); }

/* === TEXT UTILITIES === */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent-primary); }

.text-sm { font-size: 13px; }
.text-base { font-size: 14px; }
.text-lg { font-size: 16px; }
.text-xl { font-size: 18px; }

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

.text-center { text-align: center; }
.text-right { text-align: right; }

/* === VISIBILITY === */
.hidden {
  display: none !important;
}

.visible {
  display: block !important;
}

/* === ANÁLISIS DE COMPETENCIA === */
.analysis-form {
  padding: var(--spacing-2xl);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-xl);
}

.form-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl);
}

.panel-icon {
  width: 48px;
  height: 48px;
  background: var(--accent-subtle);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--spacing-lg);
}

.panel-icon svg {
  width: 24px;
  height: 24px;
  color: var(--accent-primary);
}

.panel-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--spacing-md);
}

/* === RESULTS GRID === */
.results-section {
  padding: var(--spacing-2xl);
}

.results-header {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg) var(--spacing-xl);
  margin-bottom: var(--spacing-xl);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.results-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.results-meta {
  font-size: 13px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.results-actions {
  display: flex;
  gap: var(--spacing-md);
}

.competitor-card {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius-lg);
  padding: var(--spacing-xl);
  margin-bottom: var(--spacing-lg);
  transition: all var(--transition-base);
}

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

.competitor-header {
  display: flex;
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-lg);
  padding-bottom: var(--spacing-lg);
  border-bottom: 1px solid var(--border-primary);
}

.competitor-logo {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-md);
  flex-shrink: 0;
}

.competitor-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.competitor-info {
  flex: 1;
  min-width: 0;
}

.competitor-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: var(--spacing-sm);
  letter-spacing: -0.3px;
}

.competitor-meta {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  flex-wrap: wrap;
}

.news-item {
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: var(--spacing-lg);
  margin-bottom: var(--spacing-md);
  border-left: 3px solid var(--border-primary);
  transition: all var(--transition-fast);
}

.news-item:hover {
  background: var(--bg-hover);
  border-left-color: var(--accent-primary);
}

.news-item-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-sm);
}

.news-item-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  flex: 1;
}

.news-item-title a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-fast);
}

.news-item-title a:hover {
  color: var(--accent-primary);
}

.news-item-meta {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: var(--spacing-sm);
}

.news-item-body {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* === RESPONSIVE === */
@media (max-width: 1024px) {
  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .main-content {
    margin-left: 0;
  }
  
  .page-header {
    padding: var(--spacing-lg) var(--spacing-md);
  }
  
  .page-title {
    font-size: 24px;
  }
  
  .content-section,
  .analysis-form,
  .results-section {
    padding: var(--spacing-md);
  }
  
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }
  
  .results-header {
    flex-direction: column;
    gap: var(--spacing-md);
  }
  
  .results-actions {
    width: 100%;
  }
  
  .results-actions .btn {
    flex: 1;
  }
  
  .competitor-header {
    flex-direction: column;
  }
}

/* === ANIMATIONS === */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.3s ease;
}

.fade-in-up {
  animation: fadeInUp 0.4s ease;
}
