/* ============================================================
   เจมสน้อย จูนเนอร์ — Download Center
   แก้ไขสี ฟอนต์ และขนาดได้ใน :root ด้านล่าง
   ============================================================ */

/* ─── CSS VARIABLES (แก้ไขที่นี่เพื่อเปลี่ยนธีม) ─── */
:root {
  /* สีพื้นหลัง */
  --bg-main:     #0d1117;   /* พื้นหลังหลัก */
  --bg-sidebar:  #161b22;   /* พื้นหลัง Sidebar */
  --bg-card:     #1c2128;   /* พื้นหลังการ์ด */
  --bg-hover:    #21262d;   /* สีเมื่อ hover */

  /* เส้นขอบ */
  --border:      #30363d;

  /* สีทอง (แบรนด์หลัก) */
  --gold-bright: #f0c040;
  --gold-dim:    #b8860b;
  --gold-glow:   rgba(240,192,64,0.18);

  /* สีน้ำเงิน */
  --blue-accent: #1e90ff;
  --blue-dim:    #0d47a1;

  /* สีสถานะ */
  --green-ok:    #3fb950;
  --red-warn:    #f85149;

  /* สีข้อความ */
  --text-main:   #e6edf3;
  --text-muted:  #8b949e;
  --text-faint:  #484f58;

  /* ขนาด Activity Bar */
  --activity-w:  56px;
}

/* ─── RESET & BASE ─── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Sarabun', sans-serif;
  background: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ─── SCROLLBAR ─── */
::-webkit-scrollbar { width: 8px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-main); }
::-webkit-scrollbar-thumb { background: #30363d; border-radius: 4px; }

/* ─── TITLE BAR (แถบบนสุด macOS style) ─── */
.titlebar {
  background: #010409;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  height: 38px;
  user-select: none;
  position: sticky;
  top: 0;
  z-index: 100;
}

.titlebar-dots span {
  display: inline-block;
  width: 12px; height: 12px;
  border-radius: 50%;
  margin-right: 6px;
}
.dot-red    { background: #ff5f57; }
.dot-yellow { background: #ffbd2e; }
.dot-green  { background: #28c840; }

.titlebar-name {
  flex: 1;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}
.titlebar-name span { color: var(--gold-bright); }

/* ─── MENU BAR ─── */
.menubar {
  background: #161b22;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 12px;
  height: 30px;
  gap: 4px;
}

.menubar-item {
  font-size: 12px;
  color: var(--text-muted);
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.menubar-item:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

/* ─── WORKSPACE LAYOUT ─── */
.workspace {
  display: flex;
  flex: 1;
}

/* ─── ACTIVITY BAR ─── */
.activity-bar {
  width: var(--activity-w);
  background: #010409;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 8px;
  gap: 4px;
  flex-shrink: 0;
}

.act-icon {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  color: var(--text-faint);
  cursor: pointer;
  transition: color .2s, background .2s;
  font-size: 20px;
}
.act-icon:hover { color: var(--text-main); background: var(--bg-hover); }
.act-icon.active {
  color: var(--gold-bright);
  border-left: 2px solid var(--gold-bright);
  border-radius: 0 6px 6px 0;
  margin-left: -2px;
}

/* ─── SIDEBAR ─── */
.sidebar {
  width: 240px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}

.sidebar-header {
  padding: 10px 12px 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 1.2px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}

.tree-section { padding: 6px 0; }

.tree-label {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.3px;
}
.tree-label:hover { color: var(--text-main); }

.tree-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 12px 3px 28px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: all .15s;
}
.tree-item:hover { background: var(--bg-hover); color: var(--text-main); }
.tree-item.active {
  background: var(--bg-hover);
  color: var(--gold-bright);
  border-left-color: var(--gold-bright);
}
.tree-icon { font-size: 14px; flex-shrink: 0; }

/* ─── EDITOR AREA ─── */
.editor-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Tab Bar */
.tab-bar {
  background: #010409;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  height: 35px;
  overflow-x: auto;
}
.tab-bar::-webkit-scrollbar { height: 3px; }
.tab-bar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
  cursor: pointer;
  border-right: 1px solid var(--border);
  border-bottom: 2px solid transparent;
  transition: all .15s;
  flex-shrink: 0;
}
.tab:hover { background: var(--bg-hover); color: var(--text-main); }
.tab.active {
  background: var(--bg-card);
  color: var(--gold-bright);
  border-bottom-color: var(--gold-bright);
}

.tab-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--green-ok);
  flex-shrink: 0;
}

/* Breadcrumb */
.breadcrumb {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 4px 16px;
  font-size: 12px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
}
.breadcrumb span  { color: var(--text-faint); margin: 0 4px; }
.breadcrumb .crumb { color: var(--gold-bright); }

/* Editor Content */
.editor-content {
  flex: 1;
  overflow-y: auto;
  padding: 32px 40px 60px;
}
.editor-content::-webkit-scrollbar { width: 8px; }
.editor-content::-webkit-scrollbar-track { background: var(--bg-main); }
.editor-content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* ─── HERO SECTION ─── */
.hero {
  display: flex;
  align-items: center;
  gap: 32px;
  margin-bottom: 40px;
  padding: 28px 32px;
  background: linear-gradient(135deg, #0d1117 0%, #1a1f2e 50%, #0d1117 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 30% 50%, rgba(240,192,64,0.06) 0%, transparent 60%),
    radial-gradient(ellipse at 70% 50%, rgba(30,144,255,0.04) 0%, transparent 60%);
  pointer-events: none;
}

.hero-logo {
  width: 120px; height: 120px;
  border-radius: 16px;
  object-fit: cover;
  border: 2px solid var(--gold-dim);
  box-shadow: 0 0 24px var(--gold-glow);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

/* โลโก้ placeholder เมื่อยังไม่มีรูป */
.hero-logo-placeholder {
  width: 120px; height: 120px;
  border-radius: 16px;
  border: 2px solid var(--gold-dim);
  box-shadow: 0 0 24px var(--gold-glow);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
}

.hero-text { position: relative; z-index: 1; }

.hero-title {
  font-size: 28px;
  font-weight: 800;
  background: linear-gradient(90deg, var(--gold-bright) 0%, #ffe88a 50%, var(--gold-bright) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
  margin-bottom: 4px;
}

.hero-sub {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 12px;
  font-family: 'JetBrains Mono', monospace;
}
.hero-sub .ver { color: var(--blue-accent); }

.hero-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ─── BADGES ─── */
.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  letter-spacing: 0.5px;
}
.badge-gold  { background: rgba(240,192,64,0.15); color: var(--gold-bright); border: 1px solid var(--gold-dim); }
.badge-blue  { background: rgba(30,144,255,0.12); color: var(--blue-accent); border: 1px solid var(--blue-dim); }
.badge-green { background: rgba(63,185,80,0.12);  color: var(--green-ok);    border: 1px solid #238636; }

/* ─── SIGNATURE CARD ─── */
.signature-card {
  background: var(--bg-card);
  border: 1px solid var(--gold-dim);
  border-radius: 10px;
  padding: 20px 24px;
  margin-bottom: 32px;
  display: flex;
  align-items: center;
  gap: 20px;
  box-shadow: 0 0 30px rgba(240,192,64,0.08);
  position: relative;
  overflow: hidden;
}
.signature-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, var(--gold-bright), var(--gold-dim));
  border-radius: 10px 0 0 10px;
}

.sig-avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--gold-bright);
  box-shadow: 0 0 16px var(--gold-glow);
  flex-shrink: 0;
}

