/**
 * ========================================
 * BRAINDUMP - ACTION REQUIRED UX STYLES
 * Mobile-First Design Patterns
 * ========================================
 *
 * @version 1.0.0
 * @date 2026-01-02
 *
 * Features:
 * - Attention Banners
 * - Swipe Actions
 * - Completion States
 * - Badge System
 * - Gamification
 * - Haptic Feedback Hints
 */

/* ========================================
   ATTENTION BANNERS
   ======================================== */

.attention-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin: -14px -14px 12px -18px;
  border-radius: 12px 12px 0 0;
  font-size: 14px;
  font-weight: 500;
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.attention-banner--critical {
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
  border-left: 4px solid #ef4444;
  color: #991b1b;
  animation: pulse-critical 2s ease-in-out infinite;
}

@keyframes pulse-critical {
  0%, 100% {
    border-left-color: #ef4444;
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
  }
  50% {
    border-left-color: #dc2626;
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.2);
  }
}

.attention-banner--high {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-left: 4px solid #f59e0b;
  color: #78350f;
}

.attention-banner--medium {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  border-left: 4px solid #3b82f6;
  color: #1e3a8a;
}

.attention-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.attention-label {
  flex: 1;
  font-weight: 600;
}

.attention-quick-fix {
  padding: 6px 14px;
  background: white;
  border: none;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.attention-quick-fix:active {
  transform: scale(0.95);
}

/* ========================================
   SWIPE ACTIONS
   ======================================== */

.feed-card {
  position: relative;
  touch-action: pan-y;
  user-select: none;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.swipe-action {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 80px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  z-index: -1;
  border-radius: 12px;
  transition: width 0.2s ease;
}

.swipe-action--left {
  left: 0;
  border-radius: 12px 0 0 12px;
}

.swipe-action--right {
  right: 0;
  border-radius: 0 12px 12px 0;
}

.swipe-action__icon {
  font-size: 1.5rem;
  margin-bottom: 4px;
}

/* Swipe hint for first-time users */
.feed-card--needs-attention.feed-card--first-visit {
  animation: swipe-hint 2s ease-in-out 3;
}

@keyframes swipe-hint {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  50% { transform: translateX(0); }
  75% { transform: translateX(8px); }
}

/* ========================================
   COMPLETION / EMPTY STATES
   ======================================== */

.feed-completion {
  padding: 4rem 2rem;
  text-align: center;
  background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
  border-radius: 16px;
  margin: 2rem;
  animation: fadeInScale 0.5s ease-out;
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.completion-trophy {
  font-size: 5rem;
  animation: trophy-bounce 1s ease-in-out infinite;
  text-shadow: 0 4px 12px rgba(255, 215, 0, 0.4);
  margin-bottom: 1rem;
}

@keyframes trophy-bounce {
  0%, 100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-15px) scale(1.1);
  }
}

.completion-title {
  font-size: 2rem;
  font-weight: 700;
  color: #1b5e20;
  margin-bottom: 0.5rem;
}

.completion-subtitle {
  font-size: 1.1rem;
  color: #2e7d32;
  margin-bottom: 2rem;
}

.completion-cta {
  padding: 14px 28px;
  background: linear-gradient(135deg, #4caf50 0%, #388e3c 100%);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.completion-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.completion-cta:active {
  transform: translateY(0);
}

/* ========================================
   BADGE SYSTEM
   ======================================== */

.tab-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: #3b82f6;
  color: white;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.5); }
  to { opacity: 1; transform: scale(1); }
}

.tab-badge--critical {
  background: #ef4444;
  animation: badge-pulse 2s ease-in-out infinite;
}

@keyframes badge-pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
  }
  50% {
    transform: scale(1.15);
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.6);
  }
}

.tab-badge--quiet {
  background: #9ca3af;
  min-width: 8px;
  height: 8px;
  padding: 0;
  top: -4px;
  right: -4px;
}

/* Hide badge completely when empty */
.tab-badge:empty {
  display: none;
}

/* ========================================
   GAMIFICATION: STREAK & XP
   ======================================== */

.streak-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: linear-gradient(135deg, #ff6b6b 0%, #ff8e53 100%);
  color: white;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
  animation: streak-glow 2s ease-in-out infinite;
}

@keyframes streak-glow {
  0%, 100% { box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3); }
  50% { box-shadow: 0 6px 20px rgba(255, 107, 107, 0.5); }
}

.streak-flame {
  font-size: 1.1rem;
  animation: flame-flicker 1s ease-in-out infinite;
}

@keyframes flame-flicker {
  0%, 100% { transform: scale(1) rotate(-5deg); }
  50% { transform: scale(1.1) rotate(5deg); }
}

