/* ==========================================================================
   Yip.chat — Classic, Clean Developer Theme
   Minimalist, high-legibility, no neon/AI glows, fast & lightweight
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --bg-body: #0d1117;
  --bg-surface: #161b22;
  --bg-subtle: #21262d;
  --bg-muted: #30363d;
  
  --border-default: #30363d;
  --border-muted: #21262d;
  
  --text-main: #e6edf3;
  --text-muted: #8b949e;
  --text-dim: #6e7681;
  
  --accent-blue: #58a6ff;
  --accent-blue-hover: #388bfd;
  --accent-green: #238636;
  --accent-green-hover: #2ea043;
  --accent-purple: #a371f7;
  --accent-amber: #d29922;
  --accent-red: #f85149;
  
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-mono: 'JetBrains Mono', SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;
  
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
}

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

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

a {
  color: var(--accent-blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ─── Header & Nav ────────────────────────────────────────────────────────── */
.navbar {
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-default);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 16px;
  color: var(--text-main);
  text-decoration: none;
}

.brand-logo {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  object-fit: contain;
  display: block;
}

.brand-icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--bg-muted);
  border: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
  font-size: 16px;
}

.brand-badge {
  font-size: 11px;
  font-weight: 600;
  background: var(--bg-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border-default);
  padding: 1px 6px;
  border-radius: var(--radius-sm);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 18px;
  list-style: none;
}

.nav-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 5px;
}

.nav-link:hover, .nav-link.active {
  color: var(--text-main);
  text-decoration: none;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none !important;
  white-space: nowrap;
  line-height: 20px;
  transition: background-color 0.15s, border-color 0.15s;
}

.btn-primary {
  background-color: var(--accent-green);
  color: #ffffff;
  border-color: rgba(240, 246, 252, 0.1);
}

.btn-primary:hover {
  background-color: var(--accent-green-hover);
}

.btn-install {
  background-color: #1f6feb;
  color: #ffffff;
  border-color: rgba(240, 246, 252, 0.1);
}

.btn-install:hover {
  background-color: #388bfd;
}

.btn-secondary {
  background-color: var(--bg-subtle);
  color: var(--text-main);
  border-color: var(--border-default);
}

.btn-secondary:hover {
  background-color: var(--bg-muted);
  border-color: #8b949e;
}

.btn-twitch {
  background-color: #6441a5;
  color: #ffffff;
  border-color: rgba(240, 246, 252, 0.1);
}

.btn-twitch:hover {
  background-color: #7d5bbe;
}

.btn-sm {
  padding: 3px 8px;
  font-size: 12px;
  line-height: 18px;
}

.btn-lg {
  padding: 10px 18px;
  font-size: 14px;
}

.btn-block {
  width: 100%;
}

/* ─── User Menu in Nav ────────────────────────────────────────────────────── */
.user-menu {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-subtle);
  padding: 3px 10px 3px 5px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-default);
}

.user-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
}

.user-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
}

.user-logout {
  color: var(--text-dim);
  font-size: 14px;
  display: flex;
  align-items: center;
}

.user-logout:hover {
  color: var(--accent-red);
}

/* ─── Main Container & Section ────────────────────────────────────────────── */
.section {
  padding: 24px;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}

.page-header {
  border-bottom: 1px solid var(--border-default);
  padding-bottom: 16px;
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: 4px;
}

/* ─── Hero Section (Simple & Classic) ─────────────────────────────────────── */
.hero-box {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 32px;
  margin-bottom: 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 32px;
}

.hero-text h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 8px;
}

.hero-text p {
  color: var(--text-muted);
  font-size: 14px;
  max-width: 580px;
  line-height: 1.5;
  margin-bottom: 16px;
}

.hero-downloads {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.hero-stats {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 220px;
  border-left: 1px solid var(--border-default);
  padding-left: 28px;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.stat-row .stat-label {
  color: var(--text-muted);
}

.stat-row .stat-value {
  font-weight: 600;
  color: var(--text-main);
}

/* ─── Search & Filter Bar ─────────────────────────────────────────────────── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 240px;
}

.search-box i {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 14px;
}

.search-input {
  width: 100%;
  background: var(--bg-body);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 6px 12px 6px 30px;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 13px;
  outline: none;
}

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

.filter-chips {
  display: flex;
  gap: 6px;
}

.chip {
  padding: 4px 10px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.chip:hover {
  background: var(--bg-subtle);
  color: var(--text-main);
}

.chip.active {
  background: var(--bg-subtle);
  border-color: #8b949e;
  color: var(--text-main);
  font-weight: 600;
}

/* ─── Classic Table / Card List ───────────────────────────────────────────── */
.table-container {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.classic-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.classic-table th {
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-weight: 600;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-default);
  font-size: 12px;
}

.classic-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-muted);
  vertical-align: middle;
}

.classic-table tr:last-child td {
  border-bottom: none;
}

.classic-table tr:hover td {
  background-color: rgba(255, 255, 255, 0.02);
}

.script-title-link {
  font-weight: 600;
  color: var(--accent-blue);
  font-size: 14px;
  text-decoration: none;
}

.script-title-link:hover {
  text-decoration: underline;
}

.script-desc-preview {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 3px;
  max-width: 480px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge-trigger {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border-default);
  color: var(--text-main);
}

/* ─── Script Details Page Layout ─────────────────────────────────────────── */
.detail-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 24px;
}

.panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 20px;
}

.panel-header {
  border-bottom: 1px solid var(--border-default);
  padding-bottom: 12px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-main);
}

/* Code block */
.code-container {
  background: #090d12;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 20px;
}

.code-header {
  background: var(--bg-subtle);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-default);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.code-body {
  padding: 14px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
}

/* Sidebar Info List */
.sidebar-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-item {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.sidebar-label {
  color: var(--text-muted);
}

.sidebar-value {
  color: var(--text-main);
  font-weight: 500;
}

/* ─── Reviews ────────────────────────────────────────────────────────────── */
.review-item {
  border-bottom: 1px solid var(--border-muted);
  padding: 12px 0;
}

.review-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.review-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 13px;
}

.review-user-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rating-stars {
  color: var(--accent-amber);
  font-size: 13px;
}

.review-text {
  color: var(--text-main);
  font-size: 13px;
  line-height: 1.5;
}

.rating-select {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
}

.rating-select i {
  font-size: 18px;
  color: var(--text-dim);
  cursor: pointer;
}

.rating-select i.active {
  color: var(--accent-amber);
}

.form-control {
  width: 100%;
  background: var(--bg-body);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 6px 10px;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 13px;
  outline: none;
}

.form-control:focus {
  border-color: var(--accent-blue);
}

.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 5px;
  color: var(--text-main);
}

/* ─── Modals ─────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.active {
  display: flex;
}

.modal-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  max-width: 440px;
  width: 100%;
  padding: 20px;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
}

.modal-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}

.modal-desc {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 16px;
  line-height: 1.5;
}

.modal-buttons {
  display: flex;
  gap: 8px;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--text-main);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* ─── Footer ─────────────────────────────────────────────────────────────── */
.footer {
  margin-top: auto;
  border-top: 1px solid var(--border-default);
  background: var(--bg-surface);
  padding: 20px 24px;
  font-size: 12px;
  color: var(--text-dim);
}

.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

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

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

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

/* Responsive */
@media (max-width: 768px) {
  .hero-box { flex-direction: column; align-items: flex-start; }
  .hero-stats { border-left: none; padding-left: 0; border-top: 1px solid var(--border-default); padding-top: 16px; width: 100%; }
  .detail-layout { grid-template-columns: 1fr; }
}
