/* ============================================================
   PHPvillage - Main Stylesheet
   Modern LTR English Design System
   ============================================================ */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;900&family=Fira+Code:wght@400;500&display=swap');

/* --- CSS Custom Properties --- */
:root {
  --bg: #F0EDE4;
  --surface: #FFFFFF;
  --header-bg: #1B2130;
  --nav-hover: #243044;
  --primary: #3A7D44;
  --primary-dark: #2d6235;
  --primary-light: #4a9d57;
  --accent: #D4892A;
  --accent-dark: #b8731f;
  --text: #1A1A1A;
  --text-muted: #666666;
  --text-light: #999999;
  --border: #D5D2C8;
  --border-light: #E8E5DC;
  --sidebar-bg: #E8E5DC;
  --card-bg: #FFFFFF;
  --shadow: 0 2px 8px rgba(0,0,0,0.10);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.14);
  --radius: 8px;
  --radius-sm: 5px;
  --radius-lg: 12px;
  --transition: 0.2s ease;
  --font-main: 'Inter', system-ui, -apple-system, Arial, sans-serif;
  --font-code: 'Fira Code', 'Courier New', monospace;
  --header-height: 70px;
}

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

html {
  scroll-behavior: smooth;
}

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

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

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

img {
  max-width: 100%;
  height: auto;
  display: block;
}

ul, ol {
  list-style: none;
}

/* --- Container --- */
.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
  background: var(--header-bg);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--header-height);
  flex-wrap: nowrap;
  padding-top: 6px;
  padding-bottom: 6px;
}

/* Logo */
.logo {
  display: flex;
  align-items: baseline;
  gap: 4px;
  text-decoration: none;
  flex-shrink: 0;
}

.logo:hover {
  text-decoration: none;
}

.logo-php {
  font-size: 1.6rem;
  font-weight: 900;
  color: #7EB9F5;
  letter-spacing: -1px;
  line-height: 1;
}

.logo-village {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.logo-sub {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.55);
  margin-left: 6px;
  font-weight: 400;
  white-space: nowrap;
}

/* Hamburger toggle — hidden at desktop, shown at mobile */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 6px;
  flex-shrink: 0;
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: rgba(255,255,255,0.85);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle--open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle--open span:nth-child(2) { opacity: 0; }
.nav-toggle--open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Main Navigation */
.main-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  flex-wrap: nowrap;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.main-nav::-webkit-scrollbar { display: none; }

.main-nav a {
  color: rgba(255,255,255,0.85);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition);
  text-decoration: none;
}

.main-nav a:hover,
.main-nav a.active {
  background: var(--nav-hover);
  color: #fff;
  text-decoration: none;
}

/* Header Search */
.header-search {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.header-search input[type="search"] {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius-sm);
  color: #fff;
  padding: 7px 12px;
  font-family: var(--font-main);
  font-size: 0.85rem;
  width: 160px;
  transition: background var(--transition), border-color var(--transition), width var(--transition);
  direction: ltr;
}

.header-search input[type="search"]::placeholder {
  color: rgba(255,255,255,0.45);
}

.header-search input[type="search"]:focus {
  outline: none;
  background: rgba(255,255,255,0.15);
  border-color: var(--accent);
  width: 200px;
}

.header-search button {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 7px 14px;
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
  white-space: nowrap;
}

.header-search button:hover {
  background: var(--primary-dark);
}

/* ============================================================
   STATS BAR
   ============================================================ */
