/* =============================================
   NusaScript Documentation — Shared Stylesheet
   Terinspirasi dari W3Schools dengan tema merah-putih Indonesia
   ============================================= */

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

:root {
  --primary:      #c0392b;
  --primary-dark: #962d22;
  --primary-light:#e74c3c;
  --accent:       #f39c12;
  --sidebar-bg:   #2c2c2c;
  --sidebar-hover:#3d3d3d;
  --sidebar-active:#c0392b;
  --content-bg:   #ffffff;
  --code-bg:      #1e1e2e;
  --code-text:    #cdd6f4;
  --note-bg:      #fff3cd;
  --note-border:  #f39c12;
  --tip-bg:       #d4edda;
  --tip-border:   #28a745;
  --warn-bg:      #f8d7da;
  --warn-border:  #dc3545;
  --topbar-h:     56px;
  --sidebar-w:    280px;
  --border:       #e0e0e0;
  --text:         #2c2c2c;
  --text-light:   #666;
  --example-bg:   #f8f9fa;
}

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

body {
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  color: var(--text);
  background: #f5f5f5;
  line-height: 1.7;
}

/* ---- Top Navigation Bar ---- */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--primary);
  display: flex;
  align-items: center;
  padding: 0 20px;
  z-index: 1000;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  gap: 20px;
}
.topbar .logo {
  font-size: 22px;
  font-weight: 700;
  color: white;
  text-decoration: none;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}
.topbar .logo span { color: #ffd700; }
.topbar .logo .flag { font-size: 20px; }

.topbar .nav-links {
  display: flex;
  gap: 4px;
  margin-left: 20px;
}
.topbar .nav-links a {
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
}
.topbar .nav-links a:hover,
.topbar .nav-links a.active {
  background: rgba(255,255,255,0.2);
  color: white;
}

.topbar .search-box {
  margin-left: auto;
  position: relative;
}
.topbar .search-box input {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 20px;
  padding: 6px 16px 6px 36px;
  color: white;
  font-size: 13px;
  width: 220px;
  outline: none;
  transition: all 0.2s;
  font-family: 'Inter', sans-serif;
}
.topbar .search-box input::placeholder { color: rgba(255,255,255,0.6); }
.topbar .search-box input:focus {
  background: rgba(255,255,255,0.25);
  width: 260px;
}
.topbar .search-box svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255,255,255,0.7);
}

/* ---- Layout ---- */
.layout {
  display: flex;
  margin-top: var(--topbar-h);
  min-height: calc(100vh - var(--topbar-h));
}

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  position: fixed;
  top: var(--topbar-h);
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 100;
  scrollbar-width: thin;
  scrollbar-color: #555 transparent;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: #555; border-radius: 2px; }

.sidebar .sidebar-section {
  padding: 12px 0 4px;
}
.sidebar .sidebar-heading {
  color: #888;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  padding: 0 20px 6px;
  margin-top: 8px;
}
.sidebar a {
  display: block;
  padding: 8px 20px 8px 28px;
  color: #bbb;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 400;
  transition: all 0.15s;
  border-left: 3px solid transparent;
  line-height: 1.4;
}
.sidebar a:hover {
  background: var(--sidebar-hover);
  color: white;
  border-left-color: #888;
}
.sidebar a.active {
  background: rgba(192,57,43,0.2);
  color: white;
  border-left-color: var(--primary);
  font-weight: 600;
}
.sidebar .sidebar-divider {
  height: 1px;
  background: #3d3d3d;
  margin: 8px 16px;
}

/* ---- Main Content ---- */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: calc(100vh - var(--topbar-h));
}

.content-wrapper {
  max-width: 900px;
  padding: 36px 40px 60px;
  background: var(--content-bg);
  min-height: calc(100vh - var(--topbar-h));
  box-shadow: 1px 0 0 var(--border);
}

