/* =========================================================
   style.css — Base styles for SE Spring 2026 Frontend App
   ========================================================= */

/* ----- Reset / Box Model ----- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ----- CSS Variables (dark purple Twitter-like theme) ----- */
:root {
  --color-primary:    #7c3aed;   /* Purple accent */
  --color-primary-dk: #6d28d9;
  --color-secondary:  #4b5563;
  --color-bg:         #0d1117;   /* Near-black / dark blue */
  --color-surface:    #161b22;   /* Slightly lighter dark blue */
  --color-text:       #e5e7eb;   /* Off-white / light gray */
  --color-muted:      #9ca3af;
  --color-error:      #f87171;
  --color-success:    #4ade80;
  --color-border:     #21262d;   /* Subtle dark outlines */
  --radius:           8px;
  --shadow:           0 2px 8px rgba(0, 0, 0, 0.3);
  --max-width:        720px;
}

/* ----- Base Typography ----- */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ----- Header ----- */
header {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 0.75rem 1.5rem;
  box-shadow: var(--shadow);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

header h1 {
  font-size: 1.25rem;
  color: var(--color-primary);
}

nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-info {
  font-size: 0.875rem;
  color: var(--color-muted);
}

/* ----- Main / Layout ----- */
main {
  flex: 1;
  max-width: var(--max-width);
  width: 100%;
  margin: 2rem auto;
  padding: 0 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ----- Cards ----- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.75rem 2rem;
  box-shadow: var(--shadow);
}

.card h2 {
  margin-bottom: 1.25rem;
  font-size: 1.2rem;
}

.card h3 {
  margin: 1.25rem 0 0.75rem;
  font-size: 1rem;
  color: var(--color-muted);
}

/* ----- Forms ----- */
form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-muted);
}

input[type="email"],
input[type="password"],
input[type="text"] {
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
  background: var(--color-bg);
  color: var(--color-text);
}

input::placeholder {
  color: var(--color-muted);
}

input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.3);
}

/* ----- Buttons ----- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 1.2rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--color-primary-dk);
}

.btn-secondary {
  background: var(--color-secondary);
  color: #fff;
}

.btn-secondary:hover {
  opacity: 0.85;
}

.btn-group {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
}

/* ----- Messages ----- */
.message {
  margin-top: 0.75rem;
  font-size: 0.875rem;
  min-height: 1.2em;
}

.message.error   { color: var(--color-error); }
.message.success { color: var(--color-success); }

/* ----- Data List ----- */
.data-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.data-list li {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.5rem 0.85rem;
  font-size: 0.9rem;
}

/* ----- Overlay / Modal ----- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
  backdrop-filter: blur(4px);
}

.overlay-card {
  width: 100%;
  max-width: 420px;
  animation: fadeIn 0.2s ease;
}

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

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

/* ----- Post Textarea ----- */
.post-textarea {
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  width: 100%;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: inherit;
  line-height: 1.5;
  resize: vertical;
}

.post-textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.3);
}

/* ----- Word Counter ----- */
.word-counter {
  font-size: 0.8rem;
  color: var(--color-muted);
  text-align: right;
}

.word-counter.over-limit {
  color: var(--color-error);
  font-weight: 600;
}

/* ----- Feed ----- */
.feed-title {
  font-size: 1.2rem;
  margin-bottom: 1rem;
  color: var(--color-primary);
}

.feed-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.feed-empty {
  color: var(--color-muted);
  text-align: center;
  padding: 2rem 0;
}

.loading-text {
  color: var(--color-muted);
  text-align: center;
  padding: 0.5rem 0;
  font-size: 0.85rem;
}

/* ----- Post Card ----- */
.post-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow);
  transition: border-color 0.15s;
}

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

/* Header row */
.post-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.post-header-left {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  min-width: 0;
}

