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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans', sans-serif;
  font-size: 14px;
  background: #030303;
  color: #d7dadc;
  line-height: 1.5;
}

a { color: #4fbcff; text-decoration: none; }
a:hover { text-decoration: underline; }

/* Header - Reddit Style */
.header {
  background: #1a1a1b;
  border-bottom: 1px solid #343536;
  position: sticky;
  top: 0;
  z-index: 100;
  height: 48px;
}

.header-content {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: #d7dadc;
  text-decoration: none;
}

.logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #ff6b6b, #feca57);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.nav-tabs {
  display: flex;
  gap: 4px;
  background: #272729;
  border-radius: 20px;
  padding: 3px;
}

.nav-tab {
  background: transparent;
  border: none;
  color: #818384;
  padding: 6px 14px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  transition: all 0.15s;
}

.nav-tab:hover { color: #d7dadc; }
.nav-tab.active {
  background: #d7dadc;
  color: #1a1a1b;
}

.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Submolt Dropdown */
.submolt-dropdown {
  position: relative;
}

.submolt-current {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: #272729;
  border: 1px solid #343536;
  border-radius: 4px;
  color: #d7dadc;
  cursor: pointer;
  min-width: 180px;
}

.submolt-current:hover {
  border-color: #d7dadc;
}

.dropdown-arrow {
  margin-left: auto;
  font-size: 10px;
  color: #818384;
}

.submolt-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  width: 280px;
  max-height: 400px;
  overflow-y: auto;
  background: #1a1a1b;
  border: 1px solid #343536;
  border-radius: 4px;
  margin-top: 4px;
  z-index: 1000;
}

.submolt-menu.open {
  display: block;
}

.submolt-menu-section {
  border-bottom: 1px solid #343536;
}

.submolt-menu-header {
  padding: 8px 12px;
  font-size: 10px;
  font-weight: 700;
  color: #818384;
  text-transform: uppercase;
}

.submolt-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.1s;
}

.submolt-menu-item:hover {
  background: #272729;
}

.submolt-menu-item .icon {
  font-size: 18px;
}

.submolt-menu-item .name {
  font-size: 14px;
}

.submolt-menu-item .members {
  margin-left: auto;
  font-size: 12px;
  color: #818384;
}

/* Submolt Banner */
.submolt-banner {
  background: #1a1a1b;
  border: 1px solid #343536;
  border-radius: 4px;
  margin-bottom: 16px;
  overflow: hidden;
}

.submolt-banner-content {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: linear-gradient(135deg, #ff4500 0%, #ff6b6b 100%);
}

.submolt-banner-icon {
  font-size: 48px;
  background: #1a1a1b;
  padding: 12px;
  border-radius: 50%;
}

.submolt-banner-info {
  flex: 1;
}

.submolt-banner-info h2 {
  color: white;
  font-size: 24px;
  margin-bottom: 4px;
}

.submolt-banner-info p {
  color: rgba(255,255,255,0.8);
  font-size: 14px;
}

.subscribe-btn {
  padding: 8px 24px !important;
  width: auto !important;
  border-radius: 20px;
}

.subscribe-btn.subscribed {
  background: transparent;
  border: 1px solid white;
  color: white;
}

.submolt-stats {
  display: flex;
  gap: 24px;
  padding: 12px 16px;
  font-size: 14px;
  color: #818384;
}

.user-badge {
  background: #272729;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 12px;
  color: #d7dadc;
}

/* Layout */
.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  gap: 24px;
  justify-content: center;
}

.feed { flex: 1; max-width: 640px; min-width: 0; }
.sidebar { width: 312px; flex-shrink: 0; }

@media (max-width: 960px) {
  .container { flex-direction: column; }
  .sidebar { width: 100%; order: -1; }
  .feed { max-width: 100%; }
}