.stats-bar {
  background: var(--primary);
  color: #fff;
  text-align: center;
  padding: 8px 16px;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.stats-bar span {
  background: rgba(255,255,255,0.2);
  padding: 2px 8px;
  border-radius: 20px;
  margin: 0 4px;
}

/* ============================================================
   PAGE LAYOUT
   ============================================================ */
.site-main {
  flex: 1;
  padding: 24px 0;
}

/* 3-column layout (homepage) */
.layout-3col {
  display: grid;
  grid-template-columns: 220px 1fr 200px;
  gap: 20px;
  align-items: start;
}

/* 2-column layout (inner pages) */
.layout-2col {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 20px;
  align-items: start;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Widget */
.widget {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid var(--border-light);
}

.widget-title {
  background: var(--header-bg);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 700;
  padding: 10px 14px;
  letter-spacing: 0.3px;
  border-bottom: 2px solid var(--accent);
}

.widget > *:not(.widget-title) {
  padding: 12px 14px;
}

/* Login Widget */
.login-widget form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
}

.login-widget label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: -4px;
}

.login-widget input[type="text"],
.login-widget input[type="password"] {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-family: var(--font-main);
  font-size: 0.85rem;
  width: 100%;
  transition: border-color var(--transition), box-shadow var(--transition);
  direction: ltr;
  background: var(--bg);
}

.login-widget input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(58,125,68,0.12);
}

.login-widget button[type="submit"] {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 8px;
  font-family: var(--font-main);
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition);
  margin-top: 2px;
}

.login-widget button:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.register-link {
  text-align: center;
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 600;
  margin-top: -2px;
}

.register-link:hover {
  color: var(--accent-dark);
}

/* Widget Links */
.widget-links {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 14px;
}

.widget-links li a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text);
  transition: background var(--transition), color var(--transition);
}

.widget-links li a:hover {
  background: var(--sidebar-bg);
  color: var(--primary);
  text-decoration: none;
}

/* Badge */
.badge {
  background: var(--accent);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 20px;
  min-width: 22px;
  text-align: center;
}

/* Members Table */
.members-table,
.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.83rem;
}

.members-table td,
.stats-table td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--border-light);
}

.members-table tr:last-child td,
.stats-table tr:last-child td {
  border-bottom: none;
}

.members-table tr:hover td {
  background: var(--sidebar-bg);
}

.members-table td:first-child a {
  color: var(--text);
  font-weight: 600;
}

.members-table td:first-child a:hover {
  color: var(--primary);
}

.score {
  text-align: right;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.88rem;
}

.stats-table td:first-child {
  color: var(--text-muted);
  font-weight: 600;
}

.stats-table td:last-child {
  text-align: right;
  font-weight: 700;
  color: var(--primary);
}

/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */
.main-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Section Header */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--header-bg);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title::before {
  content: '';
  width: 4px;
  height: 20px;
  background: var(--primary);
  border-radius: 2px;
  display: inline-block;
}

.section-more {
  font-size: 0.82rem;
  color: var(--accent);
  font-weight: 600;
}

.section-more:hover {
  color: var(--accent-dark);
  text-decoration: underline;
}

/* Card */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.card-header {
  background: linear-gradient(135deg, var(--header-bg), #2a3550);
  color: #fff;
  padding: 12px 16px;
  font-size: 0.9rem;
  font-weight: 700;
  border-bottom: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header a {
  color: var(--accent);
  font-size: 0.8rem;
  text-decoration: none;
}

.card-header a:hover {
  text-decoration: underline;
  color: #f5a83a;
}

.card-body {
  padding: 16px;
}

/* ============================================================
   FEATURED ARTICLES
   ============================================================ */
.articles-section {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  overflow: hidden;
}

.article-item {
  padding: 16px;
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition);
}

.article-item:last-child {
  border-bottom: none;
}

.article-item:hover {
  background: #fafaf8;
}

.article-item-title {
  font-size: 0.97rem;
  font-weight: 700;
  color: var(--header-bg);
  margin-bottom: 6px;
  line-height: 1.4;
}

.article-item-title a {
  color: inherit;
  text-decoration: none;
}

.article-item-title a:hover {
  color: var(--primary);
}

.article-item-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.article-item-meta .meta-author {
  color: var(--accent);
  font-weight: 600;
}

.article-item-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ============================================================
   TABLES (Forum, Additions, etc.)
   ============================================================ */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.data-table thead th {
  background: var(--header-bg);
  color: #fff;
  padding: 10px 12px;
  font-weight: 600;
  font-size: 0.83rem;
  text-align: left;
  white-space: nowrap;
}

.data-table thead th:first-child {
  border-radius: 0;
}

.data-table tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition);
}

