/* ═══════════════════════════════════════════════
   iBEN Robot Documentation — Clean Design System
   ═══════════════════════════════════════════════ */

/* ── Reset & Variables ─────────────────────── */
:root {
  --primary: #d95c4a;
  --primary-light: #fef0ed;
  --primary-dark: #b5412f;
  --accent: #e8943a;
  --accent-light: #fef5eb;
  --dark: #2e1a1a;
  --text: #2d3748;
  --text-light: #718096;
  --bg: #fdf5f3;
  --white: #fffaf8;
  --border: #e8d8d4;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06);
  --shadow-md: 0 4px 12px rgba(0,0,0,.08);
  --shadow-lg: 0 8px 30px rgba(0,0,0,.12);
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar-w: 280px;
  --header-h: 64px;
  --transition: .25s cubic-bezier(.4,0,.2,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* ── Typography ────────────────────────────── */
h1, h2, h3, h4 { color: var(--dark); line-height: 1.3; font-weight: 700; }
h1 { font-size: 2rem; margin-bottom: 1rem; }
h2 { font-size: 1.5rem; margin: 2.5rem 0 1rem; padding-bottom: .5rem; border-bottom: 2px solid var(--border); }
h3 { font-size: 1.15rem; margin: 2rem 0 .75rem; color: var(--primary-dark); }
h4 { font-size: 1rem; margin: 1.5rem 0 .5rem; }
p { margin-bottom: 1rem; }
a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }
ul, ol { margin: 0 0 1rem 1.5rem; }
li { margin-bottom: .35rem; }
strong { color: var(--dark); }
code {
  background: var(--primary-light);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: .9em;
  color: var(--primary-dark);
}

/* ── Header ────────────────────────────────── */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 2rem;
  z-index: 100;
  backdrop-filter: blur(12px);
  background: rgba(255,255,255,.92);
}
.header__logo {
  display: flex;
  align-items: center;
  gap: .75rem;
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--dark);
  text-decoration: none;
}
.header__logo-icon {
  width: 36px; height: 36px;
  background: var(--primary);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 900;
  font-size: .85rem;
}
.header__nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.header__nav a {
  padding: .5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-light);
  transition: all var(--transition);
}
.header__nav a:hover, .header__nav a.active {
  color: var(--primary);
  background: var(--primary-light);
}
.header__search {
  position: relative;
  margin-left: 1rem;
}
.header__search input {
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: .45rem 1rem .45rem 2.5rem;
  font-size: .875rem;
  width: 220px;
  background: var(--bg);
  transition: all var(--transition);
  outline: none;
}
.header__search input:focus {
  border-color: var(--primary);
  width: 280px;
  box-shadow: 0 0 0 3px rgba(0,87,255,.1);
}
.header__search svg {
  position: absolute;
  left: .8rem; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--text-light);
}
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: .5rem;
  margin-right: .5rem;
}
.menu-toggle span {
  display: block;
  width: 22px; height: 2px;
  background: var(--dark);
  margin: 5px 0;
  transition: all var(--transition);
  border-radius: 2px;
}

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

/* ── Sidebar ───────────────────────────────── */
.sidebar {
  position: fixed;
  top: var(--header-h);
  left: 0;
  width: var(--sidebar-w);
  height: calc(100vh - var(--header-h));
  background: var(--white);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 1.5rem 0;
  z-index: 50;
  transition: transform var(--transition);
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
.sidebar__section {
  padding: 0 1.25rem;
  margin-bottom: 1.5rem;
}
.sidebar__title {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-light);
  font-weight: 600;
  margin-bottom: .5rem;
  padding: 0 .75rem;
}
.sidebar__link {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .55rem .75rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  color: var(--text);
  font-weight: 500;
  transition: all var(--transition);
  text-decoration: none;
}
.sidebar__link:hover {
  background: var(--primary-light);
  color: var(--primary);
}
.sidebar__link.active {
  background: var(--primary);
  color: var(--white);
}
.sidebar__link svg {
  width: 18px; height: 18px;
  flex-shrink: 0;
}
.sidebar__sublinks {
  list-style: none;
  padding: 0;
  margin: 0 0 0 2.4rem;
}
.sidebar__sublinks a {
  display: block;
  padding: .35rem .75rem;
  border-left: 2px solid var(--border);
  font-size: .82rem;
  color: var(--text-light);
  transition: all var(--transition);
  text-decoration: none;
}
.sidebar__sublinks a:hover, .sidebar__sublinks a.active {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

/* ── Main Content ──────────────────────────── */
.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 2.5rem 3rem;
  max-width: 900px;
}
.main > *:first-child { margin-top: 0; }

