* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #b51e1e;
  --primary-dark: #46827a;
  --secondary-color: #6c757d;
  --success-color: #28a745;
  --danger-color: #dc3545;
  --warning-color: #ffc107;
  --info-color: #17a2b8;
  --dark-color: #343a40;
  --light-color: #f8f9fa;

  --bg-primary: #f8f9fa;
  --bg-secondary: #ffffff;
  --bg-tertiary: #e9ecef;

  --text-primary: #212529;
  --text-secondary: #6c757d;
  --text-muted: #6c757d;

  --button-primary: #eeeeee;

  --border-color: #dee2e6;
  --card-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  --link-color: #dee2e6;

  --gray-100: #f8f9fa;
  --gray-200: #e9ecef;
  --gray-300: #dee2e6;
  --gray-400: #ced4da;
  --gray-500: #adb5bd;
  --gray-600: #6c757d;
  --gray-700: #495057;
  --gray-800: #343a40;
  --gray-900: #212529;

  --font-family: "Inter", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  --border-radius: 8px;
  --box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  --transition: all 0.3s ease;
}

body.dark-theme {
  --primary-color: #76abae;
  --primary-dark: #5f8f92;
  --secondary-color: #6b7280;
  --success-color: #10b981;
  --danger-color: #ef4444;
  --warning-color: #f59e0b;
  --info-color: #06b6d4;
  --dark-color: #393e46;
  --light-color: #2d2f36;

  --bg-primary: #222831;
  --bg-secondary: #2d2f36;
  --bg-tertiary: #393e46;

  --text-primary: #eeeeee;
  --text-secondary: #b0b3b8;
  --text-muted: #7e848c;

  --button-primary: #eeeeee;

  --border-color: #393e46;
  --card-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  --link-color: #dee2e6;

  --gray-100: #2d2f36;
  --gray-200: #393e46;
  --gray-300: #4a4f58;
  --gray-400: #6b7280;
  --gray-500: #9ca3af;
  --gray-600: #b0b3b8;
  --gray-700: #d1d5db;
  --gray-800: #eeeeee;
  --gray-900: #ffffff;
}

body {
  font-family: var(--font-family);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition:
    background-color 0.3s ease,
    color 0.3s ease;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin-bottom: 1rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text-primary);
}

h1 {
  font-size: 2.5rem;
}
h2 {
  font-size: 2rem;
}
h3 {
  font-size: 1.75rem;
}
h4 {
  font-size: 1.5rem;
}
h5 {
  font-size: 1.25rem;
}
h6 {
  font-size: 1rem;
}

p {
  margin-bottom: 1rem;
}

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: var(--transition);
}

a:hover {
  color: var(--primary-dark);
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 15px;
}

.row {
  display: flex;
  flex-wrap: wrap;
  margin: 0 -15px;
}

.col {
  flex: 1;
  padding: 0 15px;
}

header {
  background: var(--dark-color);
  color: white;
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--card-shadow);
  transition: background 0.3s ease;
}