.sig-avatar-placeholder {
  width: 64px; height: 64px;
  border-radius: 50%;
  border: 2px solid var(--gold-bright);
  box-shadow: 0 0 16px var(--gold-glow);
  flex-shrink: 0;
  background: var(--bg-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.sig-info { flex: 1; }

.sig-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--gold-bright);
  margin-bottom: 2px;
}

.sig-role {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.sig-contact {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.contact-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-hover);
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all .2s;
  text-decoration: none;
}
.contact-chip:hover {
  border-color: var(--gold-dim);
  color: var(--gold-bright);
  background: var(--gold-glow);
}

/* ─── SECTION HEADING ─── */
.section-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  margin-top: 36px;
}

.sh-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--gold-glow);
  border: 1px solid var(--gold-dim);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.sh-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: 0.3px;
}

.sh-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

.sh-count {
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-faint);
  background: var(--bg-hover);
  padding: 2px 8px;
  border-radius: 20px;
  border: 1px solid var(--border);
}

/* ─── DOWNLOAD CARDS GRID ─── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  margin-bottom: 8px;
}

.dl-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  cursor: pointer;
  transition: all .2s;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
}
.dl-card:hover {
  border-color: var(--gold-dim);
  background: #21262d;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4), 0 0 20px var(--gold-glow);
}
.dl-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(240,192,64,0.03) 0%, transparent 50%);
  pointer-events: none;
}

.card-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.card-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
  border: 1px solid var(--border);
}
.card-icon.gold   { background: rgba(240,192,64,0.1);  border-color: var(--gold-dim); }
.card-icon.blue   { background: rgba(30,144,255,0.1);  border-color: var(--blue-dim); }
.card-icon.green  { background: rgba(63,185,80,0.1);   border-color: #238636; }
.card-icon.red    { background: rgba(248,81,73,0.1);   border-color: #da3633; }
.card-icon.purple { background: rgba(163,113,247,0.1); border-color: #6e40c9; }

.card-meta { flex: 1; min-width: 0; }

.card-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-version {
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--blue-accent);
  margin-bottom: 2px;
}

.card-size {
  font-size: 11px;
  color: var(--text-faint);
}

.card-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ─── TAGS ─── */
.tag {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.tag-win   { background: rgba(30,144,255,0.15); color: #79b8ff; }
.tag-free  { background: rgba(63,185,80,0.15);  color: #85e89d; }
.tag-paid  { background: rgba(240,192,64,0.15); color: var(--gold-bright); }
.tag-admin { background: rgba(248,81,73,0.15);  color: #ffa198; }
.tag-32    { background: rgba(163,113,247,0.15);color: #b392f0; }
.tag-64    { background: rgba(30,144,255,0.15); color: #79b8ff; }

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: auto;
}

/* ─── DOWNLOAD BUTTON ─── */
.dl-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: linear-gradient(135deg, var(--gold-dim), #8b6914);
  color: #000;
  font-size: 12px;
  font-weight: 700;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: all .2s;
  text-decoration: none;
  font-family: 'Sarabun', sans-serif;
}
.dl-btn:hover {
  background: linear-gradient(135deg, var(--gold-bright), var(--gold-dim));
  transform: scale(1.04);
  box-shadow: 0 4px 14px var(--gold-glow);
}

.card-dl-count {
  font-size: 11px;
  color: var(--text-faint);
  font-family: 'JetBrains Mono', monospace;
}

/* ─── NOTICE BOX ─── */
.notice {
  background: rgba(240,192,64,0.06);
  border: 1px solid var(--gold-dim);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 24px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  line-height: 1.6;
}
.notice-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }

/* ─── ADMIN SIGNATURE BLOCK ─── */
.sig-code-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 24px;
  margin-bottom: 8px;
}

.sig-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 2;
}

.sig-code .comment  { color: var(--text-faint); }
.sig-code .keyword  { color: #f97583; }
.sig-code .varname  { color: #79b8ff; }
.sig-code .operator { color: #e3b341; }
.sig-code .string   { color: var(--gold-bright); }
.sig-code .string2  { color: #a8d8a8; }
.sig-code .bool     { color: #79b8ff; }
.sig-code .indent   { padding-left: 20px; }

.sig-footer {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
  margin-top: 16px;
  padding-top: 16px;
}

.sig-handwrite {
  font-size: 24px;
  font-weight: 800;
  color: var(--gold-bright);
  font-family: 'Sarabun', sans-serif;
  letter-spacing: 1px;
  text-shadow: 0 0 20px rgba(240,192,64,0.4);
}

.sig-hash-block { flex: 1; min-width: 200px; }

.sig-hash-label {
  font-size: 11px;
  color: var(--text-faint);
  font-family: 'JetBrains Mono', monospace;
  margin-bottom: 4px;
}

.sig-hash-value {
  font-size: 11px;
  color: var(--blue-accent);
  font-family: 'JetBrains Mono', monospace;
  word-break: break-all;
}

.verified-badge {
  background: rgba(63,185,80,0.12);
  border: 1px solid #238636;
  border-radius: 6px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.verified-badge span { color: var(--green-ok); font-size: 14px; }
.verified-badge strong { font-size: 12px; font-weight: 700; color: var(--green-ok); }

/* ─── STATUS BAR ─── */
.statusbar {
  background: var(--gold-dim);
  height: 24px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  gap: 16px;
  flex-shrink: 0;
}

.sb-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: #000;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
}

.sb-right {
  margin-left: auto;
  display: flex;
  gap: 16px;
}

/* ─── RESPONSIVE (มือถือ) ─── */
@media (max-width: 768px) {
  .sidebar      { display: none; }
  .activity-bar { display: none; }

  .editor-content { padding: 20px 16px 48px; }

  .hero {
    flex-direction: column;
    text-align: center;
  }
  .hero-badges { justify-content: center; }

  .cards-grid { grid-template-columns: 1fr; }

  .sig-contact { justify-content: center; }

  .signature-card {
    flex-direction: column;
    text-align: center;
  }

  .sig-footer {
    flex-direction: column;
    align-items: flex-start;
  }
}