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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
  background: #0f0f0f;
  color: #e0e0e0;
  min-height: 100vh;
}

#app {
  max-width: 860px;
  margin: 0 auto;
  padding: 16px;
}

header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #0f0f0f;
  padding: 16px 0 12px;
  border-bottom: 1px solid #1f1f1f;
  margin-bottom: 16px;
}

h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: #fff;
}

.stats-bar {
  display: flex;
  gap: 16px;
  font-size: 0.8rem;
  color: #888;
  margin-bottom: 10px;
}

.stat.unread {
  color: #f0a030;
}

.stat.today {
  color: #4ade80;
}

/* ---- Toolbar (import/export) ---- */
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.toolbar-btn {
  padding: 5px 12px;
  border-radius: 8px;
  border: 1px solid #2a2a2a;
  background: #181818;
  color: #999;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.toolbar-btn:hover {
  border-color: #444;
  color: #ccc;
}

.toolbar-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.export-btn:hover {
  border-color: #4ade80;
  color: #4ade80;
}

.import-btn:hover {
  border-color: #60a5fa;
  color: #60a5fa;
}

.notify-btn:hover {
  border-color: #f0a030;
  color: #f0a030;
}

.notify-btn.on {
  border-color: #4ade80;
  color: #4ade80;
}

.notify-btn.blocked {
  border-color: #f87171;
  color: #f87171;
}

/* ---- Toast ---- */
.toast {
  font-size: 0.78rem;
  padding: 5px 12px;
  border-radius: 8px;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  white-space: nowrap;
}
.toast.show { opacity: 1; }
.toast.success { color: #4ade80; }
.toast.error   { color: #f87171; }
.toast.info    { color: #60a5fa; }

#search {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid #2a2a2a;
  background: #1a1a1a;
  color: #e0e0e0;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s;
  margin-bottom: 10px;
}

#search:focus {
  border-color: #4ade80;
}

/* ---- Filters ---- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 4px;
}

.filter-group {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-btn {
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid #2a2a2a;
  background: #181818;
  color: #888;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.filter-btn:hover {
  border-color: #444;
  color: #ccc;
}

.filter-btn.active {
  background: #2a2a2a;
  border-color: #555;
  color: #fff;
}

/* ---- Posts ---- */
#posts-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.loading, .empty, .error {
  text-align: center;
  padding: 56px 16px;
  color: #666;
  font-size: 1rem;
}

/* ---- Skeleton Loader ---- */
.post.skeleton { animation: skPulse 1.5s ease-in-out infinite; pointer-events: none; }
@keyframes skPulse { 0%,100%{opacity:.4} 50%{opacity:.7} }
.sk-line { background: #2a2a2a; border-radius: 6px; margin-bottom: 10px; }
.sk-title { height: 20px; width: 60%; }
.sk-meta  { height: 14px; width: 35%; margin-bottom: 14px; }
.sk-body  { height: 14px; width: 90%; }
.sk-body.short { width: 50%; }

.error {
  color: #f87171;
}

.post {
  background: #1a1a1a;
  border-radius: 14px;
  padding: 20px;
  border: 1px solid #222;
  transition: border-color 0.2s, opacity 0.3s, transform 0.3s ease;
  animation: postFadeIn 0.3s ease both;
}

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

/* Deleting animation */
.post.deleting {
  animation: postSlideOut 0.25s ease both;
  pointer-events: none;
}

@keyframes postSlideOut {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(30px); }
}

/* Read toggle transition */
.post.transitioning {
  transition: opacity 0.2s ease, transform 0.2s ease;
  opacity: 0.6;
  transform: scale(0.98);
}

.post.unread {
  border-left: 4px solid #f0a030;
}

.post.highlight {
  border-color: #4ade80;
  box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.25);
}

.post.read {
  opacity: 0.5;
}

.post.read:hover {
  opacity: 0.85;
}

/* ---- Title takes full width, date below ---- */
.post-header {
  display: block;
  margin-bottom: 8px;
}

.post-title {
  font-size: 1.1rem;
  font-weight: 650;
  color: #fff;
  line-height: 1.45;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.post-category-tag {
  display: inline-block;
  font-size: 0.7rem;
  padding: 1px 8px;
  border-radius: 5px;
  background: #1a3a2a;
  color: #4ade80;
  cursor: pointer;
  transition: all 0.15s ease;
}

.post-category-tag:hover {
  background: #1f4f3f;
  color: #6ee8a0;
}

.post-date {
  font-size: 0.72rem;
  color: #555;
  cursor: default;
}

/* ---- Content ---- */
.post-content {
  margin-top: 10px;
  font-size: 0.95rem;
  line-height: 1.7;
  color: #c0c0c0;
  transition: opacity 0.3s ease;
}

.post-content.collapsed {
  position: relative;
}

.post-content.collapsed::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40px;
  background: linear-gradient(transparent, #1a1a1a);
  pointer-events: none;
}

.post-content.expanded {
  opacity: 1;
}

/* ---- Expand / Collapse Button ---- */
.expand-btn {
  display: inline-block;
  margin-top: 6px;
  padding: 0;
  background: none;
  border: none;
  color: #60a5fa;
  font-size: 0.85rem;
  cursor: pointer;
  transition: color 0.15s ease;
  font-family: inherit;
}

.expand-btn:hover {
  color: #93c5fd;
  text-decoration: underline;
}

.expand-btn.expanded {
  display: block;
  margin-top: 8px;
}

.post-image {
  margin: 12px 0 10px;
  border-radius: 10px;
  overflow: hidden;
  max-height: 340px;
  background: #111;
}

.post-image img {
  width: 100%;
  height: auto;
  max-height: 340px;
  object-fit: cover;
  display: block;
  border-radius: 10px;
}

/* ---- Tags below content ---- */
.post-tags {
  margin-top: 8px;
}

.tag {
  display: inline-block;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 6px;
  background: #252525;
  color: #999;
  margin: 3px 4px 0 0;
}

/* ---- Actions ---- */
.post-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  align-items: center;
}