/* ---- Typography ---- */
h1 {
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
  letter-spacing: -0.5px;
}
h2 {
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  margin: 36px 0 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
}
h3 {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  margin: 24px 0 8px;
}
p { margin-bottom: 14px; color: #444; }

.page-subtitle {
  font-size: 17px;
  color: var(--text-light);
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

/* ---- Code Examples (W3Schools style) ---- */
.example {
  background: var(--example-bg);
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  margin: 20px 0;
  overflow: hidden;
}
.example-header {
  background: #e8e8e8;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  color: #555;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #ddd;
}
.example-header .ex-label {
  display: flex;
  align-items: center;
  gap: 8px;
}
.example-header .ex-label::before {
  content: '';
  width: 8px; height: 8px;
  background: var(--primary);
  border-radius: 50%;
}
.copy-btn {
  background: none;
  border: 1px solid #bbb;
  border-radius: 4px;
  padding: 2px 10px;
  font-size: 11px;
  cursor: pointer;
  color: #666;
  font-family: 'Inter', sans-serif;
  transition: all 0.2s;
}
.copy-btn:hover { background: #ddd; color: #333; }
.copy-btn.copied { background: #28a745; color: white; border-color: #28a745; }

pre {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 18px 20px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13.5px;
  line-height: 1.7;
  overflow-x: auto;
  tab-size: 2;
}
pre code { background: none; padding: 0; border-radius: 0; font-size: inherit; }

code {
  background: #f0f0f0;
  color: #c0392b;
  padding: 1px 6px;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
}

.output-box {
  background: #fff;
  border-top: 1px solid #ddd;
  padding: 12px 16px;
}
.output-box .out-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: #888;
  letter-spacing: 0.8px;
  margin-bottom: 6px;
}
.output-box pre {
  background: none;
  color: #333;
  padding: 0;
  font-size: 13px;
  line-height: 1.5;
}

/* ---- Syntax Highlighting ---- */
.kw  { color: #cba6f7; font-weight: 600; } /* keyword: biarkan, fungsi, dll */
.str { color: #a6e3a1; }                    /* string */
.num { color: #fab387; }                    /* number */
.cmt { color: #6c7086; font-style: italic; } /* comment */
.fn  { color: #89dceb; }                    /* function name */
.op  { color: #f38ba8; }                    /* operator */
.bool { color: #f9e2af; font-weight: 600; } /* benar/salah/nihil */
.punc { color: #cdd6f4; }                   /* brackets etc */
.var  { color: #cdd6f4; }                   /* variable names */

/* ---- Try It Yourself ---- */
.try-btn {
  display: inline-block;
  background: var(--primary);
  color: white;
  text-decoration: none;
  padding: 8px 20px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  margin: 10px 16px 14px;
  transition: all 0.2s;
  cursor: pointer;
  border: none;
  font-family: 'Inter', sans-serif;
}
.try-btn:hover { background: var(--primary-dark); transform: translateY(-1px); }

/* ---- Callout Boxes ---- */
.note, .tip, .warning {
  border-left: 4px solid;
  border-radius: 0 8px 8px 0;
  padding: 14px 18px;
  margin: 20px 0;
  font-size: 14px;
}
.note {
  background: #fff8e1;
  border-color: #f39c12;
}
.note::before {
  content: '📌 Catatan: ';
  font-weight: 700;
  color: #e67e22;
}
.tip {
  background: #e8f5e9;
  border-color: #27ae60;
}
.tip::before {
  content: '💡 Tips: ';
  font-weight: 700;
  color: #27ae60;
}
.warning {
  background: #fdecea;
  border-color: #c0392b;
}
.warning::before {
  content: '⚠️ Perhatian: ';
  font-weight: 700;
  color: #c0392b;
}

/* ---- Tables ---- */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 24px;
  font-size: 14px;
}
th {
  background: var(--primary);
  color: white;
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
}
td {
  padding: 9px 14px;
  border-bottom: 1px solid #eee;
}
tr:nth-child(even) td { background: #f9f9f9; }
tr:hover td { background: #f0f0f0; }
td code { font-size: 12.5px; }

/* ---- Page Nav (Prev/Next) ---- */
.page-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  gap: 16px;
}
.page-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  flex: 1;
  max-width: 260px;
}
.page-nav a:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.page-nav a.next { justify-content: flex-end; margin-left: auto; }
.page-nav .nav-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  opacity: 0.7;
  display: block;
}
.page-nav .nav-title { font-size: 14px; }

/* ---- Breadcrumb ---- */
.breadcrumb {
  font-size: 13px;
  color: #888;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--primary); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { color: #ccc; }

/* ---- Inline Examples Grid ---- */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 16px 0;
}
@media (max-width: 700px) { .two-col { grid-template-columns: 1fr; } }

/* ---- Hero section for index ---- */
.hero {
  background: linear-gradient(135deg, #c0392b 0%, #1a1a2e 100%);
  color: white;
  padding: 40px;
  border-radius: 12px;
  margin-bottom: 32px;
}
.hero h1 { color: white; font-size: 36px; margin-bottom: 10px; }
.hero p { color: rgba(255,255,255,0.85); font-size: 17px; margin-bottom: 20px; }
.hero .badge {
  display: inline-block;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 20px;
  letter-spacing: 0.5px;
}
.hero-btns { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-btns a {
  display: inline-block;
  padding: 10px 24px;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  transition: all 0.2s;
}
.hero-btns .btn-white {
  background: white;
  color: var(--primary);
}
.hero-btns .btn-outline {
  background: transparent;
  color: white;
  border: 2px solid rgba(255,255,255,0.5);
}
.hero-btns a:hover { transform: translateY(-2px); opacity: 0.9; }

/* ---- Feature cards on index ---- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 24px 0;
}
@media (max-width: 700px) { .feature-grid { grid-template-columns: 1fr 1fr; } }
.feature-card {
  background: var(--example-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  transition: all 0.2s;
  display: block;
}
.feature-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(192,57,43,0.15);
}
.feature-card .icon { font-size: 32px; margin-bottom: 10px; }
.feature-card .title { font-weight: 600; font-size: 14px; color: var(--text); }
.feature-card .desc { font-size: 12px; color: #888; margin-top: 4px; }

/* ---- Mobile Menu ---- */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
  margin-right: 10px;
}
.hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: white;
  border-radius: 2px;
  transition: all 0.2s;
}

@media (max-width: 900px) {
  .hamburger { display: flex; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s;
  }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .content-wrapper { padding: 24px 20px 48px; }
  h1 { font-size: 26px; }
}

/* ---- Scrollbar ---- */
html { scroll-behavior: smooth; }
:target { scroll-margin-top: 80px; }

/* ---- Section badge ---- */
.section-badge {
  display: inline-block;
  background: var(--primary);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-left: 10px;
  vertical-align: middle;
}

/* ---- Footer ---- */
.content-footer {
  background: #f8f9fa;
  border-top: 1px solid #eee;
  padding: 16px 40px;
  margin-left: var(--sidebar-w);
  color: #888;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
@media (max-width: 900px) { .content-footer { margin-left: 0; } }