.data-table tbody tr:last-child {
  border-bottom: none;
}

.data-table tbody tr:hover {
  background: #f5f3ee;
}

.data-table tbody td {
  padding: 10px 12px;
  color: var(--text);
  vertical-align: middle;
}

.data-table tbody td a {
  color: var(--primary);
  font-weight: 600;
}

.data-table tbody td a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

.data-table .col-num {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
  width: 60px;
}

.data-table .col-date {
  color: var(--text-muted);
  font-size: 0.8rem;
  white-space: nowrap;
  width: 120px;
}

.data-table .col-author {
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
  width: 110px;
}

/* Tabbed Additions Table */
.tabs-wrapper {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  overflow: hidden;
}

.tabs-header {
  display: flex;
  background: var(--sidebar-bg);
  border-bottom: 2px solid var(--border);
}

.tab-btn {
  padding: 10px 16px;
  background: none;
  border: none;
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition), background var(--transition);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
}

.tab-btn:hover {
  color: var(--primary);
  background: rgba(255,255,255,0.5);
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: var(--surface);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* ============================================================
   FORUM TABLE
   ============================================================ */
.forum-section {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  overflow: hidden;
}

.forum-header {
  background: linear-gradient(135deg, var(--header-bg), #2a3550);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--accent);
}

.forum-header h2 {
  color: #fff;
  font-size: 0.95rem;
  font-weight: 700;
}

.forum-header .forum-count {
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
}

.forum-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.forum-table thead th {
  background: var(--sidebar-bg);
  color: var(--text-muted);
  padding: 8px 12px;
  font-weight: 700;
  font-size: 0.78rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.forum-table tbody tr {
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition);
}

.forum-table tbody tr:last-child {
  border-bottom: none;
}

.forum-table tbody tr:hover {
  background: #f7f5f0;
}

.forum-table tbody td {
  padding: 9px 12px;
  vertical-align: middle;
}

.forum-table .topic-title a {
  color: var(--text);
  font-weight: 600;
  font-size: 0.85rem;
}

.forum-table .topic-title a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.forum-table .col-small {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  white-space: nowrap;
  width: 70px;
}

.forum-table .last-reply {
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  width: 100px;
}

/* ============================================================
   MINI SIDEBAR (right column on homepage)
   ============================================================ */
.mini-sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.mini-widget {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  overflow: hidden;
}

.mini-widget-title {
  background: var(--accent);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 9px 12px;
  border-bottom: 2px solid var(--accent-dark);
}

.mini-widget-body {
  padding: 10px 12px;
}

.func-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.func-list a {
  font-family: var(--font-code);
  font-size: 0.78rem;
  color: var(--primary);
  padding: 3px 6px;
  border-radius: 3px;
  transition: background var(--transition);
  display: block;
}

.func-list a:hover {
  background: var(--sidebar-bg);
  text-decoration: none;
}

.func-total {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 8px;
  text-align: center;
  border-top: 1px solid var(--border-light);
  padding-top: 8px;
}

.books-grid {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.book-thumb {
  border-radius: 4px;
  box-shadow: var(--shadow);
  transition: transform var(--transition);
  max-width: 70px;
}

.book-thumb:hover {
  transform: scale(1.05);
}

/* ============================================================
   PAGE INNER HEADER
   ============================================================ */
.page-heading {
  background: linear-gradient(135deg, var(--header-bg) 0%, #243050 100%);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 18px 20px;
  border-bottom: 3px solid var(--accent);
}

.page-heading h1 {
  color: #fff;
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.page-heading p {
  color: rgba(255,255,255,0.6);
  font-size: 0.85rem;
}

.content-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  overflow: hidden;
}

/* ============================================================
   FORM STYLES (General)
   ============================================================ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.form-label {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
}

.form-input,
.form-textarea,
.form-select {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-family: var(--font-main);
  font-size: 0.9rem;
  color: var(--text);
  background: var(--bg);
  width: 100%;
  transition: border-color var(--transition), box-shadow var(--transition);
  direction: ltr;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(58,125,68,0.12);
  background: #fff;
}

.form-textarea {
  resize: vertical;
  min-height: 140px;
  line-height: 1.6;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  font-family: var(--font-main);
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  text-decoration: none;
}

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

.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(58,125,68,0.3);
  color: #fff;
  text-decoration: none;
}

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

.btn-accent:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(212,137,42,0.3);
  color: #fff;
  text-decoration: none;
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-outline:hover {
  background: var(--primary);
  color: #fff;
  transform: translateY(-1px);
  text-decoration: none;
}

/* ============================================================
   CODE BLOCKS
   ============================================================ */
pre, .code-block {
  background: #1a1e2e;
  color: #e8eaf0;
  border-radius: var(--radius);
  padding: 16px 18px;
  font-family: var(--font-code);
  font-size: 0.85rem;
  line-height: 1.7;
  overflow-x: auto;
  direction: ltr;
  text-align: left;
  border: 1px solid #2d3345;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.2);
}

code {
  font-family: var(--font-code);
  background: rgba(58,125,68,0.12);
  color: var(--primary-dark);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 0.88em;
  direction: ltr;
  display: inline-block;
}

pre code {
  background: none;
  color: inherit;
  padding: 0;
}

/* Syntax highlight classes */
.kw { color: #7eb9f5; font-weight: 600; }
.str { color: #98c379; }
.cmt { color: #5c6370; font-style: italic; }
.fn { color: #e5c07b; }
.var { color: #e06c75; }
.num { color: #d19a66; }

/* ============================================================
   FUNCTION GRID (funa)
   ============================================================ */
.func-category {
  margin-bottom: 24px;
}

.func-category-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--header-bg);
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.func-category-title .cat-icon {
  background: var(--primary);
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
}

.func-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
}

.func-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
  text-align: center;
}

.func-card:hover {
  background: var(--primary);
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.func-card a {
  font-family: var(--font-code);
  font-size: 0.82rem;
  color: var(--primary);
  display: block;
  font-weight: 500;
  text-decoration: none;
  transition: color var(--transition);
}

.func-card:hover a {
  color: #fff;
}

/* ============================================================
   PROGRAMS / DOWNLOAD CARDS
   ============================================================ */
.prog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.prog-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow var(--transition), transform var(--transition);
  display: flex;
  flex-direction: column;
}

.prog-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

.prog-card-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  padding: 12px 14px;
  font-size: 0.92rem;
  font-weight: 700;
}

.prog-card-body {
  padding: 14px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.prog-card-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
  flex: 1;
}

.prog-card-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border-light);
  padding-top: 8px;
  margin-top: 4px;
}

.prog-card-meta .meta-author {
  color: var(--accent);
  font-weight: 600;
}

/* ============================================================
   BOOK CARDS
   ============================================================ */
.books-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.book-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow);
  overflow: hidden;
  display: flex;
  gap: 16px;
  padding: 16px;
  transition: box-shadow var(--transition);
}

.book-card:hover {
  box-shadow: var(--shadow-md);
}

.book-card-cover {
  flex-shrink: 0;
  width: 80px;
}

.book-card-cover img {
  width: 80px;
  border-radius: 4px;
  box-shadow: var(--shadow);
}

.book-card-info {
  flex: 1;
}

.book-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--header-bg);
  margin-bottom: 6px;
}

