/* ============================================
   OSRS Tracker - Chronicle Feed
   ============================================ */

/* ============================================
   Feed Layout - Single Column
   ============================================ */

.chronicle-feed {
  --card-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 640px;
  margin: 0 auto;
  padding: 0;
}

/* ============================================
   Feed Card
   ============================================ */

.feed-card {
  --event-color: #6b7280;
  position: relative;
  background: var(--bg-elevated);
  border-radius: var(--card-radius);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

/* Special cards get a colored top edge */
.feed-card--special::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--event-color);
}

/* ============================================
   Event Type Badge - inline with header
   ============================================ */

.feed-card__badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: color-mix(in srgb, var(--event-color) 15%, transparent);
  color: var(--event-color);
  border-radius: 4px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-left: auto;
  flex-shrink: 0;
}

.feed-card__badge .material-icons {
  font-size: 0.875rem;
}

.feed-card__badge-label {
  display: none;
}

@media (min-width: 400px) {
  .feed-card__badge-label {
    display: inline;
  }
}

/* ============================================
   Card Header
   ============================================ */

.feed-card__header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px 10px;
}

.feed-card__avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.feed-card__meta {
  flex: 1;
  min-width: 0;
}

.feed-card__author {
  display: flex;
  align-items: center;
  gap: 6px;
}

.feed-card__username {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.feed-card__info {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

.feed-card__separator {
  opacity: 0.4;
}

.feed-card__group {
  color: var(--text-tertiary);
  text-decoration: none;
}

.feed-card__group:hover {
  color: var(--text-secondary);
  text-decoration: none;
}

/* ============================================
   Card Content & Message
   ============================================ */

.feed-card__content {
  position: relative;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.feed-card__message {
  padding: 4px 16px 14px;
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.45;
  color: var(--text-primary);
}

/* ============================================
   Media (Video/Image)
   ============================================ */

.feed-card__media {
  position: relative;
  background: #000;
  overflow: hidden;
}

.feed-card__video,
.feed-card__image {
  width: 100%;
  display: block;
}

.feed-card__play-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
}

.feed-card__media:hover .feed-card__play-hint {
  opacity: 1;
}

/* Hide play hint when video is actually playing */
.feed-card__media:has(.feed-card__video:not(:paused)) .feed-card__play-hint {
  opacity: 0;
}

.feed-card__play-hint .material-icons {
  font-size: 28px;
  color: white;
}

/* ============================================
   Double-tap Heart Animation
   ============================================ */

.feed-card__heart-burst {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  pointer-events: none;
  z-index: 100;
  opacity: 0;
}

.feed-card__heart-burst .material-icons {
  font-size: 64px;
  color: #ef4444;
}

.feed-card__heart-burst.animate {
  animation: heart-burst 0.5s ease-out;
}

@keyframes heart-burst {
  0% {
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
  }
  30% {
    transform: translate(-50%, -50%) scale(1.1);
    opacity: 1;
  }
  60% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0;
  }
}

/* ============================================
   Card Actions
   ============================================ */

.feed-card__actions {
  display: flex;
  align-items: center;
  padding: 4px 8px;
  gap: 0;
}

.feed-card__action {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
}

.feed-card__action:active {
  opacity: 0.6;
}

.feed-card__action .material-icons {
  font-size: 1.25rem;
}

.feed-card__action--like.liked {
  color: #ef4444;
}

.feed-card__action--favorite.favorited {
  color: #f59e0b;
}

.feed-card__action--fullscreen {
  margin-left: auto;
}

.feed-card__action--delete {
  color: var(--text-tertiary);
  opacity: 0.5;
  transition: opacity 0.15s, color 0.15s;
}

.feed-card__action--delete:hover {
  opacity: 1;
  color: #ef4444;
}

.feed-card__delete-wrapper {
  margin-left: auto;
  display: flex;
  align-items: center;
}

.feed-card__delete-confirm {
  align-items: center;
  gap: 6px;
}

.feed-card__delete-confirm-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.feed-card__delete-confirm-btn {
  padding: 4px 10px;
  border-radius: 6px;
  border: none;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.feed-card__delete-confirm-btn--yes {
  background: #ef4444;
  color: white;
}

.feed-card__delete-confirm-btn--no {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
}

.feed-card__action-count {
  font-size: 0.8125rem;
  font-weight: 600;
  min-width: 1ch;
}

.feed-card__action-label {
  display: none;
}

@media (min-width: 360px) {
  .feed-card__action-label {
    display: inline;
  }
}

/* ============================================
   Share Drawer
   ============================================ */

.feed-card__share-drawer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  padding: 16px;
  transform: translateY(100%);
  transition: transform 0.25s ease;
  z-index: 20;
}

.feed-card__share-drawer.open {
  transform: translateY(0);
}

.feed-card__share-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
}

