/**
 * ═══════════════════════════════════════════════════════════════════════════
 * WODDI Community v20 — Modern UI/UX
 * ═══════════════════════════════════════════════════════════════════════════
 * Brand Colors:
 * - Magenta: #D4006A (primary, accents, CTAs)
 * - Lemon Green: #7CB518 (success, highlights, positive actions)
 * - Black: #000000 (text, dark backgrounds)
 * - White: #FFFFFF (cards, content areas)
 * - Light Gray: #F5F5F5 (backgrounds, separators)
 * 
 * Designed for mobile-first PWA with native app feel.
 * ═══════════════════════════════════════════════════════════════════════════
 */

:root {
  --woddi-magenta: #D4006A;
  --woddi-magenta-dark: #a00450;
  --woddi-magenta-light: #f0e6ee;
  --woddi-green: #7CB518;
  --woddi-green-dark: #5a8810;
  --woddi-green-light: #e8f0d0;
  --woddi-black: #000000;
  --woddi-white: #ffffff;
  --woddi-gray-50: #fafafa;
  --woddi-gray-100: #f5f5f5;
  --woddi-gray-200: #e0e0e0;
  --woddi-gray-300: #d0d0d0;
  --woddi-gray-500: #999999;
  --woddi-gray-700: #555555;
  --woddi-gray-900: #222222;

  /* Typography */
  --font-primary: 'Inter', 'Segoe UI', sans-serif;
  --font-heading: 'Poppins', 'Roboto', sans-serif;

  /* Shadows */
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);
  --shadow-magenta: 0 4px 12px rgba(212, 0, 106, 0.2);

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;
}

/* ───────────────────────────────────────────────────────────────────────
   Community Container & Layout
   ─────────────────────────────────────────────────────────────────────── */

.community-wrapper {
  background: var(--woddi-gray-100);
  min-height: 100vh;
  padding-bottom: 20px;
}

.community-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 16px;
  background: var(--woddi-white);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
}

@media (max-width: 640px) {
  .community-container {
    border-radius: 8px;
    margin: 0;
    padding: 12px;
  }
}

/* ───────────────────────────────────────────────────────────────────────
   Header
   ─────────────────────────────────────────────────────────────────────── */

.community-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 3px solid var(--woddi-magenta);
}

.community-header h1,
.community-header h2 {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 700;
  color: var(--woddi-black);
  margin: 0;
  flex: 1;
}

.community-header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.community-header-action-btn {
  background: var(--woddi-green);
  color: var(--woddi-white);
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.community-header-action-btn:hover {
  background: var(--woddi-green-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(124, 181, 24, 0.3);
}

.community-header-action-btn:active {
  transform: translateY(0);
}

/* ───────────────────────────────────────────────────────────────────────
   Create Post Form
   ─────────────────────────────────────────────────────────────────────── */

.create-post-form {
  background: var(--woddi-green-light);
  border: 2px solid var(--woddi-green);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}

.create-post-form.hidden {
  display: none;
}

.form-group {
  margin-bottom: 16px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--woddi-gray-700);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-group input[type='text'],
.form-group input[type='email'],
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 12px;
  font-family: var(--font-primary);
  font-size: 15px;
  border: 1px solid var(--woddi-gray-300);
  border-radius: 8px;
  background: var(--woddi-white);
  color: var(--woddi-black);
  transition: all var(--transition-fast);
  box-sizing: border-box;
}

.form-group input[type='text']:focus,
.form-group input[type='email']:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--woddi-magenta);
  box-shadow: 0 0 0 3px rgba(212, 0, 106, 0.1);
}

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

.form-group select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
}

.form-submit-btn {
  background: var(--woddi-magenta);
  color: var(--woddi-white);
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.form-submit-btn:hover {
  background: var(--woddi-magenta-dark);
  transform: translateY(-2px);
  box-shadow: var(--shadow-magenta);
}

.form-submit-btn:active {
  transform: translateY(0);
}

.form-cancel-btn {
  background: var(--woddi-gray-200);
  color: var(--woddi-gray-700);
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.form-cancel-btn:hover {
  background: var(--woddi-gray-300);
}

/* ───────────────────────────────────────────────────────────────────────
   Posts Feed
   ─────────────────────────────────────────────────────────────────────── */

.posts-feed {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ───────────────────────────────────────────────────────────────────────
   Post Card
   ─────────────────────────────────────────────────────────────────────── */

.post-card {
  background: var(--woddi-white);
  border-left: 5px solid var(--woddi-magenta);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-normal);
  overflow: hidden;
}

.post-card:hover {
  box-shadow: var(--shadow-magenta);
  transform: translateY(-2px);
}

/* Post Header (Author Info) */
.post-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.post-author-avatar {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--woddi-magenta), var(--woddi-green));
  color: var(--woddi-white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 16px;
}

.post-header-info {
  flex: 1;
  min-width: 0;
}

.post-author-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--woddi-black);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.post-author-meta {
  font-size: 12px;
  color: var(--woddi-gray-500);
  margin: 2px 0 0 0;
}

.post-menu-btn {
  background: none;
  border: none;
  color: var(--woddi-gray-500);
  cursor: pointer;
  font-size: 20px;
  padding: 4px;
  transition: color var(--transition-fast);
}