.source-link {
  font-size: 0.82rem;
  color: #60a5fa;
  text-decoration: none;
}

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

.read-btn {
  font-size: 0.78rem;
  padding: 5px 14px;
  border-radius: 8px;
  border: 1px solid #333;
  background: transparent;
  color: #999;
  cursor: pointer;
  transition: all 0.2s;
}

.read-btn:hover {
  background: #2a2a2a;
  color: #fff;
  border-color: #555;
}

/* ---- Delete Button ---- */
.delete-btn {
  background: transparent;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  opacity: 0.4;
  transition: all 0.2s;
  line-height: 1;
  margin-left: auto;
}

.delete-btn:hover {
  opacity: 1;
  background: #2a1a1a;
}

/* ---- Confirm Modal ---- */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0,0,0,0.7);
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}

.modal-box {
  background: #1c1c1c;
  border: 1px solid #2a2a2a;
  border-radius: 16px;
  padding: 28px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.modal-message {
  font-size: 1rem;
  color: #e0e0e0;
  margin-bottom: 24px;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.modal-btn {
  padding: 8px 20px;
  border-radius: 10px;
  border: 1px solid #333;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s;
}

.modal-cancel {
  background: transparent;
  color: #999;
}

.modal-cancel:hover {
  background: #2a2a2a;
  color: #fff;
}

.modal-danger {
  background: #3a1a1a;
  border-color: #5a2a2a;
  color: #f87171;
}

.modal-danger:hover {
  background: #5a2a2a;
  border-color: #8a3a3a;
  color: #fff;
}

/* ---- Pagination ---- */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  padding: 24px 0;
  margin-top: 8px;
}

.pagination button {
  padding: 8px 18px;
  border-radius: 8px;
  border: 1px solid #333;
  background: #1a1a1a;
  color: #ccc;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.pagination button:hover:not(:disabled) {
  background: #2a2a2a;
  border-color: #555;
  color: #fff;
}

.pagination button:disabled {
  opacity: 0.3;
  cursor: default;
}

#page-info {
  font-size: 0.8rem;
  color: #666;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: #0f0f0f;
}
::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 3px;
}

@media (max-width: 550px) {
  #app {
    padding: 10px;
  }
  .post {
    padding: 14px;
  }
  .post-title {
    font-size: 0.95rem;
  }
  .post-content {
    font-size: 0.88rem;
  }
  .filters {
    gap: 6px;
  }
  .filter-btn {
    font-size: 0.7rem;
    padding: 3px 8px;
  }
  .toolbar-btn {
    font-size: 0.72rem;
    padding: 4px 10px;
  }
  .toast {
    font-size: 0.7rem;
    width: 100%;
    white-space: normal;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---- Tabs (Noticias / Mapa) ---- */
.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.tab {
  padding: 7px 16px;
  border-radius: 10px;
  border: 1px solid #2a2a2a;
  background: #181818;
  color: #888;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.tab:hover {
  border-color: #444;
  color: #ccc;
}

.tab.active {
  background: #2a2a2a;
  border-color: #555;
  color: #fff;
}

/* ---- Mapa ---- */
#map-view {
  margin-top: 4px;
}

.map-summary {
  font-size: 0.8rem;
  color: #888;
  margin-bottom: 10px;
}

.map-summary strong {
  color: #4ade80;
}

#world-map {
  width: 100%;
  height: 440px;
  background: #111;
  border: 1px solid #222;
  border-radius: 14px;
  overflow: hidden;
}

.map-panel {
  margin-top: 14px;
  background: #1a1a1a;
  border: 1px solid #222;
  border-radius: 14px;
  padding: 16px 20px;
}

.map-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.map-panel-header h2 {
  font-size: 1rem;
  font-weight: 650;
  color: #fff;
  margin: 0;
}

.map-panel-close {
  background: transparent;
  border: none;
  color: #666;
  font-size: 1rem;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.15s;
  line-height: 1;
}

.map-panel-close:hover {
  color: #fff;
  background: #2a2a2a;
}

.map-panel-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
}

.map-hint {
  color: #666;
  font-size: 0.85rem;
  text-align: center;
  padding: 20px 0;
}

.map-post {
  padding: 10px 12px;
  background: #111;
  border: 1px solid #222;
  border-radius: 10px;
}

.map-post-title {
  display: block;
  color: #e0e0e0;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
}

a.map-post-title:hover {
  color: #4ade80;
}

.map-post-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.map-post-cat {
  font-size: 0.7rem;
  padding: 1px 8px;
  border-radius: 5px;
  background: #1a3a2a;
  color: #4ade80;
}

/* ---- jsVectorMap dark theme overrides ---- */
:root {
  --jvm-tooltip-bg-color: #1c1c1c;
  --jvm-tooltip-color: #e0e0e0;
  --jvm-tooltip-radius: 8px;
  --jvm-tooltip-padding: 6px 10px;
  --jvm-zoom-btn-bg-color: #2a2a2a;
  --jvm-zoom-btn-color: #ccc;
  --jvm-legend-bg-color: #1c1c1c;
}

.jvm-tooltip {
  border: 1px solid #333;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

@media (max-width: 550px) {
  #world-map {
    height: 300px;
  }
  .map-panel {
    padding: 12px 14px;
  }
}
