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

:root {
  --bg: #f4f2fb;
  --surface: #ffffff;
  --surface-alt: #faf9ff;
  --border: #e7e3f7;
  --border-hover: #cabdf0;
  --text: #241c3d;
  --text-dim: #6f6790;
  --accent: #7c3aed;
  --accent-hover: #6d28d9;
  --accent-soft: #efe8fd;
  --accent-soft-text: #6d28d9;
  --error: #e11d48;
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --shadow: 0 8px 30px rgba(85, 50, 170, 0.08);
  --shadow-lg: 0 20px 60px rgba(85, 50, 170, 0.14);
  --shadow-hover: 0 12px 40px rgba(124, 58, 237, 0.18);
  --maxw: 1080px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, sans-serif;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

/* ---------- Top Navbar ---------- */

.topnav {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topnav-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
  font-size: 1.05rem;
  flex-shrink: 0;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-radius 0.2s ease;
}
.brand:hover .brand-mark { border-radius: 50%; }
.brand-mark svg { width: 17px; height: 17px; }

.topnav-links {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}

.topnav-link {
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-dim);
  background: none;
  border: none;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.topnav-link:hover { background: var(--surface-alt); color: var(--text); transform: translateY(-1px); }
.topnav-link.active { background: var(--accent-soft); color: var(--accent-soft-text); }

.chev { width: 14px; height: 14px; transition: transform 0.15s ease; }

.dropdown { position: relative; }
.dropdown:hover .chev { transform: rotate(180deg); }

.dropdown-panel {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  min-width: 460px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 18px;
  display: none;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.dropdown:hover .dropdown-panel { display: grid; }

.dropdown-col { display: flex; flex-direction: column; gap: 2px; }

.dropdown-heading {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 6px;
}

.dropdown-item {
  padding: 7px 8px;
  border-radius: 8px;
  font-size: 0.88rem;
  color: var(--text);
  transition: background 0.12s ease, color 0.12s ease, padding-left 0.12s ease;
}
.dropdown-item:hover { background: var(--accent-soft); color: var(--accent-soft-text); padding-left: 12px; }
.dropdown-item.active { color: var(--accent); font-weight: 600; }

.mobile-toggle {
  display: none;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.mobile-toggle svg { width: 18px; height: 18px; }

/* ---------- Mobile drawer ---------- */

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 280px;
  max-width: 85vw;
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  z-index: 60;
  transform: translateX(100%);
  transition: transform 0.2s ease;
  overflow-y: auto;
  padding: 8px 10px 24px;
}
.drawer.open { transform: translateX(0); }

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 10px 18px;
}

.drawer-close {
  width: 32px; height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: none;
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
}
.drawer-close svg { width: 16px; height: 16px; }

.drawer-heading {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  font-weight: 600;
  margin: 16px 10px 6px;
}

.drawer-link {
  display: block;
  padding: 10px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  color: var(--text);
  transition: background 0.12s ease, padding-left 0.12s ease;
}
.drawer-link:hover { background: var(--surface-alt); padding-left: 14px; }
.drawer-link.active { background: var(--accent-soft); color: var(--accent-soft-text); font-weight: 600; }

.drawer-scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(36, 28, 61, 0.35);
  z-index: 50;
}
.drawer-scrim.open { display: block; }

/* ---------- Hero (Dashboard) ---------- */

.hero {
  background: var(--accent);
  padding: 56px 24px 120px;
  text-align: center;
  color: #fff;
}

.hero-inner { max-width: 720px; margin: 0 auto; }

.hero h1 {
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  font-weight: 800;
  margin: 0 0 12px;
  letter-spacing: -0.02em;
}

.hero p {
  margin: 0 auto;
  color: rgba(255,255,255,0.85);
  font-size: 0.98rem;
  max-width: 480px;
  line-height: 1.5;
}

.hero-search {
  margin: 28px auto 0;
  max-width: 560px;
  background: #fff;
  border-radius: 999px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  padding: 6px 6px 6px 22px;
}

.hero-search input {
  flex: 1;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 0.95rem;
  padding: 10px 0;
  color: var(--text);
}
.hero-search input::placeholder { color: var(--text-dim); }

.hero-search button {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
}
.hero-search button svg { width: 17px; height: 17px; }

/* ---------- Floating panel ---------- */

.floating-panel {
  max-width: var(--maxw);
  margin: -80px auto 48px;
  padding: 0 24px;
}

.panel-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 28px;
}

.category-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
  scrollbar-width: none;
}
.category-tabs::-webkit-scrollbar { display: none; }

.category-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  flex-shrink: 0;
  min-width: 84px;
  transition: background 0.15s ease, transform 0.12s ease;
}
.category-tab:hover { background: var(--surface-alt); transform: translateY(-2px); }
.category-tab.active { background: var(--accent-soft); }

