/* =============================================
   HEG Admin Panel — Premium CSS
   ============================================= */
:root {
  --ap: #1B5E20; --ap2: #145214; --ap-light: #e8f5e9; --ap-glow: rgba(27,94,32,.15);
  --gold: #C9A227; --gold-bg: rgba(201,162,39,.1);
  --sidebar-bg: #0b1f0e; --sidebar-w: 256px;
  --topbar-h: 64px;
  --white: #fff; --body-bg: #f4f7f4;
  --border: #e5ede5; --border2: #d0ddd0;
  --text: #1a2e1a; --text2: #4a6a4a; --text3: #7a9a7a;
  --card-shadow: 0 1px 4px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.04);
  --card-shadow-hover: 0 4px 12px rgba(0,0,0,.1), 0 12px 32px rgba(0,0,0,.07);
  --radius: 12px; --radius-sm: 8px; --radius-lg: 18px;
  --transition: .22s cubic-bezier(.4,0,.2,1);
  --font: 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
}
*,*::before,*::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body { font-family: var(--font); background: var(--body-bg); color: var(--text); min-height: 100vh; -webkit-font-smoothing: antialiased; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { max-width: 100%; display: block; }
button { font-family: var(--font); cursor: pointer; }
input, select, textarea { font-family: var(--font); }

/* ── LAYOUT ── */
.adm-layout { display: flex; min-height: 100vh; }

/* ── SIDEBAR ── */
.adm-sidebar {
  width: var(--sidebar-w); background: var(--sidebar-bg);
  position: fixed; top: 0; left: 0; bottom: 0;
  overflow-y: auto; overflow-x: hidden;
  z-index: 300; display: flex; flex-direction: column;
  transition: transform var(--transition);
}
.adm-sidebar::-webkit-scrollbar { width: 3px; }
.adm-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 2px; }