.book-card-title a {
  color: inherit;
}

.book-card-title a:hover {
  color: var(--primary);
}

.book-card-author {
  font-size: 0.82rem;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 8px;
}

.book-card-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ============================================================
   MEMBER PROFILE
   ============================================================ */
.member-profile {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.member-avatar {
  flex-shrink: 0;
  text-align: center;
}

.member-avatar-img {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--sidebar-bg);
  border: 3px solid var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: var(--text-muted);
  overflow: hidden;
}

.member-info {
  flex: 1;
}

.member-name {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--header-bg);
  margin-bottom: 8px;
}

.member-meta-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.member-meta-item {
  display: flex;
  gap: 8px;
  font-size: 0.88rem;
}

.member-meta-item .label {
  color: var(--text-muted);
  font-weight: 600;
  min-width: 100px;
}

.member-meta-item .value {
  color: var(--text);
  font-weight: 500;
}

/* ============================================================
   ARTICLE / LESSON PAGE
   ============================================================ */
.article-full {
  padding: 20px;
  line-height: 1.8;
}

.article-full h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--header-bg);
  margin-bottom: 8px;
}

.article-full .article-meta {
  display: flex;
  gap: 16px;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.article-full .article-meta a {
  color: var(--accent);
  font-weight: 600;
}

.article-full p {
  margin-bottom: 14px;
  font-size: 0.92rem;
}

.article-full h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--header-bg);
  margin: 20px 0 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.article-full pre {
  margin: 14px 0;
}