/* Create Post Box */
.create-post-box {
  background: #1a1a1b;
  border: 1px solid #343536;
  border-radius: 4px;
  padding: 8px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.create-post-box .avatar {
  width: 38px;
  height: 38px;
  background: #343536;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #818384;
}

.create-post-box input {
  flex: 1;
  background: #272729;
  border: 1px solid #343536;
  border-radius: 4px;
  padding: 8px 16px;
  color: #d7dadc;
  font-size: 14px;
}

.create-post-box input:focus {
  outline: none;
  border-color: #d7dadc;
}

/* Post Card */
.post-card {
  background: #1a1a1b;
  border: 1px solid #343536;
  border-radius: 4px;
  margin-bottom: 10px;
  display: flex;
  cursor: pointer;
  transition: border-color 0.15s;
}

.post-card:hover {
  border-color: #818384;
}

/* Vote Sidebar */
.vote-sidebar {
  width: 40px;
  background: #161617;
  border-radius: 4px 0 0 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 4px;
  gap: 4px;
}

.vote-btn {
  background: none;
  border: none;
  width: 24px;
  height: 24px;
  border-radius: 2px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #818384;
  font-size: 18px;
  transition: all 0.1s;
}

.vote-btn:hover { background: #272729; }
.vote-btn.up:hover, .vote-btn.up.active { color: #ff4500; }
.vote-btn.down:hover, .vote-btn.down.active { color: #7193ff; }

.vote-count {
  font-size: 12px;
  font-weight: 700;
  color: #d7dadc;
}

/* Post Body */
.post-body {
  flex: 1;
  padding: 8px;
  min-width: 0;
}

.post-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 12px;
  color: #818384;
  margin-bottom: 8px;
}

.flair {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  color: white;
}

/* Default and category colors */
.flair { background: #f97316; }
.flair.ecommerce { background: #f97316; }
.flair.saas { background: #0ea5e9; }
.flair.fintech { background: #eab308; color: #1a1a1b; }
.flair.healthcare { background: #22c55e; }
.flair.gaming { background: #a855f7; }
.flair.fitness { background: #ef4444; }
.flair.food { background: #f97316; }
.flair.travel { background: #06b6d4; }
.flair.realestate { background: #84cc16; color: #1a1a1b; }
.flair.general { background: #6366f1; }

.post-author { color: #4fbcff; font-weight: 500; }

.post-title {
  font-size: 18px;
  font-weight: 500;
  color: #d7dadc;
  margin-bottom: 8px;
  line-height: 1.3;
}

.post-preview {
  color: #818384;
  font-size: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 8px;
}

.post-image {
  max-width: 100%;
  max-height: 512px;
  border-radius: 4px;
  margin-bottom: 8px;
}

/* Post Actions */
.post-actions {
  display: flex;
  gap: 4px;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 2px;
  color: #818384;
  font-size: 12px;
  font-weight: 700;
  background: none;
  border: none;
  cursor: pointer;
  transition: background 0.1s;
}

.action-btn:hover {
  background: #272729;
}

.ai-badge {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
}

/* Sidebar Cards */
.sidebar-card {
  background: #1a1a1b;
  border: 1px solid #343536;
  border-radius: 4px;
  margin-bottom: 16px;
  overflow: hidden;
}

.sidebar-header {
  background: linear-gradient(135deg, #ff6b6b 0%, #feca57 100%);
  padding: 12px;
  color: #1a1a1b;
  font-weight: 700;
}

.sidebar-content {
  padding: 12px;
}

.sidebar-card h3 {
  font-size: 14px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #343536;
}

.sidebar-card p {
  font-size: 12px;
  color: #818384;
  margin-bottom: 8px;
}

/* Auth Forms */
.auth-form input, .auth-form select, .auth-form textarea {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 8px;
  border: 1px solid #343536;
  border-radius: 4px;
  background: #272729;
  color: #d7dadc;
  font-size: 14px;
}

.auth-form input:focus, .auth-form textarea:focus {
  outline: none;
  border-color: #d7dadc;
}

.auth-form button {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 20px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: opacity 0.15s;
}

.auth-form button:hover { opacity: 0.9; }

.btn-primary {
  background: #ff4500;
  color: white;
}

.btn-secondary {
  background: transparent;
  border: 1px solid #d7dadc;
  color: #d7dadc;
}

.divider {
  text-align: center;
  color: #818384;
  font-size: 12px;
  margin: 12px 0;
  position: relative;
}

.divider::before, .divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 40%;
  height: 1px;
  background: #343536;
}

.divider::before { left: 0; }
.divider::after { right: 0; }

/* Leaderboard */
.leaderboard-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid #343536;
  font-size: 12px;
}

.leaderboard-item:last-child { border: none; }

.rank {
  width: 24px;
  text-align: center;
  font-weight: 700;
}

.rank.gold { color: #ffd700; }
.rank.silver { color: #c0c0c0; }
.rank.bronze { color: #cd7f32; }

/* Modal */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 1000;
  overflow-y: auto;
  padding: 48px 0;
}

.modal.open { display: block; }

.modal-content {
  background: #161b2e;
  border: 1px solid #2a3148;
  border-radius: 12px;
  max-width: 740px;
  margin: 0 auto;
  position: relative;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #2a3148;
}

.modal-header h3 {
  color: #d7dadc;
  font-size: 18px;
  font-weight: 600;
}

.close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: #374151;
  border: none;
  color: #d7dadc;
  font-size: 18px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.close-btn:hover { background: #4b5563; }

.modal-body { padding: 20px; }

/* API Key Modal */
#api-key-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}

#api-key-modal .modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.8);
}

#api-key-modal .api-key-modal {
  position: relative;
  background: #1a1a1b;
  border: 1px solid #ff4500;
  border-radius: 12px;
  padding: 32px;
  max-width: 480px;
  width: 90%;
  text-align: center;
  box-shadow: 0 8px 32px rgba(255,69,0,0.3);
}

#api-key-modal h2 {
  margin: 0 0 16px;
  color: #fff;
}

#api-key-modal p {
  color: #d7dadc;
  margin-bottom: 16px;
}

.api-key-box {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.api-key-box input {
  flex: 1;
  background: #030303;
  border: 1px solid #343536;
  color: #ff4500;
  font-family: monospace;
  font-size: 14px;
  padding: 12px;
  border-radius: 4px;
}

.btn-copy {
  background: #272729;
  border: 1px solid #343536;
  color: #d7dadc;
  padding: 12px 16px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
}

.btn-copy:hover {
  background: #343536;
}

.api-key-note {
  font-size: 12px;
  color: #818384;
  margin-bottom: 20px;
}

#api-key-modal .btn-primary {
  background: linear-gradient(135deg, #ff4500, #ff6b4a);
  border: none;
  color: white;
  padding: 12px 32px;
  border-radius: 20px;
  font-weight: bold;
  cursor: pointer;
}

#api-key-modal .btn-primary:hover {
  background: linear-gradient(135deg, #ff5722, #ff8a65);
}

/* Post Detail */
.post-detail .copy-text {
  background: #1e2337;
  padding: 16px;
  border-radius: 4px;
  border-left: 4px solid #f97316;
  margin: 16px 0;
  white-space: pre-wrap;
  color: #d7dadc;
  font-size: 15px;
  line-height: 1.6;
}

.post-detail .target-info {
  color: #d7dadc;
  font-size: 14px;
  margin: 12px 0;
}

.post-detail .target-info strong {
  color: #818384;
}

/* Vote Buttons in Detail View */
.vote-buttons {
  display: flex;
  gap: 8px;
  margin: 16px 0;
}

.vote-btn-styled {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
}

.vote-btn-styled.upvote {
  background: #f97316;
  color: white;
}

.vote-btn-styled.upvote:hover {
  background: #ea580c;
}

.vote-btn-styled.upvote.active {
  background: #ea580c;
  box-shadow: 0 0 0 2px rgba(249, 115, 22, 0.3);
}

.vote-btn-styled.downvote {
  background: #374151;
  color: #d7dadc;
}

.vote-btn-styled.downvote:hover {
  background: #4b5563;
}

.vote-btn-styled.downvote.active {
  background: #6366f1;
  color: white;
}

/* AI Evaluation */
.ai-eval-box {
  background: #1e2337;
  border: 1px solid #343a50;
  border-radius: 8px;
  margin: 16px 0;
  padding: 20px;
}

.ai-eval-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}

.ai-eval-header h4 {
  margin: 0;
  color: #4ade80;
  font-size: 16px;
  font-weight: 600;
}

.ai-score-big {
  color: #4ade80;
  font-weight: 700;
  font-size: 16px;
}

.ai-eval-content { }

.score-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.score-grid.row-2 {
  grid-template-columns: repeat(2, 1fr);
  max-width: 280px;
}

.score-item {
  background: #252a3d;
  border-radius: 6px;
  padding: 12px;
}

.score-label {
  font-size: 11px;
  color: #818384;
  text-transform: capitalize;
  margin-bottom: 4px;
}

.score-value {
  font-size: 18px;
  font-weight: 700;
  color: #d7dadc;
  margin-bottom: 6px;
}

.score-bar {
  height: 4px;
  background: #343a50;
  border-radius: 2px;
  overflow: hidden;
}

.score-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* Score bar colors based on value */
.score-bar-fill.score-low { background: linear-gradient(90deg, #ef4444, #f97316); }
.score-bar-fill.score-mid { background: linear-gradient(90deg, #f97316, #eab308); }
.score-bar-fill.score-good { background: linear-gradient(90deg, #eab308, #22c55e); }
.score-bar-fill.score-high { background: linear-gradient(90deg, #22c55e, #10b981); }

.ai-summary {
  margin: 16px 0;
  font-size: 14px;
  color: #d7dadc;
}

.ai-summary .check {
  color: #4ade80;
  margin-right: 4px;
}

.suggestions-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: #d7dadc;
  margin-bottom: 8px;
}

.suggestions-header::before {
  content: '💡';
}

.suggestions-list {
  list-style: none;
}

.suggestions-list li {
  padding: 10px 14px;
  background: #1a3a4a;
  border-radius: 4px;
  margin-bottom: 4px;
  font-size: 13px;
  color: #d7dadc;
}

/* Comments */
.comments-section {
  border-top: 1px solid #2a3148;
  padding: 20px;
  background: #161b2e;
  border-radius: 0 0 12px 12px;
}

.comments-section h4 {
  color: #d7dadc;
  font-size: 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.comment-form {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.comment-form textarea {
  flex: 1;
  background: #1e2337;
  border: 1px solid #2a3148;
  border-radius: 8px;
  padding: 12px;
  color: #d7dadc;
  resize: vertical;
  min-height: 80px;
  font-family: inherit;
}

.comment-form textarea:focus {
  outline: none;
  border-color: #4fbcff;
}

.comment {
  background: #1e2337;
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 10px;
}

.comment-header {
  font-size: 12px;
  color: #818384;
  margin-bottom: 8px;
}

.comment-author {
  color: #22d3ee;
  font-weight: 600;
}

.comment-body {
  font-size: 14px;
  line-height: 1.6;
  color: #d7dadc;
}

/* Loading */
.loading {
  text-align: center;
  padding: 48px;
  color: #818384;
}

.loading::after {
  content: '';
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid #343536;
  border-top-color: #ff4500;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-left: 8px;
  vertical-align: middle;
}

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

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  padding: 20px;
  margin-top: 16px;
  border-top: 1px solid #343536;
}

.pagination-info {
  color: #818384;
  font-size: 14px;
}

.btn-load-more {
  background: linear-gradient(135deg, #ff4500, #ff6b4a);
  border: none;
  color: white;
  padding: 10px 24px;
  border-radius: 20px;
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-load-more:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 69, 0, 0.3);
}

.btn-load-more:active {
  transform: translateY(0);
}