.post-menu-btn:hover {
  color: var(--woddi-magenta);
}

/* Post Content */
.post-content-wrapper {
  margin-bottom: 12px;
}

.post-title {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 700;
  color: var(--woddi-black);
  margin: 0 0 8px 0;
  line-height: 1.4;
}

.post-body {
  font-size: 14px;
  color: var(--woddi-gray-700);
  line-height: 1.6;
  margin: 0;
}

.post-category-badge {
  display: inline-block;
  background: var(--woddi-magenta-light);
  color: var(--woddi-magenta);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  margin-top: 8px;
  text-transform: capitalize;
}

/* Post Actions (Engagement Buttons) */
.post-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--woddi-gray-200);
  margin-top: 12px;
}

.post-action-btn {
  background: none;
  border: none;
  color: var(--woddi-gray-500);
  cursor: pointer;
  font-size: 12px;
  padding: 6px 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--transition-fast);
  border-radius: 6px;
}

.post-action-btn:hover {
  color: var(--woddi-magenta);
  background: var(--woddi-magenta-light);
}

.post-action-btn.active {
  color: var(--woddi-magenta);
  font-weight: 600;
}

.post-action-count {
  font-size: 11px;
  color: inherit;
}

/* ───────────────────────────────────────────────────────────────────────
   Loading State
   ─────────────────────────────────────────────────────────────────────── */

.loading-posts {
  text-align: center;
  padding: 48px 24px;
  color: var(--woddi-gray-500);
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--woddi-gray-200);
  border-top-color: var(--woddi-magenta);
  border-radius: 50%;
  animation: spinner-spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

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

.loading-text {
  font-size: 14px;
  margin: 0;
}

/* ───────────────────────────────────────────────────────────────────────
   Empty State
   ─────────────────────────────────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 64px 24px;
  background: var(--woddi-gray-50);
  border-radius: 12px;
}

.empty-state-icon {
  font-size: 56px;
  margin-bottom: 12px;
  line-height: 1;
}

.empty-state-title {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  color: var(--woddi-black);
  margin: 0 0 8px 0;
}

.empty-state-text {
  font-size: 14px;
  color: var(--woddi-gray-500);
  margin: 0 0 16px 0;
  line-height: 1.6;
}

.empty-state-cta {
  background: var(--woddi-green);
  color: var(--woddi-white);
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-block;
}

.empty-state-cta:hover {
  background: var(--woddi-green-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(124, 181, 24, 0.3);
}

/* ───────────────────────────────────────────────────────────────────────
   Error State
   ─────────────────────────────────────────────────────────────────────── */

.error-message {
  background: #fee;
  border-left: 4px solid #d4006a;
  border-radius: 8px;
  padding: 16px;
  margin: 16px 0;
  color: #a00;
  font-size: 14px;
}

.error-message strong {
  display: block;
  margin-bottom: 4px;
}

/* ───────────────────────────────────────────────────────────────────────
   Success State
   ─────────────────────────────────────────────────────────────────────── */

.success-message {
  background: var(--woddi-green-light);
  border-left: 4px solid var(--woddi-green);
  border-radius: 8px;
  padding: 16px;
  margin: 16px 0;
  color: var(--woddi-green-dark);
  font-size: 14px;
}

.success-message strong {
  display: block;
  margin-bottom: 4px;
}

/* ───────────────────────────────────────────────────────────────────────
   Responsive Design
   ─────────────────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
  .community-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .community-header h1,
  .community-header h2 {
    font-size: 20px;
  }

  .community-header-actions {
    width: 100%;
  }

  .community-header-action-btn {
    flex: 1;
    justify-content: center;
  }

  .post-card {
    border-left-width: 4px;
  }

  .form-actions {
    flex-direction: column-reverse;
  }

  .form-submit-btn,
  .form-cancel-btn {
    width: 100%;
  }
}

/* ───────────────────────────────────────────────────────────────────────
   Dark Mode Support (Optional)
   ─────────────────────────────────────────────────────────────────────── */

@media (prefers-color-scheme: dark) {
  :root {
    --woddi-white: #1a1a1a;
    --woddi-gray-50: #121212;
    --woddi-gray-100: #2a2a2a;
    --woddi-gray-200: #3a3a3a;
    --woddi-gray-700: #aaa;
    --woddi-gray-900: #eee;
  }

  .community-wrapper {
    background: var(--woddi-gray-900);
  }

  .post-card {
    background: var(--woddi-gray-100);
  }

  .form-group input,
  .form-group textarea,
  .form-group select {
    background: var(--woddi-gray-50);
  }

  .empty-state {
    background: var(--woddi-gray-100);
  }
}

/* ───────────────────────────────────────────────────────────────────────
   Accessibility
   ─────────────────────────────────────────────────────────────────────── */

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

/* Focus styles for keyboard navigation */
button:focus,
input:focus,
textarea:focus,
select:focus {
  outline: 2px solid var(--woddi-magenta);
  outline-offset: 2px;
}

/* Utility Classes */
.hidden {
  display: none !important;
}

.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;
}
