/* ============================================================================
   CATEGORY PANEL HEADER
   ============================================================================ */

.category-panel-header {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.category-info {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.category-header-emoji {
  font-size: 48px;
  line-height: 1;
  flex-shrink: 0;
}

.category-header-text {
  flex: 1;
  min-width: 0;
}

.category-header-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 4px 0;
  line-height: 1.2;
}

.category-header-description {
  font-size: 15px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.5;
}

/* Category Stats */
.category-stats {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.category-stat {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.stat-number {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  font-size: 14px;
  color: var(--text-secondary);
}

/* User's progress stat - slightly different styling */
.category-user-stat {
  padding-left: 24px;
  border-left: 2px solid var(--border);
}

.category-user-stat .stat-number {
  color: var(--success);
}

/* Sign-in prompt (shown for logged out users in Category Panel) */
.signin-prompt {
  background: var(--primary-light);
  border: 1px solid var(--primary);
  border-radius: 8px;
  padding: 12px 16px;
  margin-top: 8px;
}

.signin-prompt p {
  margin: 0;
  font-size: 14px;
  color: var(--text);
}

.signin-prompt-link {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  font-size: inherit;
  padding: 0;
}

.signin-prompt-link:hover {
  color: var(--primary-hover);
}

/* Responsive category header */
@media (max-width: 600px) {
  .category-info {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  
  .category-header-emoji {
    font-size: 56px;
  }
  
  .category-header-title {
    font-size: 24px;
  }
  
  .category-stats {
    justify-content: center;
  }
  
  .category-user-stat {
    padding-left: 0;
    border-left: none;
    padding-top: 12px;
    border-top: 2px solid var(--border);
  }
}

/* ============================================================================
   FILTER BAR & CATEGORY PILLS
   ============================================================================ */

.filter-bar {
  margin-bottom: 20px;
}

.category-pills-container {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
  gap: 10px;
  padding: 8px 0;
}

.category-pills-container::-webkit-scrollbar {
  display: none; /* Chrome/Safari */
}

.category-pill {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  gap: 6px;
  padding: 8px 16px;
  background: var(--vintage-teal);
  border: none;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow:
    2px 2px 0 rgba(0,0,0,0.1),
    inset 0 0 0 2px rgba(255,255,255,0.15);
  position: relative;
}

/* Sticker rotation for organic feel */
.category-pill:nth-child(odd) {
  transform: rotate(-1deg);
}

.category-pill:nth-child(even) {
  transform: rotate(0.5deg);
}

.category-pill:nth-child(3n) {
  transform: rotate(-1.5deg);
}

.category-pill:hover {
  transform: rotate(0deg) scale(1.05) translateY(-2px);
  box-shadow:
    4px 4px 8px rgba(0,0,0,0.2),
    inset 0 0 0 2px rgba(255,255,255,0.25);
  z-index: 5;
}

.category-pill:focus-visible {
  outline: 2px solid var(--brass-light);
  outline-offset: 2px;
}

.category-pill:active {
  transform: rotate(0deg) scale(0.98);
}

/* Sticker color variants based on position - all need white text for contrast */
.category-pill:nth-child(4n+1) { background: var(--vintage-teal); color: white; }
.category-pill:nth-child(4n+2) { background: var(--vintage-coral); color: white; }
.category-pill:nth-child(4n+3) { background: var(--vintage-olive); color: white; }
.category-pill:nth-child(4n) { background: var(--vintage-navy); color: white; }

/* "All" pill - brass badge style */
.category-pill-all {
  background: linear-gradient(180deg, var(--brass-light) 0%, var(--brass) 100%);
  color: var(--leather-dark);
  font-weight: 700;
  border: 2px dashed var(--leather-mid);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.4),
    2px 2px 0 rgba(0,0,0,0.1);
}

.category-pill-all:hover {
  background: linear-gradient(180deg, var(--brass-shine) 0%, var(--brass-light) 100%);
  border-color: var(--leather-dark);
  color: var(--leather-dark);
}

.category-pill-all.active {
  background: linear-gradient(180deg, var(--brass-shine) 0%, var(--brass) 100%);
  color: var(--leather-dark);
}

/* Active category pill (non-All) - stamp pressed effect */
.category-pill.active:not(.category-pill-all) {
  box-shadow:
    inset 2px 2px 4px rgba(0,0,0,0.3),
    inset 0 0 0 2px rgba(255,255,255,0.1);
  transform: rotate(0deg) scale(0.98);
}

/* A3: "Choose categories" CTA pill - compass style */
.category-pill-cta {
  background: linear-gradient(135deg, var(--paper-cream) 0%, var(--paper-aged) 100%);
  border: 2px dashed var(--brass);
  color: var(--leather-mid);
  font-weight: 700;
  padding: 8px 18px;
}

.category-pill-cta:hover {
  background: linear-gradient(135deg, var(--brass-light) 0%, var(--brass) 100%);
  border-style: solid;
  color: var(--leather-dark);
  box-shadow: 0 4px 12px rgba(184, 134, 11, 0.3);
  transform: rotate(0deg) translateY(-2px) scale(1.02);
}

.category-pill-cta:hover .category-pill-emoji {
  transform: rotate(90deg);
}

.category-pill-cta .category-pill-emoji {
  font-size: 14px;
  transition: transform 0.2s ease;
}

/* Followed state - visited stamp */
.category-pill.followed {
  position: relative;
}

.category-pill.followed::after {
  content: '✓';
  position: absolute;
  top: -4px;
  right: -4px;
  width: 16px;
  height: 16px;
  background: var(--success);
  border-radius: 50%;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}

.category-pill.followed:hover {
  opacity: 0.9;
}

.category-pill-emoji {
  font-size: 16px;
  line-height: 1;
}

.category-pill-name {
  line-height: 1.2;
}

.category-pill-count {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 400;
}

.category-pill:hover .category-pill-count {
  color: var(--primary);
}

.category-pill-all .category-pill-count,
.category-pill-all:hover .category-pill-count {
  color: rgba(255, 255, 255, 0.8);
}

.category-pill-follow-icon {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-left: 2px;
  transition: color 0.2s;
}

.category-pill.followed .category-pill-follow-icon {
  color: var(--success);
}

.category-pill.followed:hover .category-pill-follow-icon {
  color: white;
}

/* Extra padding on mobile for scroll fade hint */
@media (max-width: 768px) {
  .category-pills-container {
    padding-bottom: 8px;
    margin-bottom: -8px;
  }
}

/* ============================================================================
   LOADING STATE
   ============================================================================ */

#loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  gap: 16px;
}

.loading-spinner {
  width: 56px;
  height: 56px;
  border: 3px solid var(--paper-dark);
  border-radius: 50%;
  position: relative;
  animation: spin 2s linear infinite;
  background: var(--paper-cream);
}

/* Compass needle */
.loading-spinner::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 4px;
  height: 22px;
  background: linear-gradient(to bottom, var(--vintage-coral) 50%, var(--leather-dark) 50%);
  transform: translate(-50%, -50%);
  border-radius: 2px;
}

/* Center point */
.loading-spinner::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  background: var(--brass);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 2px var(--paper-cream);
}

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

