/* ===== BASE & RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

:root {
  --bg-primary: #0f0f1a;
  --bg-secondary: #1a1a2e;
  --bg-card: #16213e;
  --bg-input: #1a1a2e;
  --text-primary: #e8e8e8;
  --text-secondary: #a0a0b8;
  --text-muted: #6c6c80;
  --accent-red: #c0392b;
  --accent-red-hover: #e74c3c;
  --accent-gold: #d4a017;
  --accent-gold-hover: #f0c040;
  --border: #2a2a4a;
  --success: #27ae60;
  --danger: #e74c3c;
  --radius: 8px;
  --shadow: 0 4px 20px rgba(0,0,0,0.3);
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent-gold); text-decoration: none; }
a:hover { color: var(--accent-gold-hover); }

/* ===== NAVBAR ===== */
.navbar {
  background: var(--bg-secondary);
  border-bottom: 2px solid var(--accent-red);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-primary);
}

.navbar-brand .icon { font-size: 1.6rem; }

.navbar-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
}

.navbar-links a {
  color: var(--text-secondary);
  font-weight: 500;
  transition: color 0.2s;
  font-size: 0.95rem;
}

.navbar-links a:hover, .navbar-links a.active { color: var(--accent-gold); }

.navbar-links a { position: relative; }
.pending-dot {
  position: absolute;
  top: -4px;
  right: -10px;
  width: 10px;
  height: 10px;
  background: #2ecc71;
  border-radius: 50%;
  border: 2px solid var(--bg-primary);
}

.navbar-auth { display: flex; align-items: center; gap: 1rem; }
.mobile-auth { display: none; }

.hamburger {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
}

