/* Custom CSS Variables - Modern Curated Palette */
:root {
  --bg-base: #f0f9ff; /* Sky Blue 50 */
  --bg-surface: rgba(255, 255, 255, 0.7);
  --bg-surface-hover: rgba(255, 255, 255, 0.9);
  --border-light: rgba(15, 23, 42, 0.08); /* Slate 900 con opacidad */
  --border-glow: rgba(2, 132, 199, 0.25); /* Sky 600 glow */
  
  --primary: #0284c7; /* Sky 600 */
  --primary-glow: rgba(2, 132, 199, 0.4);
  --secondary: #ea580c; /* Orange 600 for contrast */
  --text-main: #0f172a; /* Slate 900 */
  --text-muted: #475569; /* Slate 600 */
  
  /* Verification badge colors */
  --color-verified: #059669; /* Emerald 600 */
  --color-clickbait: #d97706; /* Amber 600 */
  --color-sensationalist: #dc2626; /* Red 600 */
  --color-opinion: #2563eb; /* Blue 600 */
  --color-unverified: #64748b; /* Slate 500 */
  
  --font-heading: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-base);
  color: var(--text-main);
  font-family: var(--font-body);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Ambient Background Glows */
.bg-glow {
  position: fixed;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  filter: blur(140px);
  z-index: -1;
  opacity: 0.15;
  pointer-events: none;
}

.bg-glow-1 {
  background: #38bdf8; /* Sky 400 */
  top: -100px;
  right: -50px;
}

.bg-glow-2 {
  background: #2dd4bf; /* Teal 400 */
  bottom: -150px;
  left: -100px;
  animation-delay: -2s;
}

/* Layout App Container */
.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: var(--bg-surface);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-light);
  border-radius: 18px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  height: 48px;
  width: auto;
  border-radius: 12px;
  filter: drop-shadow(0 0 8px var(--primary-glow));
}

.brand-text h1 {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--primary);
}

.brand-text span {
  font-size: 11px;
  color: var(--secondary);
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.header-actions {
  display: flex;
  gap: 12px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 12px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, #6d28d9 100%);
  color: #fff;
  border: none;
  box-shadow: 0 4px 14px 0 var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px 0 var(--primary-glow);
  opacity: 0.95;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border: 1px solid var(--border-light);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-main);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border-radius: 50%;
  transition: var(--transition-smooth);
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.08);
}

.full-width {
  width: 100%;
  justify-content: center;
}

.hidden {
  display: none !important;
}

/* Region Selector Styles */
.select-wrapper {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  padding: 0 14px;
  gap: 8px;
  color: var(--text-muted);
  transition: var(--transition-smooth);
}

.select-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
}

.select-wrapper span {
  font-size: 20px;
  color: var(--primary);
}

.select-region {
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13.5px;
  padding: 10px 0;
  padding-right: 28px;
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg fill='%239ca3af' height='20' viewBox='0 0 24 24' width='20' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/><path d='M0 0h24v24H0z' fill='none'/></svg>");
  background-repeat: no-repeat;
  background-position: right center;
}

.select-region:focus {
  outline: none;
}

/* Force light theme compatibility on select option elements in all browsers */
select option {
  background-color: #ffffff !important; /* Light background */
  color: var(--text-main) !important;
  font-family: var(--font-body);
  font-size: 14px;
}

/* Category Navigation */
.categories-nav {
  background: var(--bg-surface);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-light);
  border-radius: 16px;
  padding: 6px;
  overflow-x: auto;
  scrollbar-width: none; /* Hide scrollbar for Firefox */
}

.categories-nav::-webkit-scrollbar {
  display: none; /* Hide scrollbar for Chrome/Safari */
}

.categories-wrapper {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 15px;
  border-radius: 12px;
  cursor: pointer;
  transition: var(--transition-smooth);
}

.nav-item span {
  font-size: 18px;
}

.nav-item:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.nav-item.active {
  color: #fff;
  background: var(--primary);
  font-weight: 600;
  box-shadow: 0 4px 12px 0 var(--primary-glow);
}

/* News Grid Layout */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 20px;
}

/* News Card Styles */
.news-card {
  background: var(--bg-surface);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-light);
  border-radius: 20px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transition: var(--transition-smooth);
  box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.2);
}

.news-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-glow);
  background: var(--bg-surface-hover);
  box-shadow: 0 8px 30px 0 rgba(124, 58, 237, 0.15);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-source {
  background: rgba(204, 164, 59, 0.12);
  color: var(--secondary);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 8px;
  text-transform: uppercase;
}

.card-date {
  font-size: 11px;
  color: var(--text-muted);
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card-title {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--primary);
}

.card-description {
  font-size: 15.5px;
  line-height: 1.7;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-description a {
  color: #a78bfa !important;
  text-decoration: none;
  font-weight: 500;
}

.card-description a:hover {
  color: #c084fc !important;
  text-decoration: underline;
}

.card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: auto;
  border-top: 1px solid var(--border-light);
  padding-top: 16px;
}