/* ── Breadcrumb ────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .82rem;
  color: var(--text-light);
  margin-bottom: 1.5rem;
}
.breadcrumb a { color: var(--text-light); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb span { color: var(--text-light); }

/* ── Cards ─────────────────────────────────── */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
  margin: 1.5rem 0;
}
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: all var(--transition);
  text-decoration: none;
  color: var(--text);
  display: flex;
  flex-direction: column;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}
.card__icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  font-size: 1.5rem;
}
.card__icon--blue { background: var(--primary-light); color: var(--primary); }
.card__icon--green { background: var(--accent-light); color: var(--accent); }
.card__icon--purple { background: #f3e8ff; color: #7c3aed; }
.card__icon--orange { background: #fff7ed; color: #ea580c; }
.card__icon--red { background: #fef2f2; color: #dc2626; }
.card__icon--teal { background: #f0fdfa; color: #0d9488; }
.card__title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--dark);
  margin-bottom: .4rem;
}
.card__desc {
  font-size: .85rem;
  color: var(--text-light);
  line-height: 1.5;
  flex: 1;
}
.card__arrow {
  color: var(--primary);
  font-size: .85rem;
  margin-top: .75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: .3rem;
}

/* ── Alert / Callout Boxes ─────────────────── */
.callout {
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
  display: flex;
  gap: .75rem;
  font-size: .9rem;
  line-height: 1.6;
}
.callout--warning {
  background: #fffbeb;
  border-left: 4px solid #f59e0b;
}
.callout--danger {
  background: #fef2f2;
  border-left: 4px solid #dc2626;
}
.callout--info {
  background: var(--primary-light);
  border-left: 4px solid var(--primary);
}
.callout--success {
  background: var(--accent-light);
  border-left: 4px solid var(--accent);
}
.callout__icon {
  font-size: 1.2rem;
  flex-shrink: 0;
  line-height: 1.6;
}
.callout p { margin: 0; }
.callout strong { display: block; margin-bottom: .25rem; }

/* ── Tables ────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  margin: 1.25rem 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
thead {
  background: var(--bg);
}
th {
  padding: .75rem 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--dark);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
td {
  padding: .65rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
tr:last-child td { border-bottom: none; }
tr:hover { background: rgba(0,87,255,.02); }

/* ── Step Lists ────────────────────────────── */
.steps {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0;
  counter-reset: step;
}
.steps li {
  counter-increment: step;
  display: flex;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}
.steps li:last-child { border-bottom: none; }
.steps li::before {
  content: counter(step);
  width: 32px; height: 32px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .85rem;
  flex-shrink: 0;
  margin-top: .1rem;
}
.steps li div { flex: 1; }
.steps li strong { display: block; margin-bottom: .25rem; color: var(--dark); }

/* ── Badge / Tag ───────────────────────────── */
.badge {
  display: inline-block;
  padding: .2rem .6rem;
  border-radius: 100px;
  font-size: .75rem;
  font-weight: 600;
}
.badge--blue { background: var(--primary-light); color: var(--primary); }
.badge--green { background: #ecfdf5; color: #059669; }
.badge--orange { background: var(--accent-light); color: var(--accent); }
.badge--red { background: #fef2f2; color: #dc2626; }

/* ── Hero Section ──────────────────────────── */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, #e8943a 100%);
  color: white;
  border-radius: var(--radius);
  padding: 3rem;
  margin-bottom: 2rem;
  position: relative;
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  top: -50%; right: -20%;
  width: 500px; height: 500px;
  background: rgba(255,255,255,.05);
  border-radius: 50%;
}
.hero h1 { color: white; font-size: 2.2rem; margin-bottom: .5rem; }
.hero p { color: rgba(255,255,255,.85); font-size: 1.05rem; margin: 0; max-width: 600px; }

/* ── Status Indicators ─────────────────────── */
.status {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .82rem;
  font-weight: 600;
}
.status::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
}
.status--online::before { background: var(--accent); }
.status--offline::before { background: #dc2626; }
.status--idle::before { background: #f59e0b; }

/* ── Specs Grid ────────────────────────────── */
.specs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}
.spec {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  text-align: center;
}
.spec__value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--primary);
  margin-bottom: .25rem;
}
.spec__label {
  font-size: .8rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* ── Checklist ─────────────────────────────── */
.checklist {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
}
.checklist li {
  padding: .5rem 0;
  padding-left: 1.75rem;
  position: relative;
  border-bottom: 1px solid var(--border);
}
.checklist li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 700;
}

/* ── Timeline ──────────────────────────────── */
.timeline {
  position: relative;
  padding-left: 2rem;
  margin: 1.5rem 0;
}
.timeline::before {
  content: '';
  position: absolute;
  left: .5rem;
  top: 0; bottom: 0;
  width: 2px;
  background: var(--border);
}
.timeline__item {
  position: relative;
  padding-bottom: 1.5rem;
}
.timeline__item::before {
  content: '';
  position: absolute;
  left: -1.65rem;
  top: .4rem;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid white;
  box-shadow: var(--shadow-sm);
}
.timeline__item strong { display: block; color: var(--dark); }
.timeline__item p { margin: .25rem 0 0; font-size: .9rem; color: var(--text-light); }

/* ── Footer ────────────────────────────────── */
.footer {
  margin-left: var(--sidebar-w);
  padding: 2rem 3rem;
  border-top: 1px solid var(--border);
  background: var(--white);
  font-size: .82rem;
  color: var(--text-light);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.footer a { color: var(--primary); }

/* ── Search Results Overlay ────────────────── */
.search-results {
  display: none;
  position: fixed;
  top: var(--header-h);
  left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.4);
  z-index: 200;
  backdrop-filter: blur(4px);
}
.search-results.active { display: flex; justify-content: center; padding-top: 2rem; }
.search-results__panel {
  background: var(--white);
  border-radius: var(--radius);
  width: 600px;
  max-height: 70vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  padding: 1.5rem;
}
.search-results__item {
  padding: .75rem;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.search-results__item:hover { background: var(--primary-light); }
.search-results__item a {
  text-decoration: none;
  display: block;
}
.search-results__item strong { color: var(--dark); font-size: .95rem; }
.search-results__item p { color: var(--text-light); font-size: .82rem; margin: .2rem 0 0; }
.search-results__item mark { background: #ffe066; color: var(--dark); border-radius: 2px; padding: 0 2px; }
.search-results__badge {
  display: inline-block; font-size: .7rem; font-weight: 600; color: var(--primary);
  background: var(--primary-light); padding: 2px 8px; border-radius: 99px; margin-bottom: 4px;
}

/* ── Print ─────────────────────────────────── */
@media print {
  .header, .sidebar, .footer, .header__search { display: none !important; }
  .main { margin-left: 0; padding: 1rem; max-width: 100%; }
  .hero { background: #eee !important; color: #333 !important; }
  .hero h1, .hero p { color: #333 !important; }
  .card { break-inside: avoid; border: 1px solid #ccc; }
}

/* ── Responsive ────────────────────────────── */
@media (max-width: 1024px) {
  .main { padding: 2rem; }
}
@media (max-width: 768px) {
  .menu-toggle { display: block; }
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .main { margin-left: 0; padding: 1.5rem; }
  .footer { margin-left: 0; padding: 1.5rem; flex-direction: column; gap: .5rem; }
  .header__nav { display: none; }
  .header__search { margin-left: auto; }
  .header__search input { width: 160px; }
  .hero { padding: 2rem; }
  .hero h1 { font-size: 1.6rem; }
  .cards { grid-template-columns: 1fr; }
}
