/* MastoThreads - Workshop Toolbox Styles */

:root {
  --cream: #F5F0E8;
  --cream-dark: #E8E0D4;
  --charcoal: #2A2A2A;
  --charcoal-light: #3D3D3D;
  --shadow-color: rgba(42, 42, 42, 0.25);
  --shadow-heavy: rgba(42, 42, 42, 0.4);
  --accent-violet: #9B5DE5;
  --accent-violet-light: #B17EF0;
  --accent-violet-dark: #7B3DC5;
  --accent-mint: #4ECDC4;
  --accent-coral: #FF6B5B;
  --accent-gold: #FFD93D;
  --border-width: 3px;
}

.dark {
  --cream: #1A1A1A;
  --cream-dark: #252525;
  --charcoal: #F5F0E8;
  --charcoal-light: #E8E0D4;
  --shadow-color: rgba(0, 0, 0, 0.5);
  --shadow-heavy: rgba(0, 0, 0, 0.7);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'DM Sans', -apple-system, sans-serif;
  background-color: var(--cream);
  color: var(--charcoal);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Grain texture overlay */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.03;
  z-index: 1000;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%' height='100%' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* Header */
.header {
  background: var(--charcoal);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: var(--accent-violet);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--cream);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.back-link:hover {
  opacity: 1;
}

.header-title {
  font-family: 'Archivo Black', sans-serif;
  font-size: 1.5rem;
  color: var(--cream);
  letter-spacing: -0.5px;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.header-title span {
  color: var(--accent-violet);
}

.header-spacer {
  width: 36px;
}

/* Main Content */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1.5rem;
}

/* Card */
.card {
  background: var(--cream);
  border: var(--border-width) solid var(--charcoal);
  border-radius: 20px;
  padding: 1.75rem;
  box-shadow: 8px 8px 0 var(--shadow-color);
  width: 100%;
  max-width: 680px;
}

.card-title {
  font-family: 'Archivo Black', sans-serif;
  font-size: 1.25rem;
  letter-spacing: -0.5px;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-title i {
  color: var(--accent-violet);
}

/* Tab Navigation */
.tab-nav {
  display: flex;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.tab-container {
  background: var(--cream-dark);
  border: var(--border-width) solid var(--charcoal);
  border-radius: 12px;
  padding: 0.35rem;
  display: flex;
  gap: 0.25rem;
  box-shadow: 3px 3px 0 var(--shadow-color);
}

.tab-link {
  padding: 0.6rem 1rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.85rem;
  text-decoration: none;
  color: var(--charcoal);
  opacity: 0.6;
  transition: all 0.15s ease;
  border: 2px solid transparent;
}

.tab-link:hover {
  opacity: 1;
  background: var(--cream);
}

.tab-link.active {
  background: var(--accent-violet);
  color: var(--charcoal);
  opacity: 1;
  border-color: var(--charcoal);
  box-shadow: 2px 2px 0 var(--shadow-color);
}

/* Buttons */
.btn {
  background: var(--accent-violet);
  color: var(--charcoal);
  border: var(--border-width) solid var(--charcoal);
  border-radius: 10px;
  padding: 0.75rem 1.25rem;
  font-family: 'Archivo Black', sans-serif;
  font-size: 0.85rem;
  cursor: pointer;
  box-shadow: 4px 4px 0 var(--shadow-color);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-decoration: none;
}

.btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--shadow-color);
}

.btn:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--shadow-color);
}

.btn-secondary {
  background: var(--cream-dark);
}

.btn-mint {
  background: var(--accent-mint);
}

.btn-coral {
  background: var(--accent-coral);
}

.btn-small {
  padding: 0.5rem 0.75rem;
  font-size: 0.75rem;
  box-shadow: 3px 3px 0 var(--shadow-color);
}

.btn-small:hover {
  box-shadow: 4px 4px 0 var(--shadow-color);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 8px;
}

/* Form Elements */
.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  opacity: 0.7;
}

.form-input,
.form-textarea {
  width: 100%;
  background: var(--cream-dark);
  color: var(--charcoal);
  border: var(--border-width) solid var(--charcoal);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  box-shadow: 3px 3px 0 var(--shadow-color);
  transition: box-shadow 0.15s ease;
}

.form-input:focus,
.form-textarea:focus {
  outline: none;
  box-shadow: 3px 3px 0 var(--accent-violet);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--charcoal);
  opacity: 0.4;
}

