/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  /* Color Palette */
  --bg-primary: #FAFAF7;
  --bg-card: #FFFFFF;
  --accent-sage: #8FA89F;
  --accent-green: #6BA07E;
  --text-primary: #2C3333;
  --text-secondary: #666666;
  --text-muted: #999999;
  --border-light: #E8E8E3;
  --error: #D9534F;
  --hover-sage: #7A9489;
  --hover-green: #5A8F6D;

  /* Typography */
  --font-heading: 'Inter Display', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Lexend', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 0.75rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

/* Header */
.header {
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
  padding: var(--space-xl) 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.logo {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent-sage);
  margin-bottom: var(--space-xs);
}

.tagline {
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-weight: 400;
}

/* Main Content */
.main {
  padding: var(--space-2xl) 0;
}

/* Compose Section */
.compose-section {
  margin-bottom: var(--space-2xl);
}

.compose-box {
  background-color: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-lg);
  transition: box-shadow 0.2s ease;
}

.compose-box:focus-within {
  box-shadow: var(--shadow-lg);
}

.compose-textarea {
  width: 100%;
  min-height: 120px;
  padding: var(--space-md);
  border: 2px solid var(--border-light);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 300;
  color: var(--text-primary);
  resize: vertical;
  transition: border-color 0.2s ease;
}

.compose-textarea:focus {
  outline: none;
  border-color: var(--accent-sage);
}

.compose-textarea::placeholder {
  color: var(--text-muted);
}

.compose-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--space-md);
}

.char-count {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 400;
}

.post-button {
  background-color: var(--accent-green);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: var(--space-sm) var(--space-xl);
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.post-button:hover:not(:disabled) {
  background-color: var(--hover-green);
  transform: translateY(-1px);
}

.post-button:active:not(:disabled) {
  transform: translateY(0);
}

.post-button:disabled {
  background-color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.5;
}

/* Feed Section */
.feed-section {
  margin-bottom: var(--space-2xl);
}

.feed-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-lg);
}

.feed {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.loading {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--text-secondary);
  font-style: italic;
}

.empty-state {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--text-secondary);
}

.empty-state p {
  margin-bottom: var(--space-md);
}

/* Post Card */
.post-card {
  background-color: var(--bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  padding: var(--space-lg);
  transition: box-shadow 0.2s ease;
  animation: fadeIn 0.3s ease;
}

.post-card:hover {
  box-shadow: var(--shadow-md);
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.post-content {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
  white-space: pre-wrap;
  word-wrap: break-word;
}

.post-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--space-sm);
  border-top: 1px solid var(--border-light);
}

.post-time {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 400;
}

.report-button {
  background: none;
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: var(--space-xs) var(--space-md);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 400;
  cursor: pointer;
  transition: all 0.2s ease;
}

.report-button:hover {
  border-color: var(--error);
  color: var(--error);
  background-color: rgba(217, 83, 79, 0.05);
}

.report-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Footer */
.footer {
  background-color: var(--bg-card);
  border-top: 1px solid var(--border-light);
  padding: var(--space-xl) 0;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* Error/Success Messages */
.message {
  padding: var(--space-md);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-md);
  animation: slideDown 0.3s ease;
}

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

.message.error {
  background-color: #FEF2F2;
  border: 1px solid #FECACA;
  color: var(--error);
}

.message.success {
  background-color: #F0FDF4;
  border: 1px solid #BBF7D0;
  color: var(--accent-green);
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 0 var(--space-md);
  }

  .header {
    padding: var(--space-lg) 0;
  }

  .logo {
    font-size: 1.75rem;
  }

  .tagline {
    font-size: 0.875rem;
  }

  .main {
    padding: var(--space-xl) 0;
  }

  .compose-box {
    padding: var(--space-md);
  }

  .compose-textarea {
    min-height: 100px;
    font-size: 1rem;
  }

  .post-button {
    padding: var(--space-sm) var(--space-lg);
    font-size: 0.9375rem;
  }

  .feed-title {
    font-size: 1.25rem;
  }

  .post-card {
    padding: var(--space-md);
  }
}

@media (max-width: 480px) {
  .compose-footer {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-sm);
  }

  .char-count {
    text-align: center;
  }

  .post-button {
    width: 100%;
  }

  .post-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }

  .report-button {
    width: 100%;
  }
}

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

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  :root {
    --border-light: #999999;
    --text-muted: #666666;
  }

  .compose-textarea:focus {
    border-width: 3px;
  }

  .post-button:focus,
  .report-button:focus {
    outline: 3px solid var(--accent-sage);
    outline-offset: 2px;
  }
}

/* Focus Visible for Keyboard Navigation */
:focus-visible {
  outline: 2px solid var(--accent-sage);
  outline-offset: 2px;
}

button:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent-sage);
  outline-offset: 2px;
}
