/* 
  ExtractKit Web Version CSS
  Theme: Light, Clean, Professional, Minimalist
*/

:root {
  --bg-body: #F9FAFB;
  --surface: #FFFFFF;
  --surface-hover: #F3F4F6;
  
  --text: #111827;
  --text-muted: #4B5563;
  --text-lighter: #9CA3AF;
  
  --primary: #2563EB;
  --primary-hover: #1D4ED8;
  --primary-light: #EFF6FF;
  
  --border: #E5E7EB;
  --border-focus: #93C5FD;
  
  --success: #10B981;
  --error: #EF4444;
  --warning: #F59E0B;

  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
  
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --header-height: 64px;
}

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

body {
  font-family: 'Inter', system-ui, sans-serif;
  background-color: var(--bg-body);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── NAVBAR ── */
.navbar {
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-height);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 32px;
  height: 32px;
}

.brand-name {
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.5px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  transition: var(--transition);
}

.nav-link:hover, .nav-link.active {
  color: var(--primary);
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  text-decoration: none;
  font-family: inherit;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn.primary {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.btn.primary:hover:not(:disabled) {
  background: var(--primary-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.btn.secondary {
  background: var(--primary-light);
  color: var(--primary);
}

.btn.secondary:hover {
  background: #DBEAFE;
}

.btn.outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn.outline:hover {
  border-color: var(--text-lighter);
  background: var(--surface-hover);
}

.btn.text {
  background: transparent;
  color: var(--text-muted);
  padding: 8px 12px;
}

.btn.text:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
}

.icon-btn:hover {
  background: var(--surface-hover);
  color: var(--text);
}

/* ── MAIN APP & HERO ── */
.app-container {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.view-section {
  flex: 1;
  display: none;
  flex-direction: column;
}

.view-section.active {
  display: flex;
}

/* Hero Section */
.hero {
  max-width: 800px;
  margin: 80px auto 40px;
  text-align: center;
  padding: 0 24px;
}

.hero-badge {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary);
  padding: 6px 16px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 24px;
}

.hero-title {
  font-size: 48px;
  font-weight: 700;
  letter-spacing: -1px;
  margin-bottom: 16px;
  color: var(--text);
}

.hero-subtitle {
  font-size: 18px;
  color: var(--text-muted);
  margin-bottom: 40px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* Search Box */
.search-box {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 8px;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
  max-width: 650px;
  margin: 0 auto;
}

.search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-light);
}

.search-icon {
  color: var(--text-lighter);
  margin: 0 12px;
}

.search-box input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 16px;
  color: var(--text);
  font-family: inherit;
}

.search-box input::placeholder {
  color: var(--text-lighter);
}

/* Download State */
.download-state {
  max-width: 650px;
  margin: 0 auto;
  width: 100%;
  padding: 0 24px;
}

.status-bar {
  margin-top: 24px;
}

.progress-track {
  height: 6px;
  background: var(--border);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  width: 0%;
  transition: width 0.3s ease, background-color 0.3s ease;
}

.status-text {
  font-size: 13px;
  color: var(--text-muted);
  text-align: center;
}

/* Result Card */
.result-card {
  margin-top: 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-header {
  margin-bottom: 24px;
}

.result-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
}

.result-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 16px;
  background: var(--bg-body);
  padding: 16px;
  border-radius: var(--radius-md);
}

.info-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.info-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-lighter);
  font-weight: 600;
}

.info-value {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  word-break: break-all;
}

.result-actions {
  display: flex;
  gap: 12px;
}

/* ── VIEWER SECTION ── */
.viewer-header {
  height: 56px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 16px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  font-size: 13px;
  color: var(--text-muted);
}

.breadcrumb-separator {
  margin: 0 8px;
  color: var(--text-lighter);
}

.breadcrumb-segment.active {
  color: var(--text);
  font-weight: 500;
}

.viewer-layout {
  flex: 1;
  display: flex;
  overflow: hidden;
  height: calc(100vh - var(--header-height) - 56px);
}

/* Sidebar Tree */
.file-tree {
  width: 260px;
  background: var(--bg-body);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 8px 0;
}

/* Resizable divider */
.viewer-divider {
  width: 4px;
  background: var(--border);
  cursor: col-resize;
  transition: background 0.2s;
}

.viewer-divider:hover, .viewer-divider.dragging {
  background: var(--primary);
}

/* Tree Items */
.tree-item {
  display: flex;
  align-items: center;
  padding: 6px 12px;
  cursor: pointer;
  user-select: none;
  color: var(--text-muted);
  font-size: 13px;
  transition: var(--transition);
}

.tree-item:hover {
  background: var(--border);
}

.tree-item.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 500;
}

.tree-item-icon {
  margin-right: 8px;
  font-size: 14px;
}

.tree-item-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tree-folder-group {
  display: block;
}

.tree-folder-group.collapsed {
  display: none;
}

/* Code Area */
.code-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  overflow: hidden;
}

.code-toolbar {
  height: 48px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--surface);
}

.toolbar-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.code-scroll-container {
  flex: 1;
  overflow: auto;
  position: relative;
}

.code-content {
  padding: 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  line-height: 1.5;
  tab-size: 2;
  color: var(--text);
}

.empty-state {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: var(--text-lighter);
}

.empty-state svg {
  margin-bottom: 16px;
}

/* ── SYNTAX HIGHLIGHTING (Light Mode) ── */
.sh-keyword { color: #D73A49; font-weight: 500; }
.sh-string { color: #032F62; }
.sh-number { color: #005CC5; }
.sh-comment { color: #6A737D; font-style: italic; }
.sh-function { color: #6F42C1; font-weight: 500; }
.sh-property { color: #24292E; }
.sh-operator { color: #D73A49; }
.sh-boolean { color: #005CC5; font-weight: 500; }

.sh-tag { color: #22863A; }
.sh-attr { color: #6F42C1; }
.sh-attr-val { color: #032F62; }

/* ── BINARY NOTICES & IMAGES ── */
.binary-notice {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 300px;
  color: var(--text-muted);
}
.binary-notice p { margin-top: 16px; font-weight: 500; }

.image-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px;
  background: var(--bg-body);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  margin: 24px;
}

.image-preview img {
  max-width: 100%;
  max-height: 60vh;
  box-shadow: var(--shadow-sm);
  background: repeating-conic-gradient(#f3f4f6 0% 25%, #ffffff 0% 50%) 50% / 20px 20px;
}

.image-preview-info {
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

/* ── TOASTS ── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 9999;
}

.toast {
  background: var(--surface);
  color: var(--text);
  padding: 12px 20px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  font-weight: 500;
  border-left: 4px solid var(--text);
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--error); }
.toast.warning { border-color: var(--warning); }
.toast.info { border-color: var(--primary); }

@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.toast-exit {
  animation: toastOut 0.3s forwards;
}

@keyframes toastOut {
  to { transform: translateX(100%); opacity: 0; }
}