.form-textarea {
  resize: vertical;
  min-height: 100px;
}

/* Thread Post Box */
.thread-post {
  background: var(--cream-dark);
  border: var(--border-width) solid var(--charcoal);
  border-radius: 14px;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: 4px 4px 0 var(--shadow-color);
  position: relative;
}

.thread-post:focus-within {
  box-shadow: 4px 4px 0 var(--accent-violet);
}

.thread-post-number {
  position: absolute;
  top: -10px;
  left: 1rem;
  background: var(--accent-violet);
  color: var(--charcoal);
  font-family: 'Archivo Black', sans-serif;
  font-size: 0.7rem;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  border: 2px solid var(--charcoal);
}

.thread-post textarea {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--charcoal);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  resize: none;
  min-height: 80px;
}

.thread-post textarea:focus {
  outline: none;
}

.thread-post textarea::placeholder {
  color: var(--charcoal);
  opacity: 0.4;
}

.thread-post-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 2px dashed var(--charcoal);
  opacity: 0.3;
}

.thread-post:focus-within .thread-post-actions {
  opacity: 1;
}

.thread-post-char-count {
  font-size: 0.8rem;
  font-weight: 600;
}

.thread-post-char-count.warning {
  color: var(--accent-coral);
}

.thread-post-tools {
  display: flex;
  gap: 0.5rem;
}

.thread-connector {
  width: 3px;
  height: 20px;
  background: var(--charcoal);
  margin: -0.5rem auto 0.5rem 1.5rem;
  opacity: 0.3;
}

/* Image Preview */
.image-preview-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.image-preview {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 8px;
  border: 2px solid var(--charcoal);
  overflow: hidden;
}

.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-preview-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  background: var(--accent-coral);
  border: 2px solid var(--charcoal);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: bold;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1rem;
}

.modal {
  background: var(--cream);
  border: var(--border-width) solid var(--charcoal);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 8px 8px 0 var(--shadow-heavy);
  width: 100%;
  max-width: 440px;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 32px;
  height: 32px;
  background: var(--cream-dark);
  border: 2px solid var(--charcoal);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.25rem;
  transition: background 0.15s;
}

.modal-close:hover {
  background: var(--accent-coral);
}

.modal-title {
  font-family: 'Archivo Black', sans-serif;
  font-size: 1.1rem;
  margin-bottom: 1rem;
  padding-right: 2rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

/* Profile Card */
.profile-header {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 12px;
  border: var(--border-width) solid var(--charcoal);
  box-shadow: 3px 3px 0 var(--shadow-color);
  object-fit: cover;
}

.profile-info {
  flex: 1;
}

.profile-displayname {
  font-family: 'Archivo Black', sans-serif;
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
}

.profile-username {
  font-size: 0.9rem;
  opacity: 0.6;
  margin-bottom: 0.5rem;
}

.profile-stats {
  display: flex;
  gap: 1rem;
  font-size: 0.85rem;
}

.profile-stat-value {
  font-weight: 700;
}

.profile-stat-label {
  opacity: 0.6;
}

.profile-bio {
  margin-top: 1rem;
  font-size: 0.95rem;
  line-height: 1.5;
}

/* Post Card */
.post-card {
  background: var(--cream-dark);
  border: var(--border-width) solid var(--charcoal);
  border-radius: 14px;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: 4px 4px 0 var(--shadow-color);
}

.post-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.post-card-avatar {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 2px solid var(--charcoal);
}

.post-card-meta {
  flex: 1;
}

.post-card-author {
  font-weight: 700;
  font-size: 0.9rem;
}

.post-card-time {
  font-size: 0.8rem;
  opacity: 0.5;
}

.post-card-content {
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 0.75rem;
}

.post-card-content a {
  color: var(--accent-violet);
  text-decoration: underline;
}

.post-card-actions {
  display: flex;
  gap: 1rem;
  padding-top: 0.75rem;
  border-top: 2px dashed var(--charcoal);
  opacity: 0.5;
}

.post-card-action {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--charcoal);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  transition: background 0.15s, opacity 0.15s;
}

.post-card-action:hover {
  background: var(--cream);
  opacity: 1;
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--cream-dark);
  border: var(--border-width) solid var(--charcoal);
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
  box-shadow: 3px 3px 0 var(--shadow-color);
}