.loading-stage {
  font-size: 11px;
  color: var(--paper-dark);
  opacity: 0.7;
  margin: 0;
}

/* ============================================================================
   YOINKS GRID - Polaroid Style
   ============================================================================ */

.yoinks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: 32px;
  padding: 24px 12px;
  max-width: 100%;
  box-sizing: border-box;
  overflow-x: hidden; /* Clip rotated yoink-card edges and far shadow spread */
}

.yoink-card {
  background: white;
  border-radius: 4px;
  overflow: visible;
  box-shadow:
    0 4px 6px var(--shadow),
    0 10px 20px var(--shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  height: 440px;
  position: relative;
  /* Polaroid frame padding */
  padding: 12px 12px 0 12px;
  max-width: 100%;
  box-sizing: border-box;
}

/* Slight rotation for organic feel */
.yoink-card:nth-child(1) { transform: rotate(-0.8deg); }
.yoink-card:nth-child(2) { transform: rotate(0.5deg); }
.yoink-card:nth-child(3) { transform: rotate(-0.3deg); }
.yoink-card:nth-child(4) { transform: rotate(0.7deg); }
.yoink-card:nth-child(5) { transform: rotate(-1deg); }
.yoink-card:nth-child(6) { transform: rotate(0.4deg); }

.yoink-card:hover {
  transform: rotate(0deg) translateY(-8px) scale(1.02);
  box-shadow:
    0 12px 24px rgba(45, 36, 22, 0.25),
    0 20px 40px var(--shadow);
  z-index: 10;
}

.yoink-card:focus-visible {
  outline: 3px solid var(--brass);
  outline-offset: 4px;
}

.yoink-card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  object-position: center;
  display: block;
  flex-shrink: 0;
  background: var(--paper-aged);
  border-radius: 2px;
}