@media (max-width: 768px) {
  .hamburger { display: block; }
  .navbar-links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    flex-direction: column;
    padding: 1rem 2rem;
    border-bottom: 2px solid var(--accent-red);
  }
  .navbar-links.open { display: flex; }
  .navbar-auth { display: none; }
  .mobile-auth {
    display: none;
    list-style: none;
    padding-top: 0.75rem;
    margin-top: 0.75rem;
    border-top: 1px solid var(--border);
  }
  .navbar-links.open .mobile-auth { display: flex; flex-direction: column; gap: 0.5rem; }
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 24px;
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.btn-primary { background: var(--accent-red); color: #fff; }
.btn-primary:hover { background: var(--accent-red-hover); transform: translateY(-1px); }
.btn-primary:disabled { background: #555; border-color: #555; cursor: not-allowed; opacity: 0.7; transform: none; }

.btn-secondary { background: transparent; color: var(--accent-gold); border: 2px solid var(--accent-gold); }
.btn-secondary:hover { background: var(--accent-gold); color: var(--bg-primary); }

.btn-gold { background: var(--accent-gold); color: var(--bg-primary); }
.btn-gold:hover { background: var(--accent-gold-hover); color: var(--bg-primary); }

.btn-sm { padding: 6px 14px; font-size: 0.85rem; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }

/* ===== HERO ===== */
.hero {
  text-align: center;
  padding: 6rem 2rem 4rem;
  background: linear-gradient(rgba(0, 0, 0, 0.65), rgba(0, 0, 0, 0.65)), url('/images/Class Beach.jpg') center/cover no-repeat;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(ellipse at center, rgba(192,57,43,0.1) 0%, transparent 70%);
}

.hero-content { position: relative; z-index: 1; max-width: 800px; margin: 0 auto; }

.hero-icon { font-size: 4rem; margin-bottom: 1rem; }

.hero h1 {
  font-size: 3.5rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, var(--text-primary), var(--accent-gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero .subtitle {
  font-size: 1.4rem;
  color: var(--accent-gold);
  margin-bottom: 1rem;
  font-weight: 600;
  font-style: italic;
}

.hero .description {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.hero-buttons { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* ===== SECTIONS ===== */
.section {
  padding: 4rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.section-header {
  text-align: center;
  margin-bottom: 3rem;
}

.section-header h1,
.section-header h2 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.section-header p {
  color: var(--text-secondary);
  font-size: 1.05rem;
}

/* ===== CARDS ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.5rem;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: transform 0.2s, border-color 0.2s;
}

.card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-gold);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
}

.card-badges { display: flex; gap: 0.4rem; flex-wrap: wrap; margin: 0.5rem 0 0.75rem; }

.card-badge {
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(212, 160, 23, 0.15);
  color: var(--accent-gold);
  font-weight: 600;
}

.pagination {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.card-body {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.card-meta .author { color: var(--accent-gold); }

.card-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.like-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 4px 12px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s;
}

.like-btn:hover, .like-btn.liked {
  border-color: var(--accent-red);
  color: var(--accent-red);
}

.comment-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 4px 12px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.comment-btn:hover { border-color: var(--accent-gold); color: var(--accent-gold); }

/* ===== QUOTE CARDS ===== */
.quote-card {
  background: var(--bg-card);
  border-left: 4px solid var(--accent-gold);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.quote-text {
  font-size: 1.2rem;
  font-style: italic;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  line-height: 1.5;
}

.card-body-truncated {
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.quote-text-truncated {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.quote-card.clickable {
  cursor: pointer;
  transition: border-color 0.2s;
}

.quote-card.clickable:hover {
  border-color: var(--accent-red);
}

.quote-text::before { content: '\201C'; color: var(--accent-gold); font-size: 1.5rem; }
.quote-text::after { content: '\201D'; color: var(--accent-gold); font-size: 1.5rem; }

/* ===== FEATURES GRID ===== */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
}

.feature-icon { font-size: 2.5rem; margin-bottom: 1rem; }
.feature-card h3 { font-size: 1.1rem; margin-bottom: 0.5rem; }
.feature-card p { color: var(--text-secondary); font-size: 0.9rem; }

/* ===== FORMS ===== */
.form-container {
  max-width: 600px;
  margin: 2rem auto;
  padding: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.form-container h1,
.form-container h2 {
  text-align: center;
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent-gold);
}

.form-group textarea { min-height: 120px; resize: vertical; }

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 500px) {
  .form-row { grid-template-columns: 1fr; }
}

.form-error {
  background: rgba(231, 76, 60, 0.1);
  border: 1px solid var(--danger);
  color: var(--danger);
  padding: 10px;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.9rem;
  display: none;
}

.form-success {
  background: rgba(39, 174, 96, 0.1);
  border: 1px solid var(--success);
  color: var(--success);
  padding: 10px;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.9rem;
  display: none;
}

/* ===== TABS ===== */
.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 2rem;
  border-bottom: 2px solid var(--border);
}

.tab {
  padding: 12px 24px;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}

.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--accent-gold); border-bottom-color: var(--accent-gold); }

/* ===== FILTERS ===== */
.filters {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  align-items: flex-end;
}
.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.filter-group label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filters select {
  padding: 8px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.9rem;
}

/* ===== COMMENTS SECTION ===== */
.comments-section {
  margin-top: 1rem;
  padding: 1rem;
  background: var(--bg-primary);
  border-radius: var(--radius);
  display: none;
}

.comments-section.open { display: block; }

.comment {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}

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

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

.comment-text { font-size: 0.9rem; color: var(--text-secondary); margin-top: 0.25rem; white-space: pre-wrap; }
.comment-text-clamped {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.comment-see-more { font-size: 0.8rem; color: var(--accent-gold); cursor: pointer; margin-top: 0.25rem; }
.comment-see-more:hover { text-decoration: underline; }

.comment-form {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.comment-form input {
  flex: 1;
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.9rem;
}

/* ===== PROFILE ===== */
.profile-header {
  text-align: center;
  padding: 3rem 2rem;
  background: linear-gradient(rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.7)), url('/images/bamboo-forest-china.jpg') center/cover no-repeat;
  border-bottom: 2px solid var(--border);
}

.profile-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--accent-red);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  margin: 0 auto 1rem;
  color: #fff;
  font-weight: 700;
}

.profile-name { font-size: 1.8rem; font-weight: 700; }
.profile-rank { color: var(--accent-gold); font-size: 1.1rem; margin-top: 0.25rem; }

.profile-stats {
  display: flex;
  gap: 2rem;
  justify-content: center;
  margin-top: 1.5rem;
}

.stat { text-align: center; }
.stat-number { font-size: 1.5rem; font-weight: 700; color: var(--accent-gold); }
.stat-label { font-size: 0.85rem; color: var(--text-muted); }

.profile-info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.info-item { text-align: center; }
.info-label { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }
.info-value { font-size: 0.95rem; color: var(--text-primary); margin-top: 0.2rem; }

/* ===== ADMIN ===== */
.admin-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.admin-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

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

.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.admin-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
}

.admin-stat-card .number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent-gold);
}

.admin-stat-card .label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* ===== CONTENT DETAIL MODAL ===== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 800px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  padding: 0 2rem 2rem;
}

#quote-modal .modal,
#article-modal .modal,
#video-modal .modal {
  animation: zoomIn 0.3s ease-out;
}

@keyframes zoomIn {
  from { transform: scale(0.5); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.modal-actions {
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
}

.modal-header {
  position: sticky;
  top: 0;
  background: var(--bg-secondary);
  z-index: 10;
  padding: 1rem 0;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.modal-close {
  position: sticky;
  top: 0;
  float: right;
  background: var(--bg-secondary);
  border: none;
  color: var(--text-secondary);
  font-size: 1.5rem;
  cursor: pointer;
  z-index: 11;
  padding: 1rem 0 0.5rem;
}

/* ===== FOOTER ===== */
.footer {
  text-align: center;
  padding: 2rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 4rem;
}

/* ===== UTILITIES ===== */
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 1rem; }
.hidden { display: none !important; }

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

.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}

.empty-state .icon { font-size: 3rem; margin-bottom: 1rem; }

.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 12px 24px;
  border-radius: var(--radius);
  color: #fff;
  font-weight: 500;
  z-index: 300;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s;
}

.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
