:root {
  --primary-color: #0066bb;
  --primary-hover: #005299;
  --primary-subtle: #003d73;

  --link-color: #3b82f6;
  --link-hover: #60a5fa;

  --bg-body: #121212;
  --bg-surface: #1a1a1a;
  --bg-card: #1e1e1e;
  --bg-card-hover: #262626;
  --bg-input: #141414;
  --bg-topbar: #0d0d0d;
  --bg-button: #383838;
  --bg-button-hover: #464646;

  --text-main: #e0e0e0;
  --text-muted: #888888;
  --text-dark: #666666;
  --text-table: #cccccc;
  --text-table-bold: #dddddd;

  --border-color: #2a2a2a;
  --border-subtle: #222222;
  --border-table: #282828;
  
  --radius-sm: 4px;
  --font-family: 'Lato', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --transition: 0.15s ease;
}

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

body {
  background-color: var(--bg-body);
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 13px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--link-color);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

ul {
  list-style: none;
}

.wrapper {
  width: 90%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 15px;
}

.top-bar .wrapper,
.main-header .wrapper,
.sub-header .wrapper,
.site-footer .wrapper {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.site-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.top-bar {
  background: var(--bg-topbar);
  border-bottom: 1px solid var(--border-subtle);
  padding: 8px 0;
  font-size: 12px;
  color: var(--text-muted);
}

.top-nav {
  display: flex;
  gap: 20px;
}

.top-nav a {
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.top-nav a:hover {
  color: var(--link-color);
  text-decoration: none;
}

.main-header {
  padding: 16px 0;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 38px;
  height: 38px;
  background: var(--primary-color);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 18px;
}

.brand-text h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.3px;
}

.brand-text span {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
}

.header-search {
  flex: 1;
  max-width: 380px;
  position: relative;
}

.search-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px 36px 8px 12px;
  color: var(--text-main);
  font-size: 13px;
  font-family: var(--font-family);
  outline: none;
}

.search-input:focus {
  border-color: var(--primary-color);
}

.search-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 13px;
}

.search-btn:hover {
  color: var(--link-color);
}

.auth-buttons {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 13px;
  font-family: var(--font-family);
  cursor: pointer;
  border: none;
  transition: background var(--transition), border-color var(--transition);
}

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

.btn-primary:hover {
  background: var(--primary-hover);
  color: #ffffff;
  text-decoration: none;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-outline:hover {
  background: var(--bg-button-hover);
  border-color: var(--primary-color);
  color: var(--link-color);
  text-decoration: none;
}

.user-menu-dropdown {
  position: relative;
  display: inline-block;
}

.user-menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 4px 10px 4px 6px;
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.user-menu-btn:hover {
  background: var(--bg-card-hover);
  border-color: var(--primary-color);
}

.user-avatar-thumb {
  width: 30px;
  height: 30px;
  border-radius: 4px;
  object-fit: cover;
}

.dropdown-arrow {
  font-size: 10px;
  color: var(--text-muted);
  transition: transform var(--transition);
}

.user-menu-dropdown.active .dropdown-arrow {
  transform: rotate(180deg);
}

.user-menu-content {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  width: 160px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  display: none;
  flex-direction: column;
  z-index: 1000;
  overflow: hidden;
}

.user-menu-dropdown.active .user-menu-content {
  display: flex;
}

.user-menu-content a {
  padding: 10px 14px;
  color: var(--text-main);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background var(--transition);
}

.user-menu-content a:hover {
  background: var(--bg-card-hover);
  color: var(--link-hover);
  text-decoration: none;
}

.user-menu-content a.logout-item:hover {
  color: #fca5a5;
}

.dropdown-divider {
  height: 1px;
  background: var(--border-subtle);
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-main);
  font-size: 20px;
  cursor: pointer;
}

.sub-header {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  padding: 8px 0;
  font-size: 13px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
}

.breadcrumb a {
  color: var(--text-muted);
}

.breadcrumb a:hover {
  color: var(--link-color);
}

.breadcrumb .separator {
  color: var(--text-dark);
  font-size: 10px;
}

.breadcrumb .active {
  color: var(--text-main);
  font-weight: 700;
}

.main-content {
  flex: 1;
  padding: 30px 15px;
}

.tborder {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-table);
  border-radius: var(--radius-sm);
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
}