.stat-card-value {
  font-family: 'Archivo Black', sans-serif;
  font-size: 1.75rem;
  color: var(--accent-violet);
}

.stat-card-label {
  font-size: 0.8rem;
  opacity: 0.6;
  margin-top: 0.25rem;
}

.stat-card-change {
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 0.5rem;
}

.stat-card-change.positive {
  color: var(--accent-mint);
}

.stat-card-change.negative {
  color: var(--accent-coral);
}

/* Loading State */
.loading-placeholder {
  background: var(--cream-dark);
  border-radius: 8px;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.7; }
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  opacity: 0.5;
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 1rem;
  display: block;
}

/* Animations */
@keyframes bounce-in {
  0% {
    transform: scale(0.85);
    opacity: 0.4;
  }
  60% {
    transform: scale(1.05);
    opacity: 1;
  }
  80% {
    transform: scale(0.97);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.animate-bounce-in {
  animation: bounce-in 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes slide-in {
  0% {
    opacity: 0;
    transform: translateY(-16px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-slide-in {
  animation: slide-in 0.3s ease-out both;
}

/* Responsive */
@media (max-width: 640px) {
  .header-title {
    position: static;
    transform: none;
    font-size: 1.25rem;
  }

  .header {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .back-link {
    order: 1;
  }

  .header-title {
    order: 3;
    width: 100%;
    text-align: center;
    margin-top: 0.5rem;
  }

  .header-spacer {
    order: 2;
  }

  .main {
    padding: 1rem;
  }

  .card {
    padding: 1.25rem;
    border-radius: 16px;
  }

  .tab-container {
    flex-wrap: wrap;
    justify-content: center;
  }

  .tab-link {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .profile-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .profile-stats {
    justify-content: center;
  }
}

/* Image Viewer Modal */
.image-viewer {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.image-viewer.show {
  display: flex;
}

.image-viewer img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 8px;
}

.image-viewer-close {
  position: absolute;
  top: 1rem;
  left: 1rem;
  color: white;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.image-viewer-close:hover {
  opacity: 1;
}

/* Profile Card Popover */
.profile-card-popover {
  position: absolute;
  z-index: 100;
  min-width: 260px;
  max-width: 320px;
  background: var(--cream);
  color: var(--charcoal);
  border: var(--border-width) solid var(--charcoal);
  border-radius: 12px;
  box-shadow: 6px 6px 0 var(--shadow-color);
  padding: 1rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease;
}

.profile-card-popover.visible {
  opacity: 1;
  visibility: visible;
}

.profile-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.profile-card-avatar {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  border: 2px solid var(--charcoal);
}

.profile-card-displayname {
  font-weight: 700;
  font-size: 1rem;
  color: var(--accent-violet);
}

.profile-card-username {
  font-size: 0.85rem;
  opacity: 0.6;
}

.profile-card-stats {
  display: flex;
  gap: 1rem;
  margin: 0.5rem 0;
  font-size: 0.8rem;
}

.profile-card-note {
  font-size: 0.85rem;
  line-height: 1.4;
  margin-top: 0.5rem;
}

/* Emoji Picker */
.emoji-picker-popup {
  background: var(--cream);
  border: var(--border-width) solid var(--charcoal);
  border-radius: 12px;
  box-shadow: 6px 6px 0 var(--shadow-color);
  padding: 0.75rem;
  max-width: 320px;
  max-height: 260px;
  overflow: auto;
  z-index: 100;
  opacity: 0;
  transform: scale(0.95) translateY(8px);
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.emoji-picker-popup.emoji-picker-animate-in {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}

.emoji-picker-grid {
  display: grid;
  grid-template-columns: repeat(8, 32px);
  gap: 6px;
}

.emoji-btn {
  background: none;
  border: none;
  padding: 4px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.emoji-btn:hover {
  background: var(--accent-violet);
}

.emoji-btn img {
  width: 24px;
  height: 24px;
  display: block;
}

/* Checkbox */
.checkbox-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.checkbox-container input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent-violet);
}

/* Hidden utility */
.hidden {
  display: none !important;
}

/* ========================================
   TAILWIND COMPATIBILITY CLASSES
   For dynamically generated UI in script.js
   ======================================== */

/* Spacing */
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.ml-2 { margin-left: 0.5rem; }
.ml-1 { margin-left: 0.25rem; }
.mr-1 { margin-right: 0.25rem; }
.mr-2 { margin-right: 0.5rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.p-4 { padding: 1rem; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }

/* Layout */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.block { display: block; }
.inline-block { display: inline-block; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.relative { position: relative; }
.absolute { position: absolute; }
.inset-0 { inset: 0; }

/* Sizing */
.w-full { width: 100%; }
.w-4 { width: 1rem; }
.w-5 { width: 1.25rem; }
.w-10 { width: 2.5rem; }
.w-16 { width: 4rem; }
.w-64 { width: 16rem; }
.h-4 { height: 1rem; }
.h-5 { height: 1.25rem; }
.h-10 { height: 2.5rem; }
.h-16 { height: 4rem; }
.min-w-0 { min-width: 0; }
.max-w-none { max-width: none; }

/* Typography */
.text-xs { font-size: 0.75rem; line-height: 1rem; }
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
.text-md { font-size: 1rem; line-height: 1.5rem; }
.text-lg { font-size: 1.125rem; line-height: 1.75rem; }
.text-xl { font-size: 1.25rem; line-height: 1.75rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.select-none { user-select: none; }
.underline { text-decoration: underline; }

/* Colors - Gray Scale */
.text-gray-200 { color: #e5e7eb; }
.text-gray-300 { color: #d1d5db; }
.text-gray-400 { color: #9ca3af; }
.text-gray-500 { color: #6b7280; }
.text-gray-600 { color: #4b5563; }
.text-gray-700 { color: #374151; }
.bg-gray-200 { background-color: #e5e7eb; }
.bg-gray-800 { background-color: #1f2937; }
.border-gray-300 { border-color: #d1d5db; }
.border-gray-600 { border-color: #4b5563; }
.border-gray-700 { border-color: #374151; }

/* Colors - Purple (Accent Violet) */
.text-purple-600 { color: var(--accent-violet); }
.text-purple-700 { color: var(--accent-violet-dark); }
.text-purple-900 { color: #581c87; }
.text-purple-300 { color: #c4b5fd; }
.text-purple-100 { color: #ede9fe; }
.bg-purple-50 { background-color: #faf5ff; }
.bg-purple-100 { background-color: #ede9fe; }
.bg-purple-200 { background-color: #ddd6fe; }
.bg-purple-600 { background-color: var(--accent-violet); }
.bg-purple-700 { background-color: var(--accent-violet-dark); }
.border-purple-200 { border-color: #ddd6fe; }
.border-purple-400 { border-color: #a78bfa; }
.masto-bg-purple\/5 { background-color: rgba(155, 93, 229, 0.05); }
.ring-4 { box-shadow: 0 0 0 4px var(--accent-violet); }
.ring-purple-300\/50 { box-shadow: 0 0 0 4px rgba(196, 181, 253, 0.5); }

/* Colors - Other */
.text-black { color: #000; }
.text-white { color: #fff; }
.text-red-500 { color: #ef4444; }
.bg-white { background-color: #fff; }
.bg-white\/80 { background-color: rgba(255, 255, 255, 0.8); }
.bg-purple-600\/70 { background-color: rgba(155, 93, 229, 0.7); }

/* Borders */
.border { border-width: 1px; border-style: solid; border-color: var(--charcoal); }
.border-2 { border-width: 2px; }
.border-dashed { border-style: dashed; }
.rounded { border-radius: 0.25rem; }
.rounded-lg { border-radius: 0.5rem; }
.rounded-bl { border-bottom-left-radius: 0.25rem; }
.rounded-full { border-radius: 9999px; }

/* Effects */
.shadow { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); }
.shadow-lg { box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1); }
.opacity-60 { opacity: 0.6; }
.opacity-70 { opacity: 0.7; }
.opacity-80 { opacity: 0.8; }

/* Transitions */
.transition { transition: all 0.15s ease; }
.transition-all { transition: all 0.15s ease; }
.transition-opacity { transition: opacity 0.15s ease; }

/* Cursor */
.cursor-pointer { cursor: pointer; }
.cursor-not-allowed { cursor: not-allowed; }
.pointer-events-none { pointer-events: none; }

/* Z-Index */
.z-20 { z-index: 20; }
.z-30 { z-index: 30; }
.z-50 { z-index: 50; }

/* Focus */
.focus\:outline-none:focus { outline: none; }

/* Dark Mode Overrides */
.dark .text-gray-200 { color: #e5e7eb; }
.dark .text-gray-300 { color: #d1d5db; }
.dark .text-gray-400 { color: #9ca3af; }
.dark .text-gray-500 { color: #6b7280; }
.dark .dark\:text-gray-200 { color: #e5e7eb; }
.dark .dark\:text-gray-300 { color: #d1d5db; }
.dark .dark\:text-gray-400 { color: #9ca3af; }
.dark .dark\:text-white { color: #fff; }
.dark .dark\:text-purple-100 { color: #ede9fe; }
.dark .dark\:text-purple-300 { color: #c4b5fd; }
.dark .dark\:bg-gray-800 { background-color: #1f2937; }
.dark .dark\:bg-purple-200 { background-color: rgba(155, 93, 229, 0.15); }
.dark .dark\:bg-purple-900 { background-color: rgba(155, 93, 229, 0.3); }
.dark .dark\:border-gray-600 { border-color: #4b5563; }
.dark .dark\:border-gray-700 { border-color: #374151; }

/* Hover States */
.hover\:bg-purple-200:hover { background-color: #ddd6fe; }
.hover\:bg-purple-700:hover { background-color: var(--accent-violet-dark); }
.hover\:bg-gray-300:hover { background-color: #d1d5db; }
.hover\:text-red-500:hover { color: #ef4444; }
.hover\:text-purple-500:hover { color: var(--accent-violet); }
.hover\:text-purple-900:hover { color: #581c87; }
.hover\:underline:hover { text-decoration: underline; }
.hover\:shadow:hover { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); }
.hover\:bg-purple-100:hover { background-color: #ede9fe; }
.group:hover .group-hover\:opacity-100 { opacity: 1; }

/* Dark Hover States */
.dark .dark\:hover\:bg-gray-700:hover { background-color: #374151; }
.dark .dark\:hover\:text-gray-200:hover { color: #e5e7eb; }
.dark .dark\:hover\:bg-purple-900:hover { background-color: rgba(155, 93, 229, 0.3); }

/* Animation */
@keyframes spin {
  to { transform: rotate(360deg); }
}
.animate-spin { animation: spin 1s linear infinite; }

@keyframes thread-slidein {
  from {
    opacity: 0;
    transform: translateY(-12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.animate-thread-slidein {
  animation: thread-slidein 0.25s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Alignment */
.align-middle { vertical-align: middle; }

/* Overflow */
.overflow-hidden { overflow: hidden; }
.overflow-y-auto { overflow-y: auto; }

/* Object Fit */
.object-cover { object-fit: cover; }

/* Additional group styling */
.group { position: relative; }

/* Prose (simplified for post content) */
.prose { max-width: 65ch; }
.prose a { color: var(--accent-violet); text-decoration: underline; }
.prose-sm { font-size: 0.875rem; line-height: 1.5; }
.dark .dark\:prose-invert { color: var(--charcoal); }

/* Visibility Dropdown Specific */
#vis-dropdown-list {
  background: var(--cream);
  border: var(--border-width) solid var(--charcoal);
  box-shadow: 4px 4px 0 var(--shadow-color);
}

.dark #vis-dropdown-list {
  background: var(--cream);
}

#vis-dropdown-btn {
  background: var(--cream-dark);
  border: var(--border-width) solid var(--charcoal);
  box-shadow: 3px 3px 0 var(--shadow-color);
  transition: transform 0.15s, box-shadow 0.15s;
}

#vis-dropdown-btn:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--shadow-color);
}

/* Override for dynamically generated textareas */
#thread-posts textarea {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--charcoal);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.95rem;
  resize: none;
  min-height: 60px;
}

#thread-posts textarea:focus {
  outline: none;
}

/* Thread post dropzone styling */
#thread-posts > div[id^="dropzone-"] {
  background: var(--cream-dark);
  border: var(--border-width) solid var(--charcoal);
  border-radius: 14px;
  box-shadow: 4px 4px 0 var(--shadow-color);
}

#thread-posts > div[id^="dropzone-"]:has(textarea:focus) {
  box-shadow: 4px 4px 0 var(--accent-violet);
}

/* Login/OAuth form styling overrides */
#instance-url-form input,
#oauth-code-form input {
  background: var(--cream-dark);
  color: var(--charcoal);
  border: var(--border-width) solid var(--charcoal);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  box-shadow: 3px 3px 0 var(--shadow-color);
}

#instance-url-form input:focus,
#oauth-code-form input:focus {
  outline: none;
  box-shadow: 3px 3px 0 var(--accent-violet);
}

#instance-url-form button,
#oauth-code-form button,
#cancel-oauth {
  background: var(--accent-violet);
  color: var(--charcoal);
  border: var(--border-width) solid var(--charcoal);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  font-family: 'Archivo Black', sans-serif;
  font-size: 0.85rem;
  cursor: pointer;
  box-shadow: 4px 4px 0 var(--shadow-color);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

#instance-url-form button:hover,
#oauth-code-form button:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--shadow-color);
}

#instance-url-form button:active,
#oauth-code-form button:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--shadow-color);
}

#cancel-oauth {
  background: var(--cream-dark);
}

/* Add Post and Publish buttons in thread form */
#thread-form button[type="button"],
#thread-form button[type="submit"] {
  background: var(--accent-violet);
  color: var(--charcoal);
  border: var(--border-width) solid var(--charcoal);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  font-family: 'Archivo Black', sans-serif;
  font-size: 0.85rem;
  cursor: pointer;
  box-shadow: 4px 4px 0 var(--shadow-color);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

#thread-form button:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--shadow-color);
}

#thread-form button:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--shadow-color);
}

#add-post {
  background: var(--cream-dark) !important;
}

/* Image remove X button - override broad thread form button styles */
#thread-posts button[onclick^="removeImage"] {
  background: rgba(0, 0, 0, 0.6) !important;
  color: #fff !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 2px 5px !important;
  font-size: 14px !important;
  font-family: sans-serif !important;
  box-shadow: none !important;
  line-height: 1 !important;
}

#thread-posts button[onclick^="removeImage"]:hover {
  background: var(--accent-coral) !important;
  transform: none !important;
  box-shadow: none !important;
}

/* Image upload button in posts */
#thread-posts button[onclick^="triggerImagePicker"] {
  background: var(--cream-dark) !important;
  border: 2px solid var(--charcoal) !important;
  border-radius: 8px !important;
  padding: 0.5rem 0.75rem !important;
  box-shadow: 2px 2px 0 var(--shadow-color) !important;
}

/* Logout button */
#logout-btn {
  background: var(--cream-dark);
  border: 2px solid var(--charcoal);
  border-radius: 6px;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s;
}

#logout-btn:hover {
  background: var(--accent-coral);
  color: var(--charcoal);
}

/* Profile avatar in composer */
.profile-card-avatar.\!w-8 { width: 32px !important; }
.profile-card-avatar.\!h-8 { height: 32px !important; }
.profile-card-avatar.\!border-2 { border-width: 2px !important; }
.profile-card-avatar.\!border-purple-400 { border-color: #a78bfa !important; }

/* SR Only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Profile stat link */
.profile-card-stat-link {
  color: var(--accent-violet);
  text-decoration: none;
}

.profile-card-stat-link:hover {
  text-decoration: underline;
}

/* Border width fix for dynamically generated elements */
.top-0 { top: 0; }
.top-2 { top: 0.5rem; }
.right-0 { right: 0; }
.right-2 { right: 0.5rem; }
.left-0 { left: 0; }
.bottom-0 { bottom: 0; }

/* Fix for reply-to content box */
[id^="thread-posts"] .border-purple-400.border-dashed {
  background: rgba(155, 93, 229, 0.05);
}

/* Remove button in posts */
button[onclick^="removeThreadPost"] {
  background: none;
  border: none;
  padding: 0.25rem;
  cursor: pointer;
}

/* Spinner for publishing state */
.border-t-transparent {
  border-top-color: transparent;
}

/* Additional Tailwind classes for profile.js, timeline.js, stats.js */

/* Grid */
.grid { display: grid; }
.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.gap-1 { gap: 0.25rem; }
.gap-3 { gap: 0.75rem; }
.gap-6 { gap: 1.5rem; }
.space-y-4 > * + * { margin-top: 1rem; }

/* Flex */
.flex-1 { flex: 1 1 0%; }
.min-w-0 { min-width: 0; }

/* Responsive */
@media (min-width: 768px) {
  .md\:flex-row { flex-direction: row; }
  .md\:text-left { text-align: left; }
  .md\:items-start { align-items: flex-start; }
  .md\:justify-start { justify-content: flex-start; }
}

/* Additional spacing */
.py-0\.5 { padding-top: 0.125rem; padding-bottom: 0.125rem; }
.p-0\.5 { padding: 0.125rem; }
.p-2 { padding: 0.5rem; }
.p-2\.5 { padding: 0.625rem; }
.pt-1\.5 { padding-top: 0.375rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-1\.5 { margin-bottom: 0.375rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-3 { margin-top: 0.75rem; }
.mx-auto { margin-left: auto; margin-right: auto; }

/* Additional colors */
.text-pink-600 { color: #db2777; }
.text-pink-400 { color: #f472b6; }
.text-green-500 { color: #22c55e; }
.text-green-600 { color: #16a34a; }
.text-green-400 { color: #4ade80; }
.text-blue-500 { color: #3b82f6; }
.text-yellow-500 { color: #eab308; }
.text-gray-800 { color: #1f2937; }
.text-gray-900 { color: #111827; }
.bg-black\/70 { background-color: rgba(0, 0, 0, 0.7); }
.bg-gray-100 { background-color: #f3f4f6; }
.bg-gray-700 { background-color: #374151; }
.bg-purple-800 { background-color: #6b21a8; }
.bg-purple-900\/30 { background-color: rgba(88, 28, 135, 0.3); }
.border-gray-100 { border-color: #f3f4f6; }
.border-gray-200 { border-color: #e5e7eb; }
.border-purple-300 { border-color: #c4b5fd; }

/* Dark mode additional colors */
.dark .dark\:bg-gray-700 { background-color: #374151; }
.dark .dark\:text-gray-100 { color: #f3f4f6; }
.dark .dark\:text-pink-400 { color: #f472b6; }
.dark .dark\:text-green-400 { color: #4ade80; }
.dark .dark\:hover\:text-purple-400:hover { color: #a78bfa; }
.dark .dark\:hover\:text-pink-400:hover { color: #f472b6; }
.dark .dark\:hover\:text-green-400:hover { color: #4ade80; }
.dark .dark\:border-gray-700 { border-color: #374151; }

/* Hover color variants */
.hover\:text-purple-600:hover { color: var(--accent-violet); }
.hover\:text-purple-800:hover { color: #6b21a8; }
.hover\:text-pink-600:hover { color: #db2777; }
.hover\:text-green-600:hover { color: #16a34a; }

/* Text utilities */
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.whitespace-nowrap { white-space: nowrap; }
.leading-snug { line-height: 1.375; }

/* Sizing */
.w-8 { width: 2rem; }
.w-10 { width: 2.5rem; }
.w-16 { width: 4rem; }
.w-24 { width: 6rem; }
.w-48 { width: 12rem; }
.w-64 { width: 16rem; }
.h-8 { height: 2rem; }
.h-10 { height: 2.5rem; }
.h-16 { height: 4rem; }
.h-24 { height: 6rem; }

/* Border radius */
.rounded-full { border-radius: 9999px; }

/* Animation */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.animate-pulse { animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }

/* Positioning */
.top-1 { top: 0.25rem; }
.right-1 { right: 0.25rem; }
.bottom-0 { bottom: 0; }

/* Font icons sizing */
.far { font-family: "Font Awesome 6 Free"; font-weight: 400; }
.fas { font-family: "Font Awesome 6 Free"; font-weight: 900; }

/* Additional post styling */
.bg-white { background-color: #fff; }
.dark .dark\:bg-gray-800 { background-color: #1f2937; }

/* Button base styling for dynamically generated buttons */
button.reply-btn,
button.like-btn,
button.boost-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 4px;
  transition: color 0.15s ease;
}

button.reply-btn:hover,
button.like-btn:hover,
button.boost-btn:hover {
  background: var(--cream-dark);
}

/* Stats page specific styling */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

@media (max-width: 640px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* Stat card tiles - Workshop Toolbox style */
.stats-grid > div,
.stats-grid .bg-purple-50 {
  background: var(--cream-dark) !important;
  border: var(--border-width) solid var(--charcoal) !important;
  border-radius: 12px !important;
  padding: 1rem !important;
  box-shadow: 3px 3px 0 var(--shadow-color) !important;
}

/* Stat card label (Likes, Boosts, Replies) */
.stats-grid .text-purple-700,
.stats-grid .text-sm.font-medium {
  color: var(--accent-violet) !important;
  font-weight: 600 !important;
}

/* Stat card big number */
.stats-grid .text-2xl,
.stats-grid .text-lg {
  color: var(--charcoal) !important;
  font-family: 'Archivo Black', sans-serif !important;
}

/* Stat card small text (avg per post) */
.stats-grid .text-xs {
  color: var(--charcoal) !important;
  opacity: 0.6;
}

/* Trend indicators */
.stats-grid .text-green-500 {
  color: var(--accent-mint) !important;
}

.stats-grid .text-red-500 {
  color: var(--accent-coral) !important;
}

/* Dark mode overrides for stat cards */
.dark .stats-grid > div,
.dark .stats-grid .bg-purple-50,
.dark .stats-grid .dark\:bg-purple-900\/30 {
  background: var(--cream-dark) !important;
}

/* Loading state animation */
.h-4 { height: 1rem; }
.h-24 { height: 6rem; }

/* Transition colors */
.transition-colors { transition: color 0.15s ease; }

/* Profile/timeline post styling */
#timeline-posts .bg-white,
#posts-list .bg-white {
  background: var(--cream-dark);
  border: var(--border-width) solid var(--charcoal);
  border-radius: 12px;
  box-shadow: 3px 3px 0 var(--shadow-color);
}

#timeline-posts .border-gray-200,
#posts-list .border-gray-200 {
  border-color: var(--charcoal);
}

#timeline-posts .border-purple-300,
#posts-list .border-purple-300 {
  border-color: var(--accent-violet);
}

/* Profile field styling */
.field-value-container a {
  color: var(--accent-violet);
}

/* Text size */
.text-2xl { font-size: 1.5rem; line-height: 2rem; }

/* Retry button styling */
#retry-timeline {
  background: var(--accent-violet);
  color: var(--charcoal);
  border: var(--border-width) solid var(--charcoal);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  font-family: 'Archivo Black', sans-serif;
  font-size: 0.85rem;
  cursor: pointer;
  box-shadow: 4px 4px 0 var(--shadow-color);
}

/* General a tag with button styles */
a.bg-purple-600 {
  background: var(--accent-violet);
  color: var(--charcoal);
  border: var(--border-width) solid var(--charcoal);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  font-family: 'Archivo Black', sans-serif;
  font-size: 0.85rem;
  cursor: pointer;
  box-shadow: 4px 4px 0 var(--shadow-color);
  text-decoration: none;
  display: inline-block;
}

a.bg-purple-600:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--shadow-color);
}

/* Border top styling */
.border-t { border-top-width: 1px; border-top-style: solid; }
.pt-4 { padding-top: 1rem; }
.pt-3 { padding-top: 0.75rem; }

/* ========================================
   COMMAND PALETTE STYLES
   ======================================== */

#command-palette {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  padding: 1rem;
}

#command-palette .palette-content {
  background: var(--cream);
  border: var(--border-width) solid var(--charcoal);
  border-radius: 16px;
  box-shadow: 8px 8px 0 var(--shadow-heavy);
  width: 100%;
  max-width: 480px;
  padding: 1rem;
  position: relative;
}

#command-palette .palette-content.menu-visible {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}

#palette-options {
  list-style: none;
  padding: 0;
  margin: 0;
}

#palette-options li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  cursor: pointer;
  color: var(--charcoal);
  font-weight: 500;
  transition: all 0.15s ease;
  border: 2px solid transparent;
  margin-bottom: 0.5rem;
}

#palette-options li:last-child {
  margin-bottom: 0;
}

#palette-options li:hover,
#palette-options li.bg-purple-100,
#palette-options li[aria-selected="true"] {
  background: var(--accent-violet);
  border-color: var(--charcoal);
  box-shadow: 3px 3px 0 var(--shadow-color);
}

#palette-options li span:last-child {
  font-family: 'DM Sans', monospace;
  font-size: 0.75rem;
  opacity: 0.6;
  background: var(--cream-dark);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--charcoal);
}

/* Additional missing utilities */
.fixed { position: fixed; }
.bg-black\/20 { background-color: rgba(0, 0, 0, 0.2); }
.shadow-2xl { box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); }
.max-w-full { max-width: 100%; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.font-mono { font-family: ui-monospace, monospace; }

/* Dark mode for command palette */
.dark #command-palette .palette-content {
  background: var(--cream);
}

.dark #palette-options li {
  color: var(--charcoal);
}

.dark #palette-options li:hover,
.dark #palette-options li.bg-purple-100,
.dark #palette-options li[aria-selected="true"] {
  background: var(--accent-violet);
}