header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.logo a {
  color: white;
  font-size: 1.5rem;
  font-weight: bold;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.logo a i {
  color: var(--primary-color);
  font-size: 1.8rem;
}

nav ul {
  display: flex;
  list-style: none;
  gap: 1.5rem;
}

nav ul li a {
  color: var(--link-color);
  text-decoration: none;
  padding: 0.5rem 0;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

nav ul li a:hover,
nav ul li.active a {
  color: white;
  border-bottom: 2px solid var(--primary-color);
}

.user-menu {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-menu .avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: white;
  text-decoration: none;
}

.theme-toggle {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  color: white;
  font-size: 1.1rem;
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: rotate(15deg);
}

main {
  flex: 1;
  padding: 2rem 0;
}

footer {
  background: linear-gradient(135deg, var(--dark-color) 0%, #1a1e24 100%);
  color: var(--gray-400);
  padding: 3rem 0 0;
  margin-top: 3rem;
  transition: background 0.3s ease;
}

body.dark-theme footer {
  background: linear-gradient(135deg, #222831 0%, #2d2f36 100%);
}

.footer-top {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 2rem;
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-section {
  flex: 1;
  min-width: 200px;
}

.footer-section h4 {
  color: white;
  margin-bottom: 1rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.footer-section p {
  color: var(--gray-400);
  font-size: 0.9rem;
  line-height: 1.5;
}

.footer-section ul {
  list-style: none;
  padding: 0;
}

.footer-section ul li {
  margin-bottom: 0.5rem;
}

.footer-section ul li a {
  color: var(--gray-400);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.3s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.footer-section ul li a:hover {
  color: white;
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1rem 0;
}

.copyright {
  color: var(--gray-500);
  font-size: 0.85rem;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
}

.footer-links a {
  color: var(--gray-500);
  text-decoration: none;
  font-size: 0.85rem;
  transition: color 0.3s;
}

.footer-links a:hover {
  color: white;
}

.card {
  background: var(--bg-secondary);
  border-radius: var(--border-radius);
  box-shadow: var(--card-shadow);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

.card-header {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-header h2,
.card-header h3 {
  margin-bottom: 0;
}

.card-footer {
  border-top: 1px solid var(--border-color);
  padding-top: 1rem;
  margin-top: 1rem;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text-primary);
}

.form-control {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  font-family: inherit;
  font-size: 1rem;
  background: var(--bg-primary);
  color: var(--text-primary);
  transition: var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(90, 150, 144, 0.1);
}

textarea.form-control {
  min-height: 150px;
  resize: vertical;
}

.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrapper input {
  flex: 1;
  padding-right: 45px;
}

.password-toggle {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 1rem;
  padding: 5px;
  transition: color 0.3s;
  z-index: 10;
}

.password-toggle:hover {
  color: var(--primary-color);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: var(--border-radius);
  font-size: 0.9rem;
  font-weight: 500;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary {
  background: var(--primary-color);
  color: var(--button-primary);
}

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  text-decoration: none;
  color: white;
}

.btn-secondary {
  background: var(--secondary-color);
  color: white;
}

.btn-secondary:hover {
  background: #5a6268;
  transform: translateY(-1px);
  text-decoration: none;
  color: white;
}

.btn-success {
  background: var(--success-color);
  color: white;
}

.btn-danger {
  background: var(--danger-color);
  color: white;
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}

.btn-lg {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
}

.btn-block {
  width: 100%;
  justify-content: center;
}

.alert {
  padding: 1rem 1.5rem;
  border-radius: var(--border-radius);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.alert-success {
  background: #ecfdf5;
  border-left: 4px solid var(--success-color);
  color: #065f46;
}

body.dark-theme .alert-success {
  background: #2a4a3a;
  color: #7acfa8;
}

.alert-danger {
  background: #fef2f2;
  border-left: 4px solid var(--danger-color);
  color: #991b1b;
}

body.dark-theme .alert-danger {
  background: #4a2a2a;
  color: #f28b82;
}

.alert-warning {
  background: #fff3cd;
  border-left: 4px solid var(--warning-color);
  color: #856404;
}

body.dark-theme .alert-warning {
  background: #4a3a2a;
  color: #f5b042;
}

.alert-info {
  background: #d1ecf1;
  border-left: 4px solid var(--info-color);
  color: #0c5460;
}

body.dark-theme .alert-info {
  background: #2a4a5a;
  color: #8bc9e8;
}

.alert-close {
  margin-left: auto;
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  opacity: 0.7;
}

.alert-close:hover {
  opacity: 1;
}

.table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
}

.table th,
.table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.table th {
  background: var(--bg-tertiary);
  font-weight: 600;
  color: var(--text-secondary);
}

.table tr:hover {
  background: var(--bg-tertiary);
}

.breadcrumb {
  padding: 15px 0;
  margin-bottom: 20px;
  font-size: 14px;
  color: var(--text-secondary);
}

.breadcrumb a {
  color: var(--primary-color);
  text-decoration: none;
}

.breadcrumb i {
  margin: 0 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin: 1.5rem 0;
  flex-wrap: wrap;
}

.page-btn {
  padding: 0.5rem 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  text-decoration: none;
  color: var(--text-primary);
  font-size: 0.85rem;
  transition: all 0.3s;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.page-btn:hover {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.page-numbers {
  display: flex;
  gap: 0.3rem;
}

.page-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  padding: 0.5rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  text-decoration: none;
  color: var(--text-primary);
  font-size: 0.85rem;
  transition: all 0.3s;
}

.page-number.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 500;
}

.status-badge.pending {
  background: #fef3c7;
  color: #d97706;
}

.status-badge.approved {
  background: #d1fae5;
  color: #059669;
}

.status-badge.rejected {
  background: #fee2e2;
  color: #dc2626;
}

body.dark-theme .status-badge.pending {
  background: #4a3a2a;
  color: #f5b042;
}

body.dark-theme .status-badge.approved {
  background: #2a4a3a;
  color: #7acfa8;
}

body.dark-theme .status-badge.rejected {
  background: #4a2a2a;
  color: #f28b82;
}

.notification-type {
  font-size: 0.7rem;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 20px;
}

.notification-type.topic_approved {
  background: #ecfdf5;
  color: #059669;
}

.notification-type.topic_rejected {
  background: #fef2f2;
  color: #dc2626;
}

.notification-type.topic_pending {
  background: #fef3c7;
  color: #d97706;
}

.notification-type.topic_reply {
  background: #e0f2fe;
  color: #0284c7;
}

.notification-type.post_like {
  background: #fce7f3;
  color: #db2777;
}

body.dark-theme .notification-type.topic_approved {
  background: #2a4a3a;
  color: #7acfa8;
}

body.dark-theme .notification-type.topic_rejected {
  background: #4a2a2a;
  color: #f28b82;
}

body.dark-theme .notification-type.topic_pending {
  background: #4a3a2a;
  color: #f5b042;
}

body.dark-theme .notification-type.topic_reply {
  background: #2a4a5a;
  color: #8bc9e8;
}

body.dark-theme .notification-type.post_like {
  background: #4a2a4a;
  color: #f0a8d0;
}

.topic-item .topic-info h4,
.topic-title-link {
  margin: 0 0 0.3rem 0 !important;
  font-size: 1rem !important;
  line-height: 1.3 !important;
  word-break: break-word !important;
  white-space: normal !important;
  overflow: visible !important;
}

.topic-item .topic-info h4 a,
.topic-title-link a {
  color: var(--text-primary) !important;
  text-decoration: none !important;
  transition: color 0.3s !important;
  display: inline !important;
  white-space: normal !important;
  word-break: break-word !important;
}

.topic-item .topic-info h4 a:hover,
.topic-title-link a:hover {
  color: var(--primary-color) !important;
}

@media screen and (max-width: 768px) {
  h1 {
    font-size: 2rem;
  }
  h2 {
    font-size: 1.75rem;
  }
  h3 {
    font-size: 1.5rem;
  }

  header .container {
    flex-direction: column;
    gap: 1rem;
  }

  .mobile-menu-button {
    display: block;
  }

  nav {
    display: none;
    width: 100%;
  }

  nav.show {
    display: block;
  }

  nav ul {
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
  }

  .user-menu {
    margin-top: 1rem;
  }

  .forum-item,
  .topic-item {
    flex-direction: column;
    text-align: center;
  }

  .forum-icon {
    margin: 0 auto;
  }

  .topic-stats {
    text-align: left;
    display: flex;
    gap: 1rem;
  }

  .topic-stats span {
    display: inline;
  }

  .forum-meta {
    justify-content: center;
  }

  .post-author {
    flex-direction: column;
    text-align: center;
  }

  .post-number {
    align-self: flex-end;
  }

  .footer-top {
    flex-direction: column;
    text-align: center;
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }

  .footer-links {
    justify-content: center;
  }

  .topic-item .topic-info h4,
  .topic-title-link {
    word-break: break-word;
    white-space: normal;
    text-align: center;
  }
}

@media screen and (min-width: 769px) and (max-width: 1024px) {
  .container {
    max-width: 960px;
  }

  .row {
    gap: 1rem;
  }
}

@media screen and (min-width: 1025px) {
  .container {
    max-width: 1200px;
  }
}

.text-center {
  text-align: center;
}
.text-left {
  text-align: left;
}
.text-right {
  text-align: right;
}
.text-primary {
  color: var(--primary-color);
}
.text-success {
  color: var(--success-color);
}
.text-danger {
  color: var(--danger-color);
}
.text-warning {
  color: var(--warning-color);
}
.text-muted {
  color: var(--text-secondary);
}

.bg-primary {
  background: var(--primary-color);
  color: white;
}
.bg-success {
  background: var(--success-color);
  color: white;
}
.bg-danger {
  background: var(--danger-color);
  color: white;
}
.bg-warning {
  background: var(--warning-color);
}
.bg-light {
  background: var(--light-color);
}
.bg-dark {
  background: var(--dark-color);
  color: white;
}

.mt-0 {
  margin-top: 0 !important;
}
.mt-1 {
  margin-top: 0.5rem !important;
}
.mt-2 {
  margin-top: 1rem !important;
}
.mt-3 {
  margin-top: 1.5rem !important;
}
.mt-4 {
  margin-top: 2rem !important;
}
.mt-5 {
  margin-top: 3rem !important;
}
.mb-0 {
  margin-bottom: 0 !important;
}
.mb-1 {
  margin-bottom: 0.5rem !important;
}
.mb-2 {
  margin-bottom: 1rem !important;
}
.mb-3 {
  margin-bottom: 1.5rem !important;
}
.mb-4 {
  margin-bottom: 2rem !important;
}
.mb-5 {
  margin-bottom: 3rem !important;
}
.ml-0 {
  margin-left: 0 !important;
}
.ml-1 {
  margin-left: 0.5rem !important;
}
.ml-2 {
  margin-left: 1rem !important;
}
.ml-3 {
  margin-left: 1.5rem !important;
}
.ml-4 {
  margin-left: 2rem !important;
}
.ml-5 {
  margin-left: 3rem !important;
}
.mr-0 {
  margin-right: 0 !important;
}
.mr-1 {
  margin-right: 0.5rem !important;
}
.mr-2 {
  margin-right: 1rem !important;
}
.mr-3 {
  margin-right: 1.5rem !important;
}
.mr-4 {
  margin-right: 2rem !important;
}
.mr-5 {
  margin-right: 3rem !important;
}
.p-1 {
  padding: 0.5rem !important;
}
.p-2 {
  padding: 1rem !important;
}
.p-3 {
  padding: 1.5rem !important;
}
.p-4 {
  padding: 2rem !important;
}
.p-5 {
  padding: 3rem !important;
}
.hidden {
  display: none;
}
.visible {
  display: block;
}

.highlight {
  background-color: #fef9c3;
  color: #854d0e;
  font-weight: 500;
  padding: 0 2px;
  border-radius: 4px;
}

body.dark-theme .highlight {
  background-color: #76abae;
  color: #222831;
}
