/**
 * Glimpses Styles
 *
 * Styles for the ephemeral content feature
 */

/* Alpine.js x-cloak - CRITICAL: hides elements until Alpine initializes */
[x-cloak] {
  display: none !important;
}

/* Tab navigation spacing (Tailwind space-x-8 fallback) */
.glimpses-tabs {
  gap: 2rem; /* Equivalent to space-x-8 = 32px = 2rem */
}

/* Line clamp for text preview */
.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Viewer z-index above everything */
.z-60 {
  z-index: 60;
}

/* Smooth transitions for viewer */
.glimpse-viewer-enter {
  opacity: 0;
  transform: scale(0.95);
}

.glimpse-viewer-enter-active {
  opacity: 1;
  transform: scale(1);
  transition: opacity 200ms ease-out, transform 200ms ease-out;
}

/* Comments panel slide up */
.comments-panel {
  transform: translateY(100%);
  transition: transform 300ms ease-out;
}

.comments-panel.open {
  transform: translateY(0);
}

/* Card hover effects */
.glimpse-card {
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.glimpse-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Save button animation */
.save-button {
  transition: transform 150ms ease, color 150ms ease;
}

.save-button:active {
  transform: scale(0.9);
}

.save-button.saved {
  animation: heartPop 300ms ease;
}

@keyframes heartPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

/* Viewer navigation buttons */
.viewer-nav-btn {
  opacity: 0.7;
  transition: opacity 150ms ease, background-color 150ms ease;
}

.viewer-nav-btn:hover {
  opacity: 1;
}

/* Mobile optimizations */
@media (max-width: 640px) {
  /* Full-width cards on mobile */
  .glimpse-card {
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  /* Larger touch targets */
  .viewer-nav-btn {
    padding: 1rem;
  }

  /* Comments panel takes more space */
  .comments-panel {
    max-height: 85vh;
  }
}

/* Create modal mobile adjustments */
@media (max-width: 640px) {
  .create-modal {
    align-items: flex-end;
  }

  .create-modal-content {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    max-height: 90vh;
    overflow-y: auto;
  }
}

/* Swipe indicator */
.swipe-hint {
  opacity: 0.6;
  animation: swipeHint 2s ease-in-out infinite;
}

@keyframes swipeHint {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* Media preview aspect ratio */
.media-preview {
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

/* Video play button overlay */
.video-play-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.3);
}

.video-play-btn {
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 150ms ease;
}

.video-play-btn:hover {
  transform: scale(1.1);
}

/* Type badge colors */
.type-badge-recipe {
  background-color: #fef3c7;
  color: #92400e;
}

.type-badge-birthday {
  background-color: #fce7f3;
  color: #9d174d;
}

.type-badge-reminder {
  background-color: #dbeafe;
  color: #1e40af;
}

.type-badge-question {
  background-color: #e0e7ff;
  color: #3730a3;
}

.type-badge-memory {
  background-color: #f3e8ff;
  color: #6b21a8;
}

.type-badge-idea {
  background-color: #dcfce7;
  color: #166534;
}

/* Skeleton loading */
.glimpse-skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

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

/* Progress indicator for viewer */
.viewer-progress {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: rgba(255, 255, 255, 0.3);
}

.viewer-progress-bar {
  height: 100%;
  background: white;
  transition: width 100ms linear;
}

/* Accessibility focus styles */
.glimpse-card:focus-visible {
  outline: 2px solid #14b8a6;
  outline-offset: 2px;
}

button:focus-visible {
  outline: 2px solid #14b8a6;
  outline-offset: 2px;
}

/* Dark mode support (future) */
@media (prefers-color-scheme: dark) {
  /* Add dark mode styles here when needed */
}

/* ========================================
   EMOJI PICKER (for reactions)
   ======================================== */

.emoji-picker {
  position: fixed;
  z-index: 10000;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  padding: 8px;
  min-width: 280px;
  max-width: 320px;
  animation: emoji-picker-in 0.15s ease-out;
}

@keyframes emoji-picker-in {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.emoji-picker-quick {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e5e7eb;
}

.emoji-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  font-size: 1.4rem;
  background: none;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.emoji-btn:hover {
  background-color: #f3f4f6;
  transform: scale(1.15);
}

.emoji-btn:focus {
  outline: none;
  box-shadow: 0 0 0 2px #14b8a6;
}

.emoji-btn:active {
  transform: scale(0.95);
}

.emoji-picker-more {
  display: block;
  width: 100%;
  padding: 8px;
  margin-top: 4px;
  background: none;
  border: none;
  color: #6b7280;
  font-size: 0.875rem;
  cursor: pointer;
  border-radius: 6px;
  transition: background-color 0.15s ease;
}

.emoji-picker-more:hover {
  background-color: #f3f4f6;
  color: #111827;
}

.emoji-picker-expanded {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #e5e7eb;
}

.emoji-picker-section {
  margin-bottom: 12px;
}

.emoji-picker-section:last-child {
  margin-bottom: 0;
}

.emoji-picker-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
  padding-left: 4px;
}

.emoji-picker-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
}

/* Mobile adjustments */
@media (max-width: 480px) {
  .emoji-picker {
    min-width: 260px;
    max-width: calc(100vw - 20px);
  }

  .emoji-picker-quick,
  .emoji-picker-grid {
    grid-template-columns: repeat(6, 1fr);
  }

  .emoji-btn {
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
  }
}

/* ========================================
   REACTIONS DISPLAY
   ======================================== */

.reaction-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.reaction-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 20px;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.reaction-chip:hover {
  background: #e5e7eb;
}

.reaction-chip.user-reacted {
  background: #ccfbf1;
  border-color: #14b8a6;
}

.reaction-chip .reaction-emoji {
  font-size: 1rem;
}

.reaction-chip .reaction-count {
  color: #6b7280;
  font-weight: 500;
}

.reaction-chip.user-reacted .reaction-count {
  color: #0d9488;
}

/* Add reaction button */
.add-reaction-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: #f3f4f6;
  border: 1px dashed #d1d5db;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.15s ease;
}

.add-reaction-btn:hover {
  background: #e5e7eb;
  border-color: #9ca3af;
}

.add-reaction-btn svg {
  width: 16px;
  height: 16px;
  color: #6b7280;
}

/* Emoji input button (for text areas) */
.emoji-input-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  color: #6b7280;
  transition: all 0.15s ease;
}

.emoji-input-btn:hover {
  background: #f3f4f6;
  color: #111827;
}

/* Viewer reactions */
.viewer-reactions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 8px 0;
}

.viewer-reaction-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  color: white;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.viewer-reaction-chip:hover {
  background: rgba(255, 255, 255, 0.25);
}

.viewer-reaction-chip.user-reacted {
  background: rgba(20, 184, 166, 0.4);
  border-color: rgba(20, 184, 166, 0.6);
}

.viewer-reaction-chip .reaction-emoji {
  font-size: 1.1rem;
}

.viewer-add-reaction-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  border: 1px dashed rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  color: white;
  cursor: pointer;
  transition: all 0.15s ease;
}

.viewer-add-reaction-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.5);
}
