/* Golondrinas Diarieras - Dark Theme Main CSS */
:root {
  --bg-primary: #0f1117;
  --bg-secondary: #1a1d26;
  --bg-card: #1e2230;
  --bg-hover: #262b3d;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --accent-gold: #fbbf24;
  --accent-glow: rgba(251, 191, 36, 0.15);
  --accent-blue: #38bdf8;
  --border-color: #2e3447;
  --card-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --font-family: 'Outfit', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* Header */
.app-header {
  background: rgba(26, 29, 38, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border-color);
  padding: 12px 16px;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.brand-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-icon {
  font-size: 1.8rem;
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 8px rgba(251, 191, 36, 0.3));
}

.brand-title {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #ffffff 30%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.install-pwa-btn {
  display: none;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #d97706, #b45309);
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.3);
  transition: all 0.2s ease;
}

.install-pwa-btn:active {
  transform: scale(0.96);
}

/* Search Box */
.search-box {
  position: relative;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1rem;
}

.search-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 10px 14px 10px 40px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  outline: none;
  transition: all 0.2s ease;
}

.search-input:focus {
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Category Tabs Scrollbar */
.category-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  padding-right: 20px; /* Asegura visualización completa del último tab al hacer scroll */
  scrollbar-width: none;
}

.category-bar::-webkit-scrollbar {
  display: none;
}

.category-tab {
  white-space: nowrap;
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.category-tab:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.category-tab.active {
  background: linear-gradient(135deg, #fbbf24, #d97706);
  color: #0f1117;
  border-color: #fbbf24;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(251, 191, 36, 0.25);
}

/* Main Container */
.main-content {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 16px;
  flex: 1;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.section-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Newspaper Grid */
.newspapers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* Newspaper Card Layout */
.newspaper-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-decoration: none;
  color: var(--text-main);
  position: relative;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

.newspaper-card:active {
  cursor: grabbing;
}

.newspaper-card.dragging {
  opacity: 0.4;
  transform: scale(0.95);
  border: 2px dashed var(--accent-gold);
}

.newspaper-card.dragging-touch {
  opacity: 0.75;
  transform: scale(0.98);
}

.newspaper-card.drag-placeholder {
  opacity: 0.25;
  border: 2px dashed var(--text-muted) !important;
  background: transparent !important;
  box-shadow: none !important;
}

.newspaper-card.touch-dragging-active {
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6) !important;
  border-color: var(--accent-gold) !important;
}

.newspaper-card.drag-over {
  border-color: var(--accent-gold);
  background: var(--bg-hover);
  transform: translateY(-4px);
  box-shadow: 0 0 16px var(--accent-glow);
}

.newspaper-header-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Ampliación de área táctil según directrices WCAG (Mínimo 44px de área de clic) */
.fav-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(0, 0, 0, 0.4);
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 2;
}

.fav-btn.active {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.2);
}

.newspaper-logo-wrapper {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #151821;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), inset 0 0 0 1px rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.newspaper-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
}

.newspaper-logo-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
}

.newspaper-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.newspaper-name {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
}

.newspaper-badge {
  font-size: 0.7rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 2px 8px;
  border-radius: 10px;
  width: fit-content;
}

/* Headlines List Section */
.headlines-container {
  border-top: 1px dashed var(--border-color);
  padding-top: 10px;
}

/* Animación para el esqueleto de carga */
@keyframes pulseSkeleton {
  0% { opacity: 0.4; }
  50% { opacity: 0.9; }
  100% { opacity: 0.4; }
}

.headline-skeleton {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
  animation: pulseSkeleton 1.5s infinite ease-in-out;
  display: flex;
  align-items: center;
  gap: 6px;
}

.headlines-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.headline-item {
  line-height: 1.3;
}

.headline-link {
  color: #cbd5e1;
  font-size: 0.82rem;
  text-decoration: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 0.15s ease;
  -webkit-user-select: text;
  user-select: text;
}

.headline-link:hover {
  color: var(--accent-gold);
  text-decoration: underline;
}

.headline-fallback {
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 0;
}

.headline-fallback:hover {
  color: var(--accent-gold);
}

.app-footer {
  text-align: center;
  padding: 24px 16px;
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 20px;
}
