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

:root {
  --bg: #ffffff;
  --bg-subtle: #f8fafc;
  --panel: #ffffff;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-placeholder: #94a3b8;
  
  --accent: #0f172a;
  --accent-blue: #3b82f6;
  --accent-cyan: #06b6d4;
  
  --line: rgba(0, 0, 0, 0.05);
  --line-strong: rgba(0, 0, 0, 0.1);
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-premium: 0 20px 40px -15px rgba(0, 0, 0, 0.15);

  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 12px;
  
  --container: 1240px;
}

* { box-sizing: border-box; -webkit-font-smoothing: antialiased; }
body { 
  margin: 0; 
  font-family: 'Inter', system-ui, sans-serif; 
  color: var(--text); 
  background: var(--bg); 
  line-height: 1.6;
}

h1, h2, h3, h4 { 
  font-family: 'Outfit', sans-serif; 
  font-weight: 800; 
  letter-spacing: -0.03em; 
  margin: 0; 
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; border: none; background: none; cursor: pointer; }

/* Layout */
.topbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}

.topbar-inner, .app-shell {
  width: min(var(--container), calc(100% - 40px));
  margin: 0 auto;
}

.topbar-inner { display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { 
  width: 42px; height: 42px; background: var(--accent); color: white; 
  border-radius: 12px; display: flex; align-items: center; justify-content: center;
  font-family: 'Outfit'; font-weight: 900; box-shadow: var(--shadow-md);
}

.nav { display: flex; gap: 4px; }
.nav-link { 
  padding: 8px 16px; border-radius: 999px; font-weight: 600; font-size: 0.9rem;
  color: var(--text-muted); transition: 0.2s;
}
.nav-link.active { color: var(--text); background: var(--bg-subtle); }

/* Components */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-xl); padding: 24px; }
.badge { font-size: 0.75rem; font-weight: 700; background: #f1f5f9; padding: 4px 10px; border-radius: 6px; color: #475569; }
.button { padding: 12px 24px; border-radius: 12px; font-weight: 700; transition: 0.2s; display: inline-flex; align-items: center; gap: 8px; }
.button.primary { background: var(--accent); color: white; }
.button.primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }

/* Device Cards */
.grid { display: grid; gap: 24px; }
.grid.devices { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.card { 
  background: white; border-radius: var(--radius-lg); border: 1px solid var(--line); 
  overflow: hidden; transition: 0.3s; cursor: pointer;
}
.card:hover { transform: translateY(-6px); box-shadow: var(--shadow-premium); border-color: var(--line-strong); }
.device-card-cover { aspect-ratio: 16/10; background-size: cover; background-position: center; background-color: #f3f4f6; }
.device-card-body { padding: 20px; }
.device-title { font-size: 1.25rem; margin-bottom: 4px; }
.device-brand { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); margin-bottom: 12px; }
.device-desc { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 16px; }
.device-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.meta-pill { font-size: 0.7rem; font-weight: 600; padding: 4px 8px; background: #f1f5f9; border-radius: 4px; color: #64748b; }

/* Device Page Tabs */
.device-intro { margin-bottom: 24px; padding: 40px; }
.device-page-title { font-size: 3rem; margin: 12px 0; }
.tabs { display: flex; gap: 8px; margin-bottom: 24px; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.tab-btn { padding: 12px 24px; font-weight: 700; color: var(--text-muted); position: relative; }
.tab-btn.active { color: var(--text); }
.tab-btn.active::after { content: ""; position: absolute; bottom: -13px; left: 0; right: 0; height: 3px; background: var(--accent); border-radius: 3px; }

/* Explorer Layout */
.explorer-layout { display: grid; grid-template-columns: 1fr 340px; gap: 24px; height: 640px; }
.viewer-shell { background: #f8fafc; border-radius: var(--radius-lg); overflow: hidden; position: relative; border: 1px solid var(--line); }
.viewer-stage { width: 100%; height: 100%; position: relative; }
.viewer-canvas { width: 100%; height: 100%; }
.viewer-topbar { position: absolute; top: 16px; left: 16px; right: 16px; display: flex; justify-content: space-between; z-index: 10; pointer-events: none; }
.viewer-topbar > * { pointer-events: auto; }

.viewer-mode { display: flex; background: white; padding: 4px; border-radius: 12px; box-shadow: var(--shadow-md); border: 1px solid var(--line); }
.mode-chip { padding: 6px 14px; border-radius: 8px; font-size: 0.8rem; font-weight: 700; transition: 0.2s; }
.mode-chip.active { background: var(--accent); color: white; }
.explorer-fullscreen-btn { background: white; border: 1px solid var(--line); border-radius: 12px; padding: 8px 16px; font-size: 0.8rem; font-weight: 700; box-shadow: var(--shadow-md); display: flex; align-items: center; gap: 8px; }

.viewer-overlay { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 5; pointer-events: none; }
.overlay-hint { background: rgba(15, 23, 42, 0.8); color: white; padding: 8px 16px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; backdrop-filter: blur(8px); }

.explorer-sidebar { overflow-y: auto; padding: 32px; display: flex; flex-direction: column; }
.empty-state { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--text-muted); }
.empty-state .icon { font-size: 3rem; margin-bottom: 20px; opacity: 0.5; }

.part-details .part-title { font-size: 1.75rem; margin: 12px 0; }
.part-desc { font-size: 1rem; color: var(--text-muted); margin-bottom: 24px; }
.detail-block { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--line); }
.block-title { font-size: 0.8rem; font-weight: 800; text-transform: uppercase; color: var(--text-muted); margin-bottom: 12px; letter-spacing: 0.05em; }

/* Fullscreen Mode */
.fullscreen-mode {
  position: fixed !important;
  inset: 0 !important;
  z-index: 3000;
  width: 100vw !important;
  height: 100vh !important;
  margin: 0 !important;
  border-radius: 0 !important;
}

/* Article & Manuals */
.article-layout { display: grid; gap: 24px; grid-template-columns: 1fr 1fr; }
.article-card { padding: 40px; }
.step-guide { display: grid; gap: 20px; margin-top: 24px; }
.step-item { display: flex; gap: 16px; align-items: flex-start; }
.step-number { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: white; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.8rem; flex-shrink: 0; }

.manuals-layout { display: grid; grid-template-columns: 320px 1fr; gap: 24px; height: 700px; }
.manuals-list { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; }
.manual-item { 
  display: flex; align-items: center; gap: 12px; padding: 16px; border-radius: 12px; 
  text-align: left; transition: 0.2s; border: 1px solid transparent;
}
.manual-item:hover { background: var(--bg-subtle); border-color: var(--line); }
.manual-item .icon { font-size: 1.5rem; }
.manual-info .name { display: block; font-weight: 700; font-size: 0.95rem; }
.manual-info .meta { font-size: 0.75rem; color: var(--text-muted); }

.manual-preview { background: #f8fafc; border: 1px solid var(--line); padding: 0; overflow: hidden; }
.pdf-frame { width: 100%; height: 100%; border: none; }

/* Animations */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-fadeup { animation: fadeUp 0.4s cubic-bezier(0.4, 0, 0.2, 1); }

@media (max-width: 900px) {
  .explorer-layout, .article-layout, .manuals-layout { grid-template-columns: 1fr; height: auto; }
}