.sb-head {
  padding: 18px 16px 16px; border-bottom: 1px solid rgba(255,255,255,.06);
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
.sb-logo { display: flex; align-items: center; gap: 10px; }
.sb-logo img { height: 36px; width: auto; border-radius: 8px; }
.sb-logo-mark {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--ap) 0%, #2E7D32 100%);
  display: flex; align-items: center; justify-content: center; font-size: 16px; color: #fff;
}
.sb-logo-txt h3 { font-size: 13.5px; font-weight: 700; color: #fff; line-height: 1.2; }
.sb-logo-txt span { font-size: 10.5px; color: rgba(255,255,255,.4); }
.sb-close { display: none; background: none; border: none; color: rgba(255,255,255,.4); font-size: 18px; padding: 4px; }
.sb-close:hover { color: #fff; }

.sb-user {
  margin: 12px 12px 4px; padding: 12px; border-radius: var(--radius);
  background: rgba(255,255,255,.05); display: flex; align-items: center; gap: 10px;
}
.sb-user-av {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: var(--ap); display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: #fff;
}
.sb-user-info h4 { font-size: 12.5px; font-weight: 600; color: #fff; line-height: 1.2; }
.sb-user-info span { font-size: 10.5px; color: rgba(255,255,255,.4); }

.sb-nav { flex: 1; padding: 8px 0 16px; }
.sb-section-title {
  padding: 14px 16px 5px; font-size: 10px; font-weight: 700;
  letter-spacing: .09em; text-transform: uppercase; color: rgba(255,255,255,.28);
}
.sb-link {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px; color: rgba(255,255,255,.62); font-size: 13px; font-weight: 500;
  transition: all var(--transition); position: relative; border-left: 3px solid transparent;
  margin: 1px 0;
}
.sb-link:hover { color: #fff; background: rgba(255,255,255,.07); }
.sb-link.active {
  color: #fff; background: rgba(255,255,255,.1);
  border-left-color: var(--gold);
}
.sb-link i { width: 18px; text-align: center; font-size: 14px; flex-shrink: 0; }
.sb-link .sb-badge {
  margin-left: auto; background: var(--gold); color: #000;
  font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 20px;
}
.sb-link.danger { color: rgba(255,120,120,.7); }
.sb-link.danger:hover { color: #ff6b6b; background: rgba(255,0,0,.06); }

/* ── MAIN AREA ── */
.adm-main { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; transition: margin-left var(--transition); }

/* ── TOPBAR ── */
.adm-topbar {
  height: var(--topbar-h); background: var(--white);
  border-bottom: 1px solid var(--border); display: flex; align-items: center;
  padding: 0 24px; gap: 16px; position: sticky; top: 0; z-index: 200;
  box-shadow: 0 1px 0 var(--border), 0 2px 12px rgba(0,0,0,.04);
}
.topbar-toggle { background: none; border: none; font-size: 18px; color: var(--text2); padding: 6px; border-radius: 8px; display: none; }
.topbar-toggle:hover { background: var(--body-bg); }
.topbar-breadcrumb { flex: 1; display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text3); }
.topbar-breadcrumb a { color: var(--text3); transition: color var(--transition); }
.topbar-breadcrumb a:hover { color: var(--ap); }
.topbar-breadcrumb .sep { opacity: .4; }
.topbar-breadcrumb .current { color: var(--text); font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.topbar-icon-btn {
  width: 36px; height: 36px; border-radius: 10px; background: none; border: none;
  color: var(--text2); font-size: 15px; display: flex; align-items: center; justify-content: center;
  position: relative; transition: all var(--transition);
}
.topbar-icon-btn:hover { background: var(--body-bg); color: var(--ap); }
.topbar-icon-btn .dot {
  position: absolute; top: 7px; right: 7px; width: 7px; height: 7px;
  border-radius: 50%; background: #ef4444; border: 2px solid var(--white);
}
.topbar-user { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 10px; background: var(--body-bg); }
.topbar-user-av { width: 28px; height: 28px; border-radius: 50%; background: var(--ap); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #fff; }
.topbar-user-info { line-height: 1.2; }
.topbar-user-info strong { font-size: 12.5px; color: var(--text); display: block; }
.topbar-user-info span { font-size: 10.5px; color: var(--text3); }

/* ── PAGE CONTENT ── */
.adm-content { flex: 1; padding: 28px 28px 40px; }
@media (max-width:768px) { .adm-content { padding: 20px 16px 32px; } }

/* ── PAGE HEADER ── */
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.page-title { font-size: 1.5rem; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 10px; }
.page-title i { color: var(--ap); font-size: 1.3rem; }
.page-subtitle { font-size: 13px; color: var(--text3); margin-top: 3px; }

/* ── CARDS ── */
.admin-card {
  background: var(--white); border-radius: var(--radius-lg);
  box-shadow: var(--card-shadow); border: 1px solid var(--border);
  overflow: hidden; transition: box-shadow var(--transition);
}
.admin-card:hover { box-shadow: var(--card-shadow-hover); }
.card-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: linear-gradient(135deg, var(--white) 0%, var(--ap-light) 100%);
}
.card-header h3 { font-size: 14.5px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; }
.card-header h3 i { color: var(--ap); }
.card-body { padding: 20px; }
.card-footer { padding: 12px 20px; border-top: 1px solid var(--border); background: var(--body-bg); }
.p-0 { padding: 0 !important; }

/* ── STATS CARDS ── */
.stats-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--white); border-radius: var(--radius-lg); padding: 20px;
  display: flex; flex-direction: column; gap: 12px; border: 1px solid var(--border);
  box-shadow: var(--card-shadow); transition: all var(--transition);
  border-left: 4px solid var(--ap); position: relative; overflow: hidden;
}
.stat-card::before { content: ''; position: absolute; top: -20px; right: -20px; width: 80px; height: 80px; border-radius: 50%; background: var(--ap-glow); }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--card-shadow-hover); }
.stat-card-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.stat-card-num { font-size: 1.9rem; font-weight: 800; color: var(--text); line-height: 1; }
.stat-card-label { font-size: 12px; color: var(--text3); font-weight: 500; }
.stat-card-link { font-size: 11.5px; color: var(--text3); display: flex; align-items: center; gap: 4px; transition: color var(--transition); margin-top: 4px; }
.stat-card-link:hover { color: var(--ap); }

.stat-card.green  { border-left-color:#2e7d32; } .stat-card.green .stat-card-icon  { background:#e8f5e9; color:#2e7d32; }
.stat-card.blue   { border-left-color:#1565c0; } .stat-card.blue .stat-card-icon   { background:#e3f2fd; color:#1565c0; }
.stat-card.orange { border-left-color:#e65100; } .stat-card.orange .stat-card-icon { background:#fff3e0; color:#e65100; }
.stat-card.red    { border-left-color:#b71c1c; } .stat-card.red .stat-card-icon    { background:#ffebee; color:#b71c1c; }
.stat-card.purple { border-left-color:#6a1b9a; } .stat-card.purple .stat-card-icon { background:#f3e5f5; color:#6a1b9a; }
.stat-card.teal   { border-left-color:#00695c; } .stat-card.teal .stat-card-icon   { background:#e0f2f1; color:#00695c; }
.stat-card.indigo { border-left-color:#283593; } .stat-card.indigo .stat-card-icon { background:#e8eaf6; color:#283593; }
.stat-card.yellow { border-left-color:#f57f17; } .stat-card.yellow .stat-card-icon { background:#fff8e1; color:#f57f17; }

/* ── TABLE ── */
.admin-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.admin-table thead tr { background: var(--ap-light); }
.admin-table th { padding: 11px 16px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text2); text-align: left; border-bottom: 2px solid var(--border); white-space: nowrap; }
.admin-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: middle; }
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover td { background: var(--ap-light); }
.admin-table .text-center { text-align: center; }
.admin-table .text-muted { color: var(--text3); font-style: italic; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; border: none; cursor: pointer;
  transition: all var(--transition); white-space: nowrap; line-height: 1;
}
.btn i { font-size: 12px; }
.btn-primary   { background: var(--ap);      color: #fff; box-shadow: 0 2px 8px var(--ap-glow); }
.btn-primary:hover { background: var(--ap2); transform: translateY(-1px); box-shadow: 0 4px 16px var(--ap-glow); }
.btn-secondary { background: var(--body-bg); color: var(--text); border: 1.5px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-danger    { background: #b71c1c; color: #fff; }
.btn-danger:hover { background: #8b0000; }
.btn-warning   { background: #e65100; color: #fff; }
.btn-warning:hover { background: #bf360c; }
.btn-success   { background: #2e7d32; color: #fff; }
.btn-success:hover { background: #1b5e20; }
.btn-info      { background: #01579b; color: #fff; }
.btn-info:hover { background: #01427a; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-xs { padding: 4px 9px; font-size: 11px; border-radius: 6px; }
.btn-lg { padding: 12px 24px; font-size: 14.5px; }

/* ── FORMS ── */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-weight: 600; font-size: 12.5px; color: var(--text); margin-bottom: 6px; }
.form-group label small { font-weight: 400; color: var(--text3); }
.form-control {
  width: 100%; padding: 10px 13px; font-size: 13.5px;
  border: 1.5px solid var(--border2); border-radius: var(--radius-sm);
  background: var(--white); color: var(--text); transition: border-color var(--transition);
  box-sizing: border-box;
}
.form-control:focus { border-color: var(--ap); outline: none; box-shadow: 0 0 0 3px var(--ap-glow); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 100px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: 16px; }
.form-actions { display: flex; align-items: center; gap: 12px; padding-top: 16px; flex-wrap: wrap; }

/* ── TOGGLE SWITCH ── */
.toggle-switch { display: inline-flex; align-items: center; cursor: pointer; gap: 8px; }
.toggle-switch input { display: none; }
.toggle-slider {
  width: 44px; height: 24px; border-radius: 12px; background: var(--border2);
  position: relative; transition: background var(--transition); flex-shrink: 0;
}
.toggle-slider::after {
  content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; top: 3px; left: 3px; transition: left var(--transition);
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}
.toggle-switch input:checked + .toggle-slider { background: var(--ap); }
.toggle-switch input:checked + .toggle-slider::after { left: 23px; }

/* ── STATUS TOGGLE BUTTON ── */
.toggle-btn { padding: 4px 13px; border-radius: 20px; border: 1.5px solid; font-size: 11.5px; font-weight: 700; cursor: pointer; transition: all var(--transition); background: none; }
.toggle-btn.on  { border-color: #2e7d32; color: #2e7d32; background: #e8f5e9; }
.toggle-btn.off { border-color: var(--border2); color: var(--text3); background: var(--body-bg); }
.toggle-btn.on:hover  { background: #2e7d32; color: #fff; }
.toggle-btn.off:hover { background: var(--text3); color: #fff; }

/* ── BADGES ── */
.badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.badge-success  { background: #e8f5e9; color: #2e7d32; }
.badge-danger   { background: #ffebee; color: #b71c1c; }
.badge-warning  { background: #fff8e1; color: #e65100; }
.badge-info     { background: #e3f2fd; color: #1565c0; }
.badge-secondary{ background: var(--body-bg); color: var(--text3); }

/* ── LANG TABS ── */
.lang-tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 0; }
.lang-tab { padding: 8px 18px; background: none; border: none; border-bottom: 3px solid transparent; margin-bottom: -2px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--text3); transition: all var(--transition); border-radius: 8px 8px 0 0; }
.lang-tab:hover { color: var(--ap); background: var(--ap-light); }
.lang-tab.active { color: var(--ap); border-bottom-color: var(--ap); }
.lang-pane { display: none; padding: 20px 0 0; }
.lang-pane.active { display: block; }

/* ── ADMIN TABS ── */
.admin-tabs { display: flex; gap: 4px; background: var(--body-bg); padding: 5px; border-radius: 12px; margin-bottom: 20px; width: fit-content; }
.admin-tab { padding: 9px 20px; border-radius: 8px; border: none; background: none; font-weight: 600; font-size: 13px; color: var(--text3); cursor: pointer; transition: all var(--transition); }
.admin-tab:hover { color: var(--ap); }
.admin-tab.active { background: var(--white); color: var(--ap); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ── FILTER TABS ── */
.filter-tabs { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.filter-tab { padding: 7px 16px; border-radius: 20px; border: 1.5px solid var(--border2); color: var(--text2); text-decoration: none; font-weight: 600; font-size: 12.5px; transition: all var(--transition); }
.filter-tab.active, .filter-tab:hover { background: var(--ap); color: #fff; border-color: var(--ap); }

/* ── SECTIONS TOGGLE ── */
.sections-toggle-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px,1fr)); gap: 10px; }
.section-toggle-item { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--body-bg); border-radius: 10px; border: 1.5px solid var(--border); transition: border-color var(--transition); }
.section-toggle-item:hover { border-color: var(--ap); }
.section-toggle-item span { font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 7px; }
.section-toggle-item i { color: var(--ap); width: 16px; }

/* ── DASHBOARD GRID ── */
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px,1fr)); gap: 20px; }
.mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; }

/* ── ALERT ── */
.alert-box { padding: 13px 16px; border-radius: 10px; margin-bottom: 18px; font-size: 13px; display: flex; align-items: center; gap: 8px; }
.alert-success { background: #e8f5e9; border-left: 4px solid #2e7d32; color: #2e7d32; }
.alert-danger  { background: #ffebee; border-left: 4px solid #b71c1c; color: #b71c1c; }
.alert-warning { background: #fff8e1; border-left: 4px solid #e65100; color: #e65100; }
.alert-info    { background: #e3f2fd; border-left: 4px solid #1565c0; color: #1565c0; }

/* ── TOAST ── */
.admin-toast-container { position: fixed; top: 80px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.admin-toast {
  background: var(--white); border-radius: 12px; padding: 14px 18px;
  box-shadow: 0 8px 32px rgba(0,0,0,.14); border-left: 4px solid var(--ap);
  min-width: 280px; max-width: 380px; pointer-events: all;
  animation: toastIn .3s ease; font-size: 13.5px;
  display: flex; align-items: center; gap: 10px;
}
.admin-toast.error { border-left-color: #b71c1c; }
.admin-toast.warning { border-left-color: #e65100; }
.admin-toast i { font-size: 16px; flex-shrink: 0; }
@keyframes toastIn { from { transform: translateX(120%); opacity:0; } to { transform:none; opacity:1; } }

/* ── PERMS GRID ── */
.perms-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(150px,1fr)); gap: 10px; }
.perm-checkbox { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 9px; font-weight: 500; font-size: 13px; transition: all var(--transition); }
.perm-checkbox:has(input:checked) { border-color: var(--ap); background: var(--ap-light); }

/* ── MEDIA GRID ── */
.media-grid { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.media-item { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.gallery-admin-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(130px,1fr)); gap: 12px; }
.gallery-admin-item { position: relative; border-radius: 10px; overflow: hidden; border: 2px solid var(--border); background: #111; }
.gallery-admin-item img { width: 100%; height: 100px; object-fit: cover; display: block; }
.gallery-admin-actions { position: absolute; top: 4px; right: 4px; display: flex; gap: 4px; opacity: 0; transition: opacity var(--transition); }
.gallery-admin-item:hover .gallery-admin-actions { opacity: 1; }
.gallery-caption { padding: 5px 7px; font-size: 11px; color: var(--text3); background: var(--body-bg); }
.gallery-type-badge { position: absolute; top: 4px; left: 4px; background: rgba(0,0,0,.65); color: #fff; border-radius: 6px; padding: 2px 7px; font-size: 10.5px; }

/* ── CURRENT IMG PREVIEW ── */
.current-img img { max-height: 80px; border-radius: 8px; border: 2px solid var(--border); }

/* ── MISC ── */
.text-muted { color: var(--text3); }
.text-center { text-align: center; }
.text-danger { color: #b71c1c; }
.text-success { color: #2e7d32; }
.font-bold { font-weight: 700; }
.detail-table { width: 100%; border-collapse: collapse; }
.detail-table th { width: 140px; text-align: left; padding: 9px 13px; color: var(--text3); font-weight: 600; font-size: 12.5px; background: var(--body-bg); }
.detail-table td { padding: 9px 13px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.message-body { background: var(--body-bg); border-left: 4px solid var(--ap); padding: 16px; border-radius: 0 10px 10px 0; line-height: 1.75; }
.row-unread { font-weight: 700; background: #fffde7; }
.article-content { line-height: 1.85; font-size: 14px; color: var(--text); }

/* ── RESPONSIVE ── */
@media (max-width:960px) {
  .adm-sidebar { transform: translateX(-100%); }
  .adm-sidebar.open { transform: none; }
  .adm-main { margin-left: 0; }
  .topbar-toggle { display: flex; }
  .sb-close { display: block; }
  .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width:640px) {
  .stats-cards { grid-template-columns: repeat(2,1fr); }
  .form-row { grid-template-columns: 1fr; }
  .page-header { gap: 10px; }
  .adm-content { padding: 16px 12px; }
}

/* ── MODAL ── */
.admin-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 9000; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(3px); }
.admin-modal { background: var(--white); border-radius: var(--radius-lg); width: 95%; max-width: 540px; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal-header { padding: 16px 20px; background: var(--ap-light); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 15px; font-weight: 700; color: var(--text); }
.modal-body { padding: 20px; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