.thead {
  background: var(--primary-color);
  color: #ffffff;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  border-bottom: 1px solid var(--primary-subtle);
}

.trow1, .trow2 {
  background: var(--bg-card);
  color: var(--text-table);
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-table);
  vertical-align: middle;
}

.tborder strong {
  color: var(--text-table-bold);
}

.textbox {
  background: var(--bg-input);
  border: 1px solid #333333;
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  color: #ffffff;
  font-family: var(--font-family);
  font-size: 13px;
  outline: none;
  max-width: 100%;
}

.textbox:focus {
  border-color: var(--primary-color);
}

.smalltext {
  font-size: 11px;
  color: var(--text-muted);
}

.checkbox {
  accent-color: var(--primary-color);
  vertical-align: middle;
}

.button {
  background: var(--bg-button);
  color: #e5e5e5;
  border: 1px solid #4a4a4a;
  border-radius: var(--radius-sm);
  padding: 6px 20px;
  font-family: var(--font-family);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
}

.button:hover {
  background: var(--bg-button-hover);
  color: #ffffff;
}

.site-footer {
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  padding: 20px 0;
  margin-top: auto;
  font-size: 12px;
  color: var(--text-muted);
}

.footer-links {
  display: flex;
  gap: 16px;
}

.footer-links a {
  color: var(--text-muted);
}

.footer-links a:hover {
  color: var(--link-color);
}

@media (max-width: 768px) {
  .top-bar, .header-search {
    display: none;
  }

  .mobile-menu-btn {
    display: block;
  }

  .site-footer .wrapper {
    flex-direction: column;
    gap: 10px;
    text-align: center;
  }

  .tborder td {
    display: block;
    width: 100% !important;
  }

  .trow1, .trow2 {
    padding: 10px 14px;
  }
}

.forum-cat-margin {
  margin-bottom: 24px;
}

.forum-row-icon {
  width: 40px;
  text-align: center;
  font-size: 18px;
  color: var(--primary-color);
}

.forum-row-title {
  font-size: 15px;
  font-weight: 700;
  display: block;
  margin-bottom: 2px;
}

.forum-row-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0;
}

.forum-row-stats {
  font-size: 12px;
  color: var(--text-dark);
  text-align: center;
  white-space: nowrap;
}

.forum-row-lastpost {
  font-size: 12px;
  color: var(--text-muted);
  width: 240px;
}

.forum-row-lastpost a {
  font-weight: 600;
}

.thread-row-title {
  font-size: 14px;
  font-weight: 700;
  display: block;
  margin-bottom: 3px;
}

.thread-row-author {
  font-size: 12px;
  color: var(--text-muted);
}

.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border-table);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  display: flex;
  overflow: hidden;
}

.post-user-info {
  width: 180px;
  background: #181818;
  border-right: 1px solid var(--border-table);
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  flex-shrink: 0;
}

.post-user-avatar {
  width: 70px;
  height: 70px;
  border-radius: 4px;
  object-fit: cover;
  border: 1px solid var(--primary-color);
  margin-bottom: 10px;
}

.post-user-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-main);
  margin-bottom: 2px;
  word-break: break-word;
}

.post-user-handle {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.post-user-joined {
  font-size: 11px;
  color: var(--text-dark);
}

.post-body {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.post-header {
  background: #161616;
  border-bottom: 1px solid var(--border-subtle);
  padding: 10px 16px;
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.post-content {
  padding: 18px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-main);
  white-space: pre-wrap;
  word-break: break-word;
}

.badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.badge-closed {
  background: #4a1d1d;
  color: #fca5a5;
  border: 1px solid #7f1d1d;
}

@media (max-width: 768px) {
  .post-card {
    flex-direction: column;
  }
  .post-user-info {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-table);
    flex-direction: row;
    align-items: center;
    text-align: left;
    gap: 12px;
    padding: 12px;
  }
  .post-user-avatar {
    width: 48px;
    height: 48px;
    margin-bottom: 0;
  }
}

.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}

.modal-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  max-width: 650px;
  width: 100%;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  background: var(--primary-color);
  color: #ffffff;
  padding: 14px 20px;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.modal-body {
  padding: 24px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-main);
}

.modal-body p {
  margin-bottom: 14px;
}

.modal-footer {
  background: #141414;
  border-top: 1px solid var(--border-subtle);
  padding: 16px 20px;
  display: flex;
  justify-content: center;
  gap: 12px;
}