.article-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  gap: 12px;
}

/* ============================================================
   FORUM INDEX
   ============================================================ */
.forum-category {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border-light);
  overflow: hidden;
  margin-bottom: 16px;
}

.forum-category-header {
  background: linear-gradient(135deg, var(--header-bg), #2a3550);
  padding: 12px 16px;
  border-bottom: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.forum-category-header h2 {
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
}

.forum-category-header a {
  color: var(--accent);
  font-size: 0.82rem;
  text-decoration: none;
}

.forum-category-body {
  padding: 0;
}

.forum-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition);
}

.forum-row:last-child {
  border-bottom: none;
}

.forum-row:hover {
  background: #f8f6f1;
}

.forum-icon {
  width: 36px;
  height: 36px;
  background: var(--primary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1rem;
}

.forum-row-info {
  flex: 1;
}

.forum-row-title {
  font-weight: 700;
  color: var(--header-bg);
  font-size: 0.92rem;
  margin-bottom: 2px;
}

.forum-row-title a {
  color: inherit;
}

.forum-row-title a:hover {
  color: var(--primary);
  text-decoration: none;
}

.forum-row-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.forum-row-stats {
  display: flex;
  gap: 20px;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  flex-shrink: 0;
}

.forum-stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.forum-stat-num {
  font-weight: 700;
  color: var(--primary);
  font-size: 0.95rem;
}

/* ============================================================
   FORUM TOPIC POST
   ============================================================ */
.post-item {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 16px;
}

.post-header {
  background: var(--sidebar-bg);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.post-author {
  font-weight: 700;
  color: var(--primary);
  font-size: 0.9rem;
}

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

.post-body {
  padding: 16px;
  font-size: 0.9rem;
  line-height: 1.8;
}

/* ============================================================
   RATINGS / STARS
   ============================================================ */
.star-rating {
  color: var(--accent);
  font-size: 1.1rem;
  letter-spacing: 2px;
}

/* ============================================================
   REDIRECT PAGE
   ============================================================ */
.redirect-box {
  text-align: center;
  padding: 40px 20px;
}

.redirect-box .countdown {
  font-size: 3rem;
  font-weight: 900;
  color: var(--primary);
  display: block;
  margin: 16px 0;
}

/* ============================================================
   SEARCH PAGE
   ============================================================ */
.search-hero {
  background: linear-gradient(135deg, var(--header-bg), #2a3550);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 20px;
  display: flex;
  gap: 10px;
  align-items: center;
  box-shadow: var(--shadow-md);
}

.search-hero input[type="search"] {
  flex: 1;
  border: 2px solid rgba(255,255,255,0.2);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-family: var(--font-main);
  font-size: 1rem;
  background: rgba(255,255,255,0.1);
  color: #fff;
  direction: ltr;
}

.search-hero input::placeholder {
  color: rgba(255,255,255,0.45);
}

.search-hero input:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(255,255,255,0.15);
}

.search-hero button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 24px;
  font-family: var(--font-main);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--transition);
  white-space: nowrap;
}

