/* ==========================
   RESET & BASE
========================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

body {
  background: var(--bg-color);
  color: var(--text-color);
  line-height: 1.5;
  font-size: 16px;
}

/* Links */
a {
  text-decoration: none;
  color: var(--primary-color);
  transition: color 0.3s;
}

a:hover {
  color: var(--accent-color);
}

/* ==========================
   LAYOUT CONTAINERS
========================== */
.layout {
  display: flex;
  gap: 1.5rem;
  padding: 1.5rem 2rem;
  flex-wrap: wrap;
}

.center-feed {
  flex: 2;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 300px;
}

.sidebar {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 200px;
  background: #f4f7fa; /* subtle sidebar background */
  padding: 1rem;
  border-radius: 12px;
}

.insights-feed,
.feed-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ==========================
   HEADER
========================== */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background: linear-gradient(90deg, #007bff, #0056b3); /* improved gradient */
  color: #fff;
  border-bottom: 1px solid rgba(0,0,0,0.1);
  position: sticky;
  top: 0;
  z-index: 1000;
}

header .logo {
  font-weight: 700;
  font-size: 1.5rem;
  color: #fff;
}

header .search-bar input {
  padding: 0.5rem 1rem;
  width: 300px;
  border-radius: 25px;
  border: none;
  background: rgba(255,255,255,0.9);
  transition: all 0.3s;
  color: #333;
}

header .search-bar input:focus {
  outline: none;
  box-shadow: 0 0 0 2px #fff inset;
}

header .top-actions .btn {
  margin-left: 0.5rem;
  background-color: rgba(255,255,255,0.2);
  color: #fff;
  border: 1px solid #fff;
}

header .top-actions .btn:hover {
  background-color: rgba(255,255,255,0.35);
}

/* ==========================
   CARDS (Posts & Questions)
========================== */
.card,
.profile-card,
.comment,
.community {
  background-color: var(--card-bg);
  border: none; /* removed plain border for modern look */
  border-radius: 12px; /* slightly more rounded */
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  transition: transform 0.2s, box-shadow 0.3s;
}

.card:hover,
.profile-card:hover,
.comment:hover,
.community:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.card .meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.card .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-color);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  flex-shrink: 0;
}

.card h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.card .preview {
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.card .actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.card img.post-image {
  width: 100%;
  border-radius: 6px;
  margin-top: 0.5rem;
}

/* ==========================
   Q&A / Answers
========================== */
.answer {
  padding: 0.5rem;
  border-left: 3px solid var(--primary-color);
  background: #f1f5f9;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

.answer strong {
  color: var(--primary-color);
}

/* ==========================
   SIDEBAR ELEMENTS
========================== */
.sidebar h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.chip {
  display: inline-block;
  padding: 0.3rem 0.6rem;
  margin: 0.2rem;
  background: #e1ecf4;
  color: #0366d6;
  border-radius: 16px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.chip:hover {
  background: #cde4f7;
}

.community,
.comment {
  padding: 0.5rem;
}

/* ==========================
   BUTTONS
========================== */
.btn,
button {
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid var(--primary-color);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background-color: var(--btn-bg);
  color: var(--btn-text);
  transition: all 0.3s;
}

.btn:hover,
button:hover {
  transform: translateY(-1px);
  background-color: var(--btn-hover-bg);
  color: var(--btn-hover-text);
  border-color: var(--accent-color);
}

.btn-small { font-size: 0.75rem; padding: 0.3rem 0.6rem; }

/* ==========================
   FLOATING ACTION BUTTON (FAB)
========================== */
#fab {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(45deg, #007bff, #0056b3);
  color: #fff;
  font-size: 2rem;
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
}

#fab:hover {
  background: linear-gradient(45deg, #0056b3, #007bff);
}

/* ==========================
   MODALS
========================== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--modal-bg);
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.modal-content {
  background: var(--card-bg);
  color: var(--text-color);
  padding: 2rem;
  border-radius: 8px;
  max-width: 500px;
  width: 90%;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.modal .close {
  position: absolute;
  top: 0.5rem;
  right: 0.8rem;
  font-size: 1.5rem;
  cursor: pointer;
}

.field,
input,
textarea {
  width: 100%;
  padding: 0.5rem;
  margin: 0.3rem 0;
  border-radius: 4px;
  border: 1px solid var(--border-color);
  background-color: var(--card-bg);
  color: var(--text-color);
  font-size: 0.95rem;
}

textarea,
#answerText {
  resize: vertical;
}

/* ==========================
   NOTIFICATION TOAST
========================== */
#notification {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  background: var(--primary-color);
  color: #fff;
  padding: 0.7rem 1.2rem;
  border-radius: 6px;
  display: none;
  align-items: center;
  gap: 0.5rem;
  z-index: 3000;
}

#notification button {
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 1rem;
}

/* ==========================
   COMMENTS & TAGS
========================== */
#commentList {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.comment {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.9rem;
}

.comment button {
  font-size: 0.75rem;
  padding: 0.2rem 0.4rem;
}

#tagList {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.5rem;
}

/* ==========================
   LOADING & EMPTY STATES
========================== */
.empty,
.loading,
#answerHint,
.comment p,
.community p {
  color: var(--text-secondary);
  font-style: italic;
  font-size: 0.9rem;
  text-align: center;
}

/* ==========================
   MEDIA QUERIES (RESPONSIVE)
========================== */
@media (max-width: 1024px) {
  .layout { flex-direction: column; }
  header .search-bar input { width: 100%; margin-top: 0.5rem; }
}

@media (max-width: 768px) {
  .sidebar { display: none; }
  header { flex-wrap: wrap; gap: 0.5rem; }
  #fab { bottom: 1rem; right: 1rem; width: 48px; height: 48px; font-size: 1.5rem; }
}

@media (max-width: 480px) {
  .card h3 { font-size: 1rem; }
  .card .preview { font-size: 0.85rem; }
  header .logo { font-size: 1.25rem; }
  #fab { width: 44px; height: 44px; font-size: 1.3rem; }
  .modal-content { padding: 1rem; }
}

/* ==========================
   THEME VARIABLES
========================== */
:root {
  --bg-color: #f9f9f9;
  --card-bg: #fff;
  --primary-color: #007bff;
  --accent-color: #0056b3;
  --text-color: #222;
  --text-secondary: #555;
  --border-color: #e0e0e0;
  --modal-bg: rgba(0,0,0,0.4);
  --btn-bg: #fff;
  --btn-text: var(--primary-color);
  --btn-hover-bg: var(--primary-color);
  --btn-hover-text: #fff;
}

[data-theme="dark"] {
  --bg-color: #121212;
  --card-bg: #1e1e1e;
  --primary-color: #1e90ff;
  --accent-color: #63a4ff;
  --text-color: #e0e0e0;
  --text-secondary: #aaa;
  --border-color: #333;
  --modal-bg: rgba(0,0,0,0.7);
  --btn-bg: #1e1e1e;
  --btn-text: var(--primary-color);
  --btn-hover-bg: var(--primary-color);
  --btn-hover-text: #fff;
}