.xp-popup {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  background: linear-gradient(135deg, #00d4aa 0%, #00a67e 100%);
  color: white;
  border-radius: 24px;
  font-size: 1.1rem;
  font-weight: 700;
  box-shadow: 0 8px 32px rgba(0, 212, 170, 0.4);
  animation: xp-popup 1.5s ease-out forwards;
  z-index: 9999;
}

@keyframes xp-popup {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(30px) scale(0.8);
  }
  20% {
    opacity: 1;
    transform: translateX(-50%) translateY(-10px) scale(1.1);
  }
  80% {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px) scale(0.9);
  }
}

/* ========================================
   SUCCESS ANIMATIONS
   ======================================== */

@keyframes successPulse {
  0%, 100% { transform: scale(1); }
  25% { transform: scale(1.05); }
  50% { transform: scale(0.95); }
  75% { transform: scale(1.02); }
}

.success-checkmark {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: #10b981;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: white;
  margin: 2rem auto;
  animation: checkmark-appear 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  box-shadow: 0 8px 32px rgba(16, 185, 129, 0.4);
}

@keyframes checkmark-appear {
  0% {
    transform: scale(0) rotate(-180deg);
    opacity: 0;
  }
  100% {
    transform: scale(1) rotate(0);
    opacity: 1;
  }
}

/* ========================================
   PROGRESSIVE DISCLOSURE: SECTIONS
   ======================================== */

.feed-section {
  margin-bottom: 1.5rem;
}

.feed-section__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 10px;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s ease;
}

.feed-section__header:hover {
  background: rgba(0, 0, 0, 0.05);
}

.feed-section__header:active {
  background: rgba(0, 0, 0, 0.08);
}

.feed-section__title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #374151;
  display: flex;
  align-items: center;
  gap: 8px;
}

.feed-section__count {
  background: rgba(0, 0, 0, 0.1);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
}

.feed-section__toggle {
  font-size: 1rem;
  transition: transform 0.3s ease;
  color: #9ca3af;
}

.feed-section__toggle--expanded {
  transform: rotate(180deg);
}

.feed-section__content {
  margin-top: 12px;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.3s ease;
}

.feed-section__content--collapsed {
  max-height: 0;
  opacity: 0;
}

.feed-section__content--expanded {
  max-height: 10000px;
  opacity: 1;
}

/* ========================================
   HAPTIC FEEDBACK VISUAL HINTS
   ======================================== */

.haptic-ready {
  position: relative;
  overflow: visible;
}

.haptic-ready::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  transform: translate(-50%, -50%);
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
}

.haptic-ready:active::after {
  animation: haptic-ripple 0.5s ease-out;
}

@keyframes haptic-ripple {
  0% {
    opacity: 0.5;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.5);
    background: radial-gradient(circle, rgba(59, 130, 246, 0.3) 0%, transparent 70%);
  }
}

/* ========================================
   DARK MODE SUPPORT
   ======================================== */

[data-theme="dark"] .feed-completion {
  background: linear-gradient(135deg, #1e3a20 0%, #2d5f2e 100%);
}

[data-theme="dark"] .completion-title {
  color: #a5d6a7;
}

[data-theme="dark"] .completion-subtitle {
  color: #81c784;
}

[data-theme="dark"] .feed-section__header {
  background: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .feed-section__header:hover {
  background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .feed-section__title {
  color: #e5e7eb;
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

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

/* Focus indicators for keyboard navigation */
.attention-quick-fix:focus,
.completion-cta:focus,
.feed-section__header:focus {
  outline: 2px solid #3b82f6;
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .attention-banner {
    border-width: 3px;
  }

  .tab-badge {
    border: 2px solid white;
  }
}

/* ========================================
   MOBILE OPTIMIZATIONS
   ======================================== */

@media (max-width: 480px) {
  .completion-trophy {
    font-size: 4rem;
  }

  .completion-title {
    font-size: 1.5rem;
  }

  .attention-banner {
    padding: 10px 12px;
    font-size: 13px;
  }

  .attention-quick-fix {
    padding: 5px 10px;
    font-size: 11px;
  }

  .swipe-action {
    width: 70px;
    font-size: 0.7rem;
  }
}

/* Tablet optimizations */
@media (min-width: 768px) and (max-width: 1024px) {
  .feed-completion {
    max-width: 600px;
    margin: 2rem auto;
  }
}

/* Desktop optimizations */
@media (min-width: 1025px) {
  .feed-card {
    touch-action: auto; /* Disable swipe on desktop */
  }

  .swipe-action {
    display: none; /* No swipe actions on desktop */
  }

  /* Show hover actions instead */
  .feed-card:hover .desktop-quick-actions {
    opacity: 1;
  }
}