.search-hero button:hover {
  background: var(--accent-dark);
}

/* ============================================================
   LINKS DIRECTORY
   ============================================================ */
.link-category {
  margin-bottom: 24px;
}

.link-category-title {
  background: linear-gradient(135deg, var(--header-bg), #2a3550);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius) var(--radius) 0 0;
  font-weight: 700;
  font-size: 0.95rem;
  border-bottom: 2px solid var(--accent);
}

.link-list {
  background: var(--card-bg);
  border: 1px solid var(--border-light);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow);
}

.link-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition);
}

.link-item:last-child {
  border-bottom: none;
}

.link-item:hover {
  background: #f7f5f0;
}

.link-item a {
  font-weight: 600;
  font-size: 0.88rem;
  flex: 1;
}

.link-dot {
  width: 7px;
  height: 7px;
  background: var(--primary);
  border-radius: 50%;
  flex-shrink: 0;
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  background: var(--header-bg);
  color: rgba(255,255,255,0.65);
  margin-top: auto;
  padding: 0;
}

.footer-inner {
  padding: 16px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.footer-inner p {
  font-size: 0.8rem;
  line-height: 1.6;
}

.footer-inner a {
  color: var(--accent);
  text-decoration: none;
}

.footer-inner a:hover {
  color: #f5a83a;
  text-decoration: underline;
}

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-primary { color: var(--primary); }
.font-bold { font-weight: 700; }
.font-code { font-family: var(--font-code); }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.p-16 { padding: 16px; }
.p-20 { padding: 20px; }
.d-flex { display: flex; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }

.alert {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.alert-info {
  background: rgba(58,125,68,0.1);
  border: 1px solid rgba(58,125,68,0.3);
  color: var(--primary-dark);
}

.alert-warning {
  background: rgba(212,137,42,0.1);
  border: 1px solid rgba(212,137,42,0.3);
  color: var(--accent-dark);
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  opacity: 0.4;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .layout-3col {
    grid-template-columns: 200px 1fr;
  }

  .mini-sidebar {
    display: none;
  }
}

@media (max-width: 768px) {
  .layout-3col,
  .layout-2col {
    grid-template-columns: 1fr;
  }

  .sidebar {
    order: 2;
  }

  .main-content {
    order: 1;
  }

  .nav-toggle {
    display: flex;
    order: 2;
    flex-shrink: 0;
  }

  .header-inner {
    height: auto;
    min-height: var(--header-height);
    padding: 10px 16px;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
  }

  .logo { order: 1; flex: 1; }

  .header-search {
    order: 3;
    flex: 1;
  }

  .header-search input[type="search"] {
    width: 100%;
  }

  .main-nav {
    order: 4;
    width: 100%;
    display: none;
    flex-direction: column;
    align-items: flex-start;
    overflow: visible;
    padding: 4px 0 8px;
    gap: 2px;
  }

  .main-nav.nav-open {
    display: flex;
  }

  .main-nav a {
    width: 100%;
    font-size: 0.9rem;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
  }

  .logo-sub {
    display: none;
  }

  .prog-grid {
    grid-template-columns: 1fr;
  }

  .book-card {
    flex-direction: column;
  }

  .book-card-cover {
    width: 100%;
    display: flex;
    justify-content: center;
  }

  .book-card-cover img {
    width: 100px;
  }

  .forum-row {
    flex-wrap: wrap;
  }

  .forum-row-stats {
    width: 100%;
    justify-content: flex-start;
    padding-top: 8px;
    border-top: 1px solid var(--border-light);
  }

  .member-profile {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .member-meta-item {
    justify-content: center;
  }

  .article-nav {
    flex-direction: column;
  }

  .search-hero {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 12px;
  }

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

  .func-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .data-table .col-date,
  .data-table .col-num {
    display: none;
  }
}
