/**
 * Blog Index Page Styles
 * Invest Like The Best
 */

/* Line clamp for descriptions */
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Card animation */
#articles-grid .card {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.4s ease, transform 0.4s ease, border-color 0.3s ease;
}

#articles-grid .card.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Category filter buttons */
.category-btn {
  padding: 0.375rem 0.875rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: #737373;
  background-color: transparent;
  border: 1px solid #404040;
  border-radius: 9999px;
  transition: all 0.2s ease;
  white-space: nowrap;
  cursor: pointer;
}

.category-btn:hover {
  color: #c9a962;
  border-color: #c9a962;
}

.category-btn.active {
  color: #0a0a0a;
  background-color: #c9a962;
  border-color: #c9a962;
}

/* Category badges on cards */
.category-badge {
  padding: 0.125rem 0.5rem;
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #c9a962;
  background-color: rgba(201, 169, 98, 0.1);
  border-radius: 4px;
}

/* Toast animation */
@keyframes fade-in {
  from {
    opacity: 0;
    transform: translate(-50%, 10px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

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

/* Search shortcut hint */
#search-input::placeholder {
  opacity: 0.5;
}

@media (min-width: 768px) {
  #search-input::placeholder {
    content: "Artikel durchsuchen... (⌘K)";
  }
}

/* ========== NEW: Skeleton Loading ========== */
.skeleton-card {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 12px;
  padding: 1.5rem;
  height: 320px;
}

.skeleton-card::before {
  content: '';
  display: block;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255,255,255,0.03) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: 8px;
}

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

/* ========== NEW: Read indicator ========== */
.article-card.is-read {
  position: relative;
}

.article-card.is-read::after {
  content: '';
  position: absolute;
  top: 12px;
  right: 12px;
  width: 8px;
  height: 8px;
  background: #22c55e;
  border-radius: 50%;
  box-shadow: 0 0 0 2px #0a0a0a;
}

.read-badge {
  display: inline-flex !important;
  align-items: center !important;
  gap: 4px !important;
  font-size: 10px !important;
  line-height: 1 !important;
  color: #22c55e !important;
  text-transform: uppercase !important;
  letter-spacing: 0.05em !important;
  height: 18px !important;
  max-height: 18px !important;
}

.read-badge svg {
  width: 12px !important;
  height: 12px !important;
  min-width: 12px !important;
  min-height: 12px !important;
  max-width: 12px !important;
  max-height: 12px !important;
  flex-shrink: 0 !important;
  display: block !important;
}

.read-badge span {
  font-size: 10px !important;
  line-height: 1 !important;
  display: inline !important;
}

/* ========== NEW: Reading List ========== */
#reading-list-section {
  scroll-behavior: smooth;
}

.scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

.reading-list-card {
  flex-shrink: 0;
  width: 280px;
  padding: 1rem;
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 10px;
  text-decoration: none;
  transition: all 0.2s;
}

.reading-list-card:hover {
  border-color: #c9a962;
}

.reading-list-card .rl-title {
  font-size: 0.875rem;
  color: #e5e5e5;
  line-height: 1.4;
  margin-bottom: 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.reading-list-card .rl-meta {
  font-size: 0.75rem;
  color: #737373;
}

.reading-list-card .rl-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.5);
  border: none;
  border-radius: 50%;
  color: #a3a3a3;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
}

.reading-list-card:hover .rl-remove {
  opacity: 1;
}

.reading-list-card .rl-remove:hover {
  color: #ef4444;
}

/* ========== NEW: Save/Bookmark Button ========== */
.bookmark-btn {
  position: relative;
  z-index: 20;
  padding: 0.5rem;
  margin: -0.5rem;
  color: #737373;
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.2s;
}

.bookmark-btn:hover {
  color: #c9a962;
}

.bookmark-btn.is-saved {
  color: #c9a962;
}

.bookmark-btn.is-saved svg {
  fill: currentColor;
}

/* ========== NEW: Keyboard focus styles ========== */
.article-card:focus-within {
  outline: 2px solid #c9a962;
  outline-offset: 2px;
}

.category-btn:focus-visible,
#search-input:focus-visible,
#sort-select:focus-visible {
  outline: 2px solid #c9a962;
  outline-offset: 2px;
}

/* ========== NEW: Active filter indicator ========== */
.filter-active-indicator {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: #c9a962;
  border-radius: 50%;
  margin-left: 4px;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ========== Print Styles ========== */
@media print {
  nav, footer, #back-to-top, .category-btn, #sort-select,
  #search-input, #load-more-container, #reading-list-section {
    display: none !important;
  }

  body {
    background: white !important;
    color: black !important;
  }

  .card {
    break-inside: avoid;
    border: 1px solid #ccc !important;
    background: white !important;
  }

  .card h2, .card p {
    color: black !important;
  }

  a {
    text-decoration: underline;
  }
}