.post-header-right {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

/* Avatar circle */
.post-avatar {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  font-weight: 700;
  flex-shrink: 0;
  user-select: none;
}

/* Stacked username + timestamp */
.post-meta {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.post-author {
  font-weight: 700;
  color: var(--color-text);
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-link {
  color: var(--color-primary);
  text-decoration: none;
}

.user-link:hover {
  text-decoration: underline;
}

.post-time {
  font-size: 0.78rem;
  color: var(--color-muted);
}

/* Content area */
.post-content {
  margin: 0 0 0.8rem 0;
  padding-left: 3.25rem; /* align with text next to avatar */
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-size: 0.95rem;
}

.post-content a {
  color: var(--color-primary);
  text-decoration: none;
}

.post-content a:hover {
  text-decoration: underline;
  color: #a78bfa;
}

/* Link preview card (inline in post content) */
.link-preview {
  display: block;
  margin-top: 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none !important;
  color: inherit;
  transition: border-color 0.15s;
}

.link-preview:hover {
  border-color: var(--color-primary);
}

/* ----- Post Controls (Edit / Delete) ----- */
.post-controls {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

/* ----- Post Actions (Like / Comment) ----- */
.post-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0.55rem 0 0 3.25rem; /* indent to align under content */
  border-top: 1px solid var(--color-border);
}

.btn-like {
  background: none;
  border: none;
  border-radius: 999px;
  color: var(--color-muted);
  padding: 0.3rem 0.75rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.btn-like:hover {
  background: rgba(124, 58, 237, 0.12);
  color: var(--color-primary);
}

.btn-like.liked {
  color: var(--color-primary);
  font-weight: 600;
}

.btn-like:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-comment-toggle {
  background: none;
  border: none;
  border-radius: 999px;
  color: var(--color-muted);
  padding: 0.3rem 0.75rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.btn-comment-toggle:hover {
  background: rgba(124, 58, 237, 0.12);
  color: var(--color-primary);
}

/* ----- Small / Tiny Buttons ----- */
.btn-small {
  padding: 0.3rem 0.8rem;
  font-size: 0.8rem;
}

.btn-tiny {
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
}

.btn-danger {
  background: #dc2626;
  color: #fff;
}

.btn-danger:hover {
  background: #b91c1c;
}

/* ----- Comments Section ----- */
.comments-section {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--color-border);
}

.no-comments {
  font-size: 0.85rem;
  color: var(--color-muted);
  padding: 0.5rem 0;
}

/* ----- Comment Item ----- */
.comment-item {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.5rem;
}

.comment-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.25rem;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.comment-author {
  font-weight: 600;
  color: var(--color-primary);
  font-size: 0.85rem;
}

.comment-time {
  font-size: 0.75rem;
  color: var(--color-muted);
}

.comment-body {
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.comment-body a {
  color: var(--color-primary);
  text-decoration: underline;
}

.comment-controls {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

/* ----- Comment Forms ----- */
.add-comment-form,
.comment-edit-form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.comment-input {
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  width: 100%;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: inherit;
  resize: vertical;
}

.comment-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.3);
}

.mention-autocomplete {
  margin-top: 0.35rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  overflow: hidden;
}

.mention-option {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: var(--color-text);
  padding: 0.45rem 0.65rem;
  cursor: pointer;
}

.mention-option:hover {
  background: rgba(124, 58, 237, 0.15);
}

.profile-header-card {
  padding: 0;
  overflow: hidden;
}

.profile-banner {
  width: 100%;
  height: 140px;
  background: linear-gradient(120deg, #7c3aed, #4f46e5);
  background-size: cover;
  background-position: center;
}

.profile-header-row {
  display: flex;
  gap: 0.9rem;
  align-items: center;
  padding: 0.9rem 1rem;
}

.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--color-border);
  background: var(--color-bg);
}

.profile-meta h2 {
  margin: 0;
  font-size: 1.05rem;
}

.profile-bio {
  color: var(--color-muted);
  font-size: 0.9rem;
}

.profile-edit-wrap {
  padding: 0 1rem 1rem;
}

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

/* ----- Footer ----- */
footer {
  text-align: center;
  padding: 1rem 1.5rem;
  font-size: 0.8rem;
  color: var(--color-muted);
  border-top: 1px solid var(--color-border);
}

/* ----- Responsive (small screens) ----- */
@media (max-width: 480px) {
  .card {
    padding: 1.25rem 1rem;
  }

  .btn-group {
    flex-direction: column;
  }

  .post-card {
    padding: 0.85rem 0.9rem;
  }

  .post-content {
    padding-left: 0;
  }

  .post-actions {
    padding-left: 0;
  }

  .post-avatar {
    width: 2.2rem;
    height: 2.2rem;
    font-size: 0.9rem;
  }
}
