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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f8f9fa;
  color: #1a1a2e;
  min-height: 100vh;
  padding-bottom: 140px;
}

/* HEADER */
.app-header {
  background: #ffffff;
  padding: 16px 20px;
  border-bottom: 1px solid #e9ecef;
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-logo {
  height: 40px;
  width: auto;
}

.app-header h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1a1a2e;
}

.subtitle {
  font-size: 0.75rem;
  color: #6c757d;
  display: none;
}

/* TAB BAR */
.tab-bar {
  display: flex;
  background: #ffffff;
  border-bottom: 2px solid #e9ecef;
  padding: 0 8px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.tab-btn {
  flex: 1;
  padding: 12px 8px;
  border: none;
  background: transparent;
  font-size: 0.9rem;
  font-weight: 500;
  color: #6c757d;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
}

.tab-btn.active {
  color: #4361ee;
  border-bottom-color: #4361ee;
  font-weight: 600;
}

.tab-btn:hover {
  color: #4361ee;
}

/* SORT BAR */
.sort-bar {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  background: #ffffff;
  border-bottom: 1px solid #e9ecef;
}

.sort-btn {
  padding: 6px 14px;
  border: 1px solid #e9ecef;
  border-radius: 20px;
  background: #ffffff;
  font-size: 0.8rem;
  color: #6c757d;
  cursor: pointer;
}

.sort-btn.active {
  background: #4361ee;
  color: #ffffff;
  border-color: #4361ee;
}

/* IDEAS CONTAINER */
.ideas-container {
  padding: 12px 16px;
  max-width: 640px;
  margin: 0 auto;
}

/* IDEA CARD */
.idea-card {
  background: #ffffff;
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.idea-card.new {
  animation: fadeIn 0.4s ease-out;
}

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

/* IDEA BODY */
.idea-body {
  flex: 1;
}

/* VOTE SECTION - like/dislike horizontal */
.vote-section {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #f0f0f0;
}

.vote-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: 1px solid #e9ecef;
  border-radius: 20px;
  cursor: pointer;
  padding: 6px 12px;
  color: #6c757d;
  transition: all 0.2s;
  font-size: 0.85rem;
}

.vote-btn:hover {
  background: #f8f9fa;
}

.vote-btn svg {
  flex-shrink: 0;
}

.vote-btn.liked {
  color: #4361ee;
  border-color: #4361ee;
  background: #eef0ff;
}

.vote-btn.disliked {
  color: #e74c3c;
  border-color: #e74c3c;
  background: #fef0ee;
}

.vote-count {
  font-weight: 600;
  font-size: 0.8rem;
  min-width: 4px;
}

/* COMMENT TOGGLE */
.comment-toggle-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: 1px solid #e9ecef;
  border-radius: 20px;
  cursor: pointer;
  padding: 6px 12px;
  color: #6c757d;
  transition: all 0.2s;
  font-size: 0.85rem;
  margin-left: auto;
}

.comment-toggle-btn:hover {
  background: #f8f9fa;
  color: #4361ee;
}

.comment-count {
  font-weight: 600;
  font-size: 0.8rem;
}

/* IDEA OWN ACTIONS */
.idea-own-actions {
  display: inline-flex;
  gap: 4px;
  margin-left: 8px;
}

.idea-edit-btn,
.idea-delete-btn {
  background: none;
  border: 1px solid #e9ecef;
  border-radius: 12px;
  padding: 1px 8px;
  font-size: 0.7rem;
  color: #6c757d;
  cursor: pointer;
}

.idea-edit-btn:hover {
  color: #4361ee;
  border-color: #4361ee;
}

.idea-delete-btn:hover {
  color: #e74c3c;
  border-color: #e74c3c;
}

/* COMMENTS SECTION */
.comments-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #f0f0f0;
}

.comment-item {
  display: flex;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid #f8f9fa;
  align-items: flex-start;
}

.comment-item:last-child {
  border-bottom: none;
}

.comment-body {
  flex: 1;
}

.comment-text {
  font-size: 0.85rem;
  line-height: 1.4;
  color: #1a1a2e;
  margin-bottom: 4px;
}

.comment-meta {
  font-size: 0.7rem;
  color: #adb5bd;
}

.comment-votes {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.comment-votes .vote-btn {
  padding: 3px 8px;
  font-size: 0.75rem;
  border-radius: 14px;
}

.comment-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.comment-own-actions {
  display: flex;
  gap: 4px;
}

.comment-edit-btn,
.comment-delete-btn {
  background: none;
  border: 1px solid #e9ecef;
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 0.7rem;
  color: #6c757d;
  cursor: pointer;
}

.comment-edit-btn:hover {
  color: #4361ee;
  border-color: #4361ee;
}

.comment-delete-btn:hover {
  color: #e74c3c;
  border-color: #e74c3c;
}

/* COMMENT FORM */
.comment-form {
  margin-top: 8px;
}

.comment-form-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.comment-input {
  flex: 1;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.8rem;
  outline: none;
  font-family: inherit;
}

.comment-input:focus {
  border-color: #4361ee;
}

.comment-author-input {
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.8rem;
  width: 110px;
  outline: none;
  font-family: inherit;
}

.comment-author-input:focus {
  border-color: #4361ee;
}

.comment-submit-btn {
  background: #4361ee;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.comment-submit-btn:hover {
  background: #3651d4;
}

.idea-text {
  font-size: 0.95rem;
  line-height: 1.5;
  color: #1a1a2e;
  margin-bottom: 8px;
}

.idea-meta {
  font-size: 0.75rem;
  color: #adb5bd;
}

.idea-author {
  color: #6c757d;
  font-weight: 500;
}

/* EMPTY STATE */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #adb5bd;
  font-size: 0.95rem;
}

/* FORM */
.form-container {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #ffffff;
  border-top: 1px solid #e9ecef;
  padding: 12px 16px;
  z-index: 200;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

#idea-form {
  max-width: 640px;
  margin: 0 auto;
}

.form-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.form-actions {
  margin-top: 8px;
}

textarea#idea-content {
  flex: 1;
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.9rem;
  resize: none;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

textarea#idea-content:focus {
  border-color: #4361ee;
}

.char-count {
  font-size: 0.7rem;
  color: #adb5bd;
  align-self: flex-end;
  white-space: nowrap;
}

.author-input {
  border: 1px solid #e9ecef;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.85rem;
  width: 140px;
  outline: none;
}

.author-input:focus {
  border-color: #4361ee;
}

.submit-btn {
  background: #4361ee;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 8px 20px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.submit-btn:hover {
  background: #3651d4;
}

.submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* LOADING */
.loading {
  text-align: center;
  padding: 40px;
  color: #adb5bd;
}

.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid #e9ecef;
  border-top-color: #4361ee;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* DESKTOP */
@media (min-width: 768px) {
  .subtitle {
    display: block;
  }

  .header-logo {
    height: 48px;
  }

  body {
    padding-bottom: 160px;
  }

  .idea-card {
    padding: 20px;
  }

  .form-container {
    padding: 16px 24px;
  }
}