.yoink-card:hover .yoink-card-image {
  filter: saturate(1) contrast(1);
}

/* Image container for fallback handling */
.yoink-card-image-container {
  width: 100%;
  height: 200px;
  flex-shrink: 0;
  overflow: hidden;
  border-radius: 2px;
}

.yoink-card-image-container .yoink-card-image {
  height: 100%;
}

/* Placeholder for cards without images - checkered pattern */
.yoink-card-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background:
    linear-gradient(45deg, var(--paper-aged) 25%, transparent 25%),
    linear-gradient(-45deg, var(--paper-aged) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--paper-aged) 75%),
    linear-gradient(-45deg, transparent 75%, var(--paper-aged) 75%);
  background-size: 16px 16px;
  background-color: var(--paper-cream);
  border-radius: 2px;
}

.yoink-card-placeholder-emoji {
  font-size: 72px;
  line-height: 1;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.15));
  animation: floatEmoji 3s ease-in-out infinite;
}

@keyframes floatEmoji {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-8px);
  }
}

/* Hover effect on placeholder */
.yoink-card:hover .yoink-card-placeholder-emoji {
  transform: scale(1.1) translateY(-8px);
  transition: transform 0.3s ease;
}

.yoink-card-content {
  padding: 16px 4px;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  background: transparent;
}

.yoink-card-title {
  font-family: 'Caveat', cursive;
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
  /* Truncate to 2 lines */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.yoink-card-description {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.5;
  flex: 1;
  /* Truncate to 3 lines */
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

.yoink-card-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: auto;
  flex-shrink: 0;
  padding-top: 12px;
  border-top: 1px dashed var(--paper-dark);
}

.yoink-card-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  /* Truncate long location names */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Interactive meta items (user, location, category links) */
.yoink-card-meta-item[role="button"] {
  cursor: pointer;
  border-radius: 4px;
  padding: 2px 4px;
  margin: -2px -4px;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.yoink-card-meta-item[role="button"]:hover {
  background-color: var(--bg-secondary);
  color: var(--primary);
}

.yoink-card-meta-item[role="button"]:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  background-color: var(--bg-secondary);
}

/* Ensure reduced motion is respected */
@media (prefers-reduced-motion: reduce) {
  .yoink-card-meta-item[role="button"] {
    transition: none;
  }
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.empty-state h3 {
  font-size: 24px;
  margin-bottom: 8px;
}

.empty-state p {
  margin-bottom: 16px;
}

.empty-state .btn-primary {
  margin-top: 8px;
}

.error-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--error);
}

.error-state h3 {
  font-size: 24px;
  margin-bottom: 8px;
}