.card-link {
  color: var(--secondary);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.card-link:hover {
  text-decoration: underline;
}

/* Listen Button */
.btn-listen {
  background: transparent;
  color: var(--text-main);
  border: 1px solid var(--border-light);
  padding: 8px 12px;
  font-size: 13px;
  gap: 4px;
}

.btn-listen:hover {
  background: rgba(15, 23, 42, 0.05);
}

.btn-listen.playing {
  color: var(--primary);
  border-color: var(--primary);
  background: rgba(2, 132, 199, 0.1);
}

.btn-verify-ai {
  margin-left: auto;
}

/* AI Verification Box (Within Cards) */
.ai-verification-box {
  background: rgba(255, 255, 255, 0.02);
  border: 1px dashed var(--border-light);
  border-radius: 14px;
  padding: 16px;
  margin-top: 8px;
  animation: fadeIn 0.4s ease forwards;
}

/* Verification Badge */
.verif-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 8px;
  margin-bottom: 12px;
}

.verif-badge.badge-verificado {
  background: rgba(16, 185, 129, 0.1);
  color: var(--color-verified);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.verif-badge.badge-clickbait {
  background: rgba(245, 158, 11, 0.1);
  color: var(--color-clickbait);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.verif-badge.badge-sensacionalista {
  background: rgba(239, 68, 68, 0.1);
  color: var(--color-sensationalist);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.verif-badge.badge-opinion {
  background: rgba(59, 130, 246, 0.1);
  color: var(--color-opinion);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.verif-badge.badge-no-verificado {
  background: rgba(107, 114, 128, 0.1);
  color: var(--color-unverified);
  border: 1px solid rgba(107, 114, 128, 0.2);
}

.verif-summary {
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--text-main);
  margin-bottom: 12px;
}

/* Confidence Rating */
.confidence-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.confidence-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
}

.confidence-bar-bg {
  height: 6px;
  background: rgba(15, 23, 42, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.confidence-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease-out;
}

/* Key Facts */
.facts-list {
  padding-left: 18px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Modal / Drawer Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(7, 8, 11, 0.85);
  backdrop-filter: blur(12px);
  z-index: 100;
  display: flex;
  justify-content: flex-end; /* Slider drawer right style */
  opacity: 0;
  visibility: hidden;
  transition: var(--transition-smooth);
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  width: 100%;
  max-width: 460px;
  height: 100%;
  background: #0d0f17;
  border-left: 1px solid var(--border-light);
  padding: 40px 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  transform: translateX(100%);
  transition: var(--transition-smooth);
}

.modal-overlay.open .modal-content {
  transform: translateX(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 32px;
  overflow-y: auto;
  flex-grow: 1;
}

/* Forms */
.form-add-source {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-light);
  padding: 20px;
  border-radius: 16px;
}

.form-add-source h3 {
  font-size: 15px;
  font-weight: 600;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.form-group input, .form-group select {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 10px 14px;
  color: #fff;
  font-family: var(--font-body);
  font-size: 13px;
  transition: var(--transition-smooth);
}

.form-group input:focus, .form-group select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 8px var(--primary-glow);
}

/* Sources List */
.sources-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.source-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-light);
  border-radius: 12px;
}

.source-info h4 {
  font-size: 13px;
  font-weight: 600;
}

.source-info span {
  font-size: 11px;
  color: var(--text-muted);
}

/* Empty & Loading States */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  gap: 12px;
}

.empty-state span {
  font-size: 48px;
  color: var(--border-glow);
}

/* Skeleton loader anim */
.skeleton-card {
  height: 280px;
  background: linear-gradient(90deg, #161824 25%, #24283b 50%, #161824 75%);
  background-size: 200% 100%;
  animation: loadingShimmer 1.5s infinite;
  border-radius: 20px;
}

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

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

/* Responsive Styles */
@media (max-width: 768px) {
  .app-header {
    flex-direction: column;
    gap: 16px;
    align-items: stretch;
    padding: 16px;
  }
  
  .brand {
    justify-content: center;
  }

  .header-actions {
    justify-content: center;
  }
  
  .news-grid {
    grid-template-columns: 1fr;
  }
}

/* Desktop Scale Uprades (Readability & Layout spacing for big screens) */
@media (min-width: 1024px) {
  .app-container {
    max-width: 1350px;
    padding: 30px 40px;
    gap: 32px;
  }

  .brand-text h1 {
    font-size: 28px;
  }

  .brand-logo {
    height: 54px;
  }

  .nav-item {
    font-size: 16px;
    padding: 12px 20px;
  }

  .news-grid {
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 28px;
  }

  .news-card {
    padding: 30px;
    gap: 20px;
  }

  .card-title {
    font-size: 24px;
    line-height: 1.35;
  }

  .card-description {
    font-size: 16px;
    line-height: 1.7;
  }

  .ai-verification-box {
    padding: 20px;
  }

  .verif-summary {
    font-size: 15px;
  }

  .facts-list {
    font-size: 13px;
  }
}