.feed-card__share-close {
  background: none;
  border: none;
  color: var(--text-tertiary);
  cursor: pointer;
  padding: 4px;
  display: flex;
}

.feed-card__share-close .material-icons {
  font-size: 1.25rem;
}

.feed-card__share-options {
  display: flex;
  justify-content: space-around;
}

.feed-card__share-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.6875rem;
  font-weight: 500;
  cursor: pointer;
}

.feed-card__share-btn:active {
  opacity: 0.6;
}

.feed-card__share-btn svg,
.feed-card__share-btn .material-icons {
  width: 28px;
  height: 28px;
  font-size: 28px;
}

.feed-card__share-btn--discord { color: #5865F2; }
.feed-card__share-btn--reddit { color: #FF4500; }
.feed-card__share-btn--twitter { color: #1d9bf0; }
.feed-card__share-btn--copy { color: var(--text-secondary); }

/* ============================================
   Feed Header
   ============================================ */

.chronicle-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  max-width: 640px;
  margin: 0 auto;
}

.chronicle-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ============================================
   View Toggle (List/Reels)
   ============================================ */

.chronicle-toggle {
  display: flex;
  gap: 4px;
}

.chronicle-toggle__btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 500;
}

.chronicle-toggle__btn.active {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.chronicle-toggle__btn .material-icons {
  font-size: 1rem;
}

.chronicle-toggle__label {
  display: none;
}

@media (min-width: 360px) {
  .chronicle-toggle__label {
    display: inline;
  }
}

/* ============================================
   Empty State
   ============================================ */

.chronicle-empty {
  text-align: center;
  padding: 64px 24px;
  background: var(--bg-elevated);
}

.chronicle-empty__icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  color: var(--text-tertiary);
}

.chronicle-empty__icon .material-icons {
  font-size: 48px;
}

.chronicle-empty__title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 6px;
}

.chronicle-empty__text {
  color: var(--text-tertiary);
  font-size: 0.8125rem;
  max-width: 280px;
  margin: 0 auto;
  line-height: 1.4;
}

/* ============================================
   Quick Actions Bar
   ============================================ */

.chronicle-actions {
  display: flex;
  gap: 8px;
  padding: 8px 0 16px;
  max-width: 640px;
  margin: 0 auto;
  justify-content: center;
}

.chronicle-action {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: var(--bg-secondary);
  border: none;
  border-radius: 8px;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 500;
}

.chronicle-action:hover {
  background: var(--bg-tertiary);
  text-decoration: none;
}

.chronicle-action .material-icons {
  font-size: 1rem;
}

.chronicle-action--groups .material-icons { color: var(--accent-primary); }
.chronicle-action--quests .material-icons { color: #f59e0b; }
.chronicle-action--stats .material-icons { color: #22c55e; }

/* ============================================
   Toast Notifications
   ============================================ */

.feed-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(60px);
  background: #1d1d1f;
  color: white;
  padding: 12px 20px;
  border-radius: 24px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  opacity: 0;
  transition: all 0.25s ease;
}

.feed-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.feed-toast .material-icons {
  font-size: 1.125rem;
  color: #22c55e;
}

/* ============================================
   Infinite Scroll Loader
   ============================================ */

.feed-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px;
  color: var(--text-tertiary);
  font-size: 0.875rem;
}

.feed-loader__spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-top-color: var(--text-tertiary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.feed-loader:not(.loading) {
  opacity: 0;
}

.feed-loader.loading {
  opacity: 1;
}

/* ============================================
   Reduced Motion
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  .feed-card__heart-burst,
  .feed-card__share-drawer,
  .feed-toast,
  .feed-loader__spinner {
    transition: none;
    animation: none;
  }
}