.category-tab svg { width: 22px; height: 22px; color: var(--accent); }
.category-tab span { font-size: 0.78rem; font-weight: 500; color: var(--text-dim); white-space: nowrap; }
.category-tab.active span { color: var(--accent-soft-text); font-weight: 600; }

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.tool-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  background: var(--surface-alt);
  transition: box-shadow 0.18s ease, transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.tool-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-3px);
  border-color: var(--accent);
  background: var(--surface);
}

.tool-card-icon {
  width: 38px; height: 38px;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
  transition: transform 0.15s ease, border-radius 0.15s ease;
}
.tool-card:hover .tool-card-icon { transform: scale(1.08); border-radius: 50%; }
.tool-card-icon svg { width: 19px; height: 19px; }

.tool-card h2 { font-size: 0.96rem; margin: 0 0 4px; font-weight: 600; }
.tool-card p { font-size: 0.78rem; color: var(--text-dim); margin: 0; line-height: 1.5; }

/* ---------- Tool page layout ---------- */

.main {
  max-width: 640px;
  margin: 0 auto;
  padding: 48px 24px 64px;
}

.page-head { margin-bottom: 24px; }

.page-head h1 {
  font-size: 1.5rem;
  font-weight: 800;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}

.sub { color: var(--text-dim); font-size: 0.92rem; margin: 0; }

.tool-panel {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 28px;
}

/* ---------- Upload widget ---------- */

.dropzone {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-alt);
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.dz-icon { width: 32px; height: 32px; color: var(--text-dim); margin-bottom: 10px; }
.dropzone.dragover .dz-icon, .dropzone:hover .dz-icon { color: var(--accent); }

.dz-text { margin: 0 0 4px; font-size: 0.95rem; }
.dz-link { color: var(--accent); font-weight: 600; }
.dz-hint { margin: 0; font-size: 0.78rem; color: var(--text-dim); }

.filerow {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-top: 12px;
  font-size: 0.85rem;
  background: var(--surface-alt);
}

.filename { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filesize { color: var(--text-dim); flex-shrink: 0; }

.clear-btn {
  background: none; border: none; color: var(--text-dim);
  font-size: 1.1rem; cursor: pointer; line-height: 1; padding: 2px 4px;
}
.clear-btn:hover { color: var(--error); }

.options { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; }

.opt { flex: 1; min-width: 140px; display: flex; flex-direction: column; gap: 6px; font-size: 0.8rem; color: var(--text-dim); }
.opt-wide { flex: 1 0 100%; }

.opt select, .opt input[type=text], .opt input[type=number], textarea.field, input.field {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.9rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.opt select:hover, .opt input:hover, textarea.field:hover, input.field:hover { border-color: var(--border-hover, #cabdf0); }
.opt select:focus, .opt input:focus, textarea.field:focus, input.field:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

textarea.field { width: 100%; resize: vertical; min-height: 140px; line-height: 1.5; }

.btn-primary {
  width: 100%;
  margin-top: 18px;
  padding: 13px;
  border-radius: 999px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.12s ease, box-shadow 0.15s ease;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.btn-primary:active:not(:disabled) { transform: translateY(0); }
.btn-primary:disabled { background: var(--border); color: var(--text-dim); cursor: not-allowed; }

.btn-secondary {
  padding: 10px 18px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, transform 0.12s ease;
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }

.progress-wrap { margin-top: 18px; }

.progress-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  overflow: hidden;
}
.progress-fill { height: 100%; width: 0%; background: var(--accent); transition: width 0.2s ease; }
.progress-text { margin: 8px 0 0; font-size: 0.8rem; color: var(--text-dim); text-align: center; }

.result {
  margin-top: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
  font-size: 0.9rem;
  background: var(--surface-alt);
}
.result.success { border-color: var(--accent); }
.result.error { border-color: var(--error); color: var(--error); }
.result a { display: inline-block; margin-top: 10px; color: var(--accent); font-weight: 600; }

/* ---------- Generic utility tool layout ---------- */

.field-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 14px; }
.field-col { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 0.8rem; color: var(--text-dim); font-weight: 500; }

.output-box {
  margin-top: 16px;
  background: var(--surface-alt);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-family: 'Menlo', 'Consolas', monospace;
  font-size: 0.85rem;
  word-break: break-all;
  white-space: pre-wrap;
  min-height: 44px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.output-box:hover { border-color: var(--accent); background: var(--surface); }

.copy-row { display: flex; justify-content: flex-end; margin-top: 8px; }

.pill-group { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.pill {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface-alt);
  font-size: 0.84rem;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}
.pill:hover { border-color: var(--accent); transform: translateY(-1px); }
.pill.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-soft-text); font-weight: 600; }

.swatch {
  width: 100%;
  height: 90px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin-top: 14px;
}

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
  .topnav-links { display: none; }
  .mobile-toggle { display: flex; }
  .dropdown-panel { display: none !important; }
}

@media (max-width: 600px) {
  .hero { padding: 44px 18px 100px; }
  .floating-panel { margin-top: -70px; padding: 0 14px; }
  .panel-card { padding: 18px; }
  .main { padding: 32px 16px 48px; }
  .tool-panel { padding: 18px; }
}
