/* ============================
   JPGTools — Main Stylesheet
   ============================ */

:root {
  --primary: #FF6B35;
  --primary-dark: #e55a26;
  --bg: #f8f9fc;
  --bg-white: #ffffff;
  --text: #1a1a2e;
  --text-muted: #6c757d;
  --border: #e2e8f0;
  --radius: 12px;
  --radius-lg: 20px;
  --shadow: 0 2px 12px rgba(0,0,0,.08);
  --shadow-md: 0 4px 24px rgba(0,0,0,.12);
  --shadow-lg: 0 8px 40px rgba(0,0,0,.16);
  --transition: .2s ease;
}

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

html { overflow-x: clip; }

[hidden] { display: none !important; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans Thai', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }

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

img { max-width: 100%; height: auto; display: block; }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ============================
   HEADER
   ============================ */

.header {
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.header .container {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 60px;
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.15rem;
  font-weight: 800;
  white-space: nowrap;
  flex-shrink: 0;
  color: var(--text);
  margin-right: 8px;
}

.logo-img {
  width: 30px;
  height: 30px;
  border-radius: 8px;
}

/* Nav */
.nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  overflow: visible;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
  color: var(--text-muted);
  transition: background .15s, color .15s;
  border: none;
  background: none;
  cursor: pointer;
  text-decoration: none;
}

.nav-icon {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  flex-shrink: 0;
}

.nav-link:hover { background: var(--bg); color: var(--text); }
.nav-link.active { background: #fff3ee; color: var(--primary); font-weight: 600; }

/* PDF Dropdown */
.nav-dropdown { position: relative; }

.nav-dropdown-btn {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-icon-pdf {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.dropdown-chevron {
  width: 10px;
  height: 6px;
  flex-shrink: 0;
  transition: transform .2s;
}

.nav-dropdown.open .dropdown-chevron { transform: rotate(180deg); }

.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: white;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,.12);
  min-width: 200px;
  padding: 8px;
  z-index: 200;
}

.nav-dropdown.open .dropdown-menu { display: flex; flex-direction: column; }

/* Mega menu */
.mega-menu {
  min-width: 560px;
  padding: 20px;
  flex-direction: row !important;
  gap: 8px;
  right: 0;
}

.mega-col {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 160px;
  padding: 0 8px;
  border-right: 1px solid var(--border);
}

.mega-col:last-child { border-right: none; }

.mega-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--text-muted);
  margin-bottom: 10px;
  padding: 0 4px;
}

.mega-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text);
  transition: background .15s;
}

.mega-item:hover { background: var(--bg); }

.mega-item.active { background: #f0f9ff; }

.mega-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  flex-shrink: 0;
}

.mega-item-name {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.2;
}

/* Language switcher */
.lang-switcher .dropdown-menu {
  min-width: 150px;
  padding: 8px;
  right: 0;
  left: auto;
}
.lang-menu { flex-direction: column; gap: 2px; }
.lang-menu .dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  transition: background .15s;
  white-space: nowrap;
}
.lang-menu .dropdown-item:hover { background: var(--bg); }
.lang-menu .dropdown-item.active { color: var(--primary); background: #fff3ee; }
.lang-flag { font-size: 1.1rem; }
.lang-btn { gap: 6px; }

/* old dropdown-item (fallback) */
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  transition: background .15s;
}

.dropdown-item:hover { background: var(--bg); }
.dropdown-item.active { color: var(--primary); background: #fff3ee; }

.dropdown-icon {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  flex-shrink: 0;
}

/* Hamburger */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  margin-left: auto;
  flex-shrink: 0;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform .2s, opacity .2s;
}

/* ============================
   HERO
   ============================ */

.hero {
  background: linear-gradient(135deg, #FF6B35 0%, #f7931e 50%, #FFD700 100%);
  padding: 72px 0;
  text-align: center;
  color: white;
}

.hero-title {
  font-size: clamp(1.8rem, 5vw, 3.2rem);
  font-weight: 900;
  line-height: 1.2;
  margin-bottom: 16px;
  text-shadow: 0 2px 8px rgba(0,0,0,.15);
}

.hero-accent { opacity: 0.92; }

.hero-sub {
  font-size: 1.05rem;
  opacity: 0.88;
  max-width: 500px;
  margin: 0 auto;
  line-height: 1.8;
}

/* ============================
   TOOLS GRID
   ============================ */

.tools-section { padding: 48px 0 72px; }

/* ── Category Tabs ── */
.cat-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 32px;
}

.cat-tab {
  padding: 9px 22px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--bg-white);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .18s;
  font-family: inherit;
}

.cat-tab:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.cat-tab.active {
  background: #1a1a2e;
  border-color: #1a1a2e;
  color: #fff;
  font-weight: 600;
}

.tools-group { margin-bottom: 48px; }

.tools-group-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
  margin-bottom: 16px;
  padding-left: 2px;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.tool-card {
  background: var(--bg-white);
  border-radius: 16px;
  padding: 24px 22px 20px;
  border: 1.5px solid var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,.05);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-decoration: none;
}

.tool-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(0,0,0,.10);
  border-color: var(--card-color, var(--primary));
}

.tool-card-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  overflow: hidden;
  flex-shrink: 0;
}

.tool-card-icon img {
  width: 100%;
  height: 100%;
  display: block;
}

.tool-card-body { flex: 1; }

.tool-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 5px;
  line-height: 1.3;
}

.tool-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.tool-card-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.tool-card-arrow {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  color: var(--card-color, var(--primary));
  transition: background .2s, transform .2s;
}

.tool-card:hover .tool-card-arrow {
  background: var(--card-color, var(--primary));
  color: white;
  transform: translateX(2px);
}

/* ============================
   FEATURES
   ============================ */

.tools-heading {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 auto 16px;
  text-align: center;
  width: 100%;
  display: block;
}

/* ============================
   SEO LINKS SECTION
   ============================ */

.seo-links {
  padding: 56px 0;
  border-top: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 0;
}

.seo-links .container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.seo-links-card {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-left: 4px solid var(--grp-color, #ccc);
  border-radius: 12px;
  padding: 20px 24px;
  transition: box-shadow .2s;
}

.seo-links-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,.07);
}

.seo-links-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.seo-links-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.seo-links-heading {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.seo-links-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.seo-link {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--grp-color, var(--text-secondary));
  background: color-mix(in srgb, var(--grp-color, #888) 8%, white);
  border: 1px solid color-mix(in srgb, var(--grp-color, #888) 25%, white);
  text-decoration: none;
  transition: background .15s, color .15s, border-color .15s, transform .1s;
}

.seo-link:hover {
  background: var(--grp-color, var(--primary));
  color: #fff;
  border-color: var(--grp-color, var(--primary));
  transform: translateY(-1px);
}

/* ============================
   FEATURES
   ============================ */

.features-section {
  background: var(--bg-white);
  padding: 64px 0;
  border-top: 1px solid var(--border);
}

.features-heading {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  margin-bottom: 40px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 32px;
  text-align: center;
}

.feature-icon {
  font-size: 2.4rem;
  margin-bottom: 12px;
}

.feature h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.feature p {
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* ============================
   TOOL HERO
   ============================ */

.tool-hero {
  background: linear-gradient(135deg, var(--tool-color, #FF6B35), color-mix(in srgb, var(--tool-color, #FF6B35) 60%, #000));
  padding: 40px 0;
  color: white;
}

.tool-hero-inner {
  display: flex;
  align-items: center;
  gap: 20px;
}

.tool-hero-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  flex-shrink: 0;
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
}

.tool-hero-title {
  font-size: clamp(1.4rem, 4vw, 2.2rem);
  font-weight: 800;
  margin-bottom: 6px;
}

.tool-hero-desc {
  opacity: 0.88;
  font-size: 1rem;
}

/* ============================
   WORKSPACE
   ============================ */

/* ── Internal Links Bar ── */
.tool-internal-links {
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
}

.til-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.til-link {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 4px 10px 4px 6px;
  border-radius: 20px;
  border: 1px solid var(--border);
  transition: var(--transition);
  background: var(--bg-white);
}

.til-icon {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  flex-shrink: 0;
  object-fit: contain;
}

.til-link:hover {
  color: var(--card-color, var(--primary));
  border-color: var(--card-color, var(--primary));
  background: color-mix(in srgb, var(--card-color, var(--primary)) 6%, white);
  transform: translateY(-1px);
}

.tool-workspace { padding: 48px 0; }

.workspace-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 32px;
  align-items: start;
}

/* ============================
   GROUP TABS (size variants strip)
   ============================ */

.group-tabs-wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.group-tabs-wrap.secondary {
  margin-bottom: 24px;
}

.group-tabs-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.group-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.group-tab {
  display: inline-flex;
  align-items: center;
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  text-decoration: none;
  transition: background .15s, color .15s, border-color .15s;
  white-space: nowrap;
}

.group-tab:hover {
  background: var(--hover);
  color: var(--text);
  border-color: var(--tool-color, #FF6B35);
}

.group-tab.active {
  background: var(--tool-color, #FF6B35);
  border-color: var(--tool-color, #FF6B35);
  color: #fff;
  font-weight: 600;
}

/* ============================
   DROP ZONE
   ============================ */

.upload-panel { position: relative; z-index: 1; }

.options-panel { position: relative; z-index: 2; }

.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-white);
  min-height: 320px;
  transition: border-color .2s, background .2s;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.drop-zone.drag-over {
  border-color: var(--primary);
  background: #fff5f2;
}

.drop-zone-content {
  text-align: center;
  padding: 48px 32px;
}

.drop-icon { font-size: 4rem; margin-bottom: 16px; }

.drop-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.drop-sub {
  color: var(--text-muted);
  margin-bottom: 20px;
}

.drop-hint {
  margin-top: 16px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Preview */
.preview-wrap {
  width: 100%;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.preview-wrap img {
  max-height: 400px;
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  object-fit: contain;
}

.preview-info {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}

.wm-canvas {
  max-width: 100%;
  border-radius: 8px;
  box-shadow: 0 4px 24px rgba(0,0,0,.12);
  display: block;
}

/* ============================
   OPTIONS PANEL
   ============================ */

.options-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.options-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 24px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.field-group {
  margin-bottom: 20px;
}

.field-group:last-child { margin-bottom: 0; }

.field-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

.field-unit {
  font-weight: 400;
  color: var(--text-muted);
}

/* Range */
.range-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.range-input {
  flex: 1;
  height: 6px;
  border-radius: 3px;
  outline: none;
  cursor: pointer;
  accent-color: var(--primary);
}

.range-value {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--primary);
  min-width: 52px;
  text-align: right;
}

/* Select */
.select-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  background: var(--bg-white);
  color: var(--text);
  cursor: pointer;
  outline: none;
  transition: border-color .2s;
}

.select-input:focus { border-color: var(--primary); }

/* Number / Text */
.text-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--text);
  outline: none;
  transition: border-color .2s;
}

.text-input:focus { border-color: var(--primary); }

/* Checkbox */
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.9rem;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* ============================
   BUTTONS
   ============================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: transform .15s, box-shadow .15s, opacity .15s;
  text-decoration: none;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 16px rgba(255,107,53,.3);
}

.btn-primary:hover { box-shadow: 0 6px 20px rgba(255,107,53,.4); }

.btn-process {
  width: 100%;
  padding: 16px;
  font-size: 1.05rem;
  background: var(--tool-color, var(--primary));
  color: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,.15);
}

.btn-process:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn-download {
  background: #27AE60;
  color: white;
  padding: 14px 32px;
  font-size: 1rem;
  box-shadow: 0 4px 16px rgba(39,174,96,.3);
}

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

.btn-ghost:hover { background: var(--bg); }

.btn-sm { padding: 6px 14px; font-size: 0.82rem; }

.btn-icon { font-size: 1.2rem; }


/* ============================
   PROGRESS
   ============================ */

.progress-wrap {
  background: var(--bg-white);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-top: 16px;
}

.progress-bar {
  background: var(--border);
  border-radius: 4px;
  height: 8px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #f7931e);
  border-radius: 4px;
  width: 0%;
  transition: width .4s ease;
  animation: progressAnim 1.5s infinite ease-in-out;
}

@keyframes progressAnim {
  0% { width: 20%; }
  50% { width: 80%; }
  100% { width: 95%; }
}

.progress-text {
  font-size: 0.9rem;
  color: var(--text-muted);
  text-align: center;
}

/* ============================
   ERROR & RESULT
   ============================ */

.error-box {
  background: #fff5f5;
  border: 1px solid #fed7d7;
  color: #c53030;
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
}

.result-box {
  background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 60%);
  border-radius: var(--radius-lg);
  padding: 32px 24px 24px;
  box-shadow: 0 4px 24px rgba(34,197,94,.12);
  margin-top: 16px;
  text-align: center;
  border: 1.5px solid #bbf7d0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.result-check {
  margin-bottom: 14px;
  animation: popIn .35s cubic-bezier(.34,1.56,.64,1) both;
}

@keyframes popIn {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.result-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #15803d;
  margin-bottom: 12px;
}

.result-file-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  margin-bottom: 20px;
}

.result-filename {
  font-size: 0.82rem;
  color: var(--text-muted);
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-filesize {
  font-size: 0.92rem;
  font-weight: 600;
  color: #166534;
}

.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #16a34a;
  color: white;
  padding: 13px 32px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(22,163,74,.35);
  transition: background .2s, transform .15s, box-shadow .2s;
  text-decoration: none;
  margin-bottom: 10px;
}

.btn-download:hover {
  background: #15803d;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(22,163,74,.4);
}

.btn-again {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.88rem;
  color: var(--text-muted);
  padding: 8px 16px;
}

/* ============================
   MULTI-FILE LIST
   ============================ */

.multi-list-wrap {
  width: 100%;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.multi-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
}

.multi-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
}

.multi-list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.85rem;
}

.multi-list-icon { font-size: 1rem; flex-shrink: 0; }

.multi-list-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.multi-list-size {
  color: var(--text-muted);
  flex-shrink: 0;
  font-size: 0.78rem;
}

.multi-list-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
  transition: background .15s, color .15s;
}

.multi-list-remove:hover { background: #fed7d7; color: #c53030; }

/* ============================
   OTHER TOOLS
   ============================ */

.other-tools {
  padding: 48px 0;
  border-top: 1px solid var(--border);
  background: var(--bg-white);
}

.section-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 24px;
  text-align: center;
}

.other-tools-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.other-tool-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px 8px 8px;
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: 40px;
  font-size: 0.85rem;
  font-weight: 500;
  transition: var(--transition);
  color: var(--text);
}

.other-tool-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  flex-shrink: 0;
}

.other-tool-card:hover {
  border-color: var(--card-color, var(--primary));
  color: var(--card-color, var(--primary));
  background: #fafafa;
  transform: translateY(-1px);
}

.other-tools-groups {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.other-tools-group {
  background: var(--bg);
  border-radius: 14px;
  padding: 16px 20px 18px;
  border-left: 3px solid var(--grp-color, var(--border));
}

.other-tools-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.other-tools-group-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--grp-color);
  flex-shrink: 0;
}

.other-tools-group-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--grp-color);
  white-space: nowrap;
}

.other-tools-group-line {
  flex: 1;
  height: 1px;
  background: var(--grp-color);
  opacity: 0.15;
}

/* ── SEO Content Blocks ── */
.seo-content {
  padding: 48px 0 32px;
  background: var(--bg);
  border-top: 1px solid var(--border);
}

.seo-block {
  max-width: 720px;
  margin: 0 auto 32px;
  color: var(--text-light);
}

.seo-block h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}

.seo-block p {
  font-size: 0.95rem;
  line-height: 1.7;
}

/* ============================
   FOOTER
   ============================ */

.footer {
  background: #111827;
  color: rgba(255,255,255,.65);
  padding: 52px 0 0;
  font-size: 0.88rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 40px;
  padding-bottom: 40px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.footer-tools {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

/* Brand column */
.footer-brand { display: flex; flex-direction: column; gap: 12px; }

.footer-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.footer-logo-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  opacity: 0.9;
}

.footer-logo-name {
  font-size: 1rem;
  font-weight: 700;
  color: white;
}

.footer-desc {
  font-size: 0.83rem;
  line-height: 1.6;
  color: rgba(255,255,255,.5);
}

.footer-secure {
  font-size: 0.78rem;
  color: rgba(255,255,255,.35);
}

/* Tool columns */
.footer-col h3.footer-col-title, .footer-col-title {
  font-size: 1rem;
  font-weight: 700;
  color: rgba(255,255,255,.9);
  margin-bottom: 14px;
  letter-spacing: 0;
  text-transform: none;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-links a {
  color: rgba(255,255,255,.6);
  font-size: 0.85rem;
  transition: color .15s;
}

.footer-links a:hover { color: white; }

/* Bottom bar */
.footer-bottom {
  padding: 20px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: rgba(255,255,255,.3);
}

.footer-bottom-sub { text-align: right; }

/* nulumia.com backlinks */
.footer-nulumia-link {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 500;
  color: rgba(255,255,255,.45);
  text-decoration: none;
  transition: color .2s;
  letter-spacing: .01em;
}
.footer-nulumia-link:hover { color: #FF6B35; }
.footer-nulumia-link--bottom {
  color: rgba(255,255,255,.45);
  font-size: inherit;
  font-weight: inherit;
}

/* ============================
   RESPONSIVE
   ============================ */

/* ── Tablet / Large Mobile (≤ 900px) ── */
@media (max-width: 900px) {
  .workspace-layout {
    grid-template-columns: 1fr;
  }
  .upload-panel { order: 1; }
  .options-panel { order: 2; }

  .seo-links .container { gap: 16px; }
  .seo-links-row { gap: 6px; }
}

/* ── Tablet (≤ 1100px) ── */
@media (max-width: 1100px) {
  .footer-grid { gap: 28px; }
  .footer-tools { gap: 16px; }
}

/* ── Nav collapse (≤ 1100px) ── */
@media (max-width: 1100px) {
  .nav { display: none; }
  .nav.open {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    position: fixed;
    top: 60px;
    left: 0; right: 0;
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 12px;
    box-shadow: var(--shadow-md);
    z-index: 150;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
  }
  .nav.open .nav-link { padding: 10px 12px; font-size: 0.9rem; }
  .nav.open .nav-dropdown { width: 100%; }
  .nav.open .dropdown-menu {
    position: static;
    box-shadow: none;
    border: none;
    padding: 0 0 0 12px;
    background: var(--bg);
    border-radius: 8px;
    margin-top: 4px;
  }
  .nav.open .mega-menu {
    min-width: 0;
    flex-direction: column !important;
    padding: 8px 0 8px 12px;
    gap: 0;
  }
  .nav.open .mega-col {
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 8px 0;
    min-width: 0;
  }
  .nav.open .mega-col:last-child { border-bottom: none; }
  .nav.open .nav-dropdown.open .dropdown-menu { display: flex; }
  .nav-toggle { display: flex; }
}

/* ── Mobile (≤ 768px) ── */
@media (max-width: 768px) {
  /* Container */
  .container { padding: 0 16px; }

  /* Hero */
  .hero { padding: 40px 0; }

  /* Homepage tools grid */
  .tools-grid { grid-template-columns: repeat(2, 1fr); }
  .features-grid { grid-template-columns: repeat(2, 1fr); }

  /* Tool hero */
  .tool-hero { padding: 28px 0; }
  .tool-hero-inner { flex-direction: column; text-align: center; gap: 12px; }
  .tool-hero-icon { width: 52px; height: 52px; }

  /* Tool workspace */
  .tool-workspace { padding: 28px 0; }

  /* Internal links bar — exactly 2 rows, scroll horizontal */
  .tool-internal-links { padding: 0; }
  .tool-internal-links .container { padding: 0; }
  .til-links {
    display: grid;
    grid-template-rows: repeat(2, auto);
    grid-auto-flow: column;
    overflow-x: auto;
    flex-wrap: unset;
    gap: 5px;
    padding: 8px 16px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .til-links::-webkit-scrollbar { display: none; }
  .til-link {
    font-size: 0.75rem;
    padding: 4px 9px 4px 5px;
    white-space: nowrap;
  }
  .til-icon { width: 17px; height: 17px; }

  /* Drop zone */
  .drop-zone { padding: 28px 16px; min-height: 200px; }

  /* Options card */
  .options-card { padding: 16px; }

  /* Result box */
  .result-check svg { width: 32px; height: 32px; }

  /* SEO links (homepage) */
  .seo-links { padding: 32px 0; }
  .seo-links-card { padding: 16px; }
  .seo-links-row { gap: 6px; }
  .seo-link { font-size: 0.82rem; padding: 5px 10px; }

  /* Other tools */
  .other-tools { padding: 32px 0; }
  .other-tools-group { padding: 14px 16px 16px; }
  .other-tools-grid { gap: 8px; }
  .other-tool-card { font-size: 0.8rem; padding: 6px 10px 6px 6px; }
  .other-tool-icon { width: 24px; height: 24px; }

  /* SEO content */
  .seo-content { padding: 32px 0 24px; }

  .footer-bottom { flex-direction: column; text-align: center; gap: 6px; }
  .footer-bottom-sub { text-align: center; }
}

/* ── Small Mobile (≤ 480px) ── */
@media (max-width: 480px) {
  /* Grids */
  .tools-grid { grid-template-columns: 1fr; }
  .features-grid { grid-template-columns: 1fr; }

  /* Hero */
  .hero { padding: 32px 0; }
  .hero-sub { font-size: 0.92rem; }

  /* Tool hero */
  .tool-hero { padding: 20px 0; }

  /* Tool workspace */
  .tool-workspace { padding: 20px 0; }

  /* Drop zone */
  .drop-zone { min-height: 160px; }
  .drop-title { font-size: 0.95rem; }

  /* Process button */
  .btn-process { font-size: 0.95rem; padding: 13px 20px; }

  /* Download / again buttons */
  .btn-download, .btn-again { font-size: 0.88rem; }

  /* Other tools group — remove left border, simplify */
  .other-tools-group { border-left-width: 2px; padding: 12px 12px 14px; }

  /* Internal links */
  .til-link { font-size: 0.72rem; }

  /* Footer — brand full width top + tools 3 cols below */
  .footer-grid { grid-template-columns: 1fr; gap: 20px; }
  .footer-tools { grid-template-columns: repeat(3, 1fr); gap: 12px; }
  .footer-col-title { font-size: 0.82rem; margin-bottom: 10px; }
  .footer-links { gap: 6px; }
  .footer-links a { font-size: 0.78rem; }
}

/* ============================
   YouTube Downloader
   ============================ */
.yt-hero {
  background: linear-gradient(135deg, #FF0000 0%, #CC0000 100%);
  padding: 48px 0 40px;
  color: white;
  text-align: center;
}
.yt-hero-inner { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.yt-hero-icon { font-size: 3rem; }
.yt-hero-title { font-size: 2rem; font-weight: 800; margin: 0; }
.yt-hero-sub { font-size: 1rem; opacity: .85; margin: 0; }

.yt-workspace { padding: 40px 0 64px; }

/* URL input card */
.yt-input-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow-md);
  margin-bottom: 20px;
}
.yt-input-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  transition: border-color var(--transition);
}
.yt-input-wrap:focus-within { border-color: #FF0000; }
.yt-input-icon { font-size: 1.2rem; flex-shrink: 0; }
.yt-url-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 0.95rem;
  color: var(--text);
  background: transparent;
  min-width: 0;
}
.yt-url-input::placeholder { color: var(--text-muted); }
.yt-fetch-btn {
  flex-shrink: 0;
  background: #FF0000;
  border-radius: 8px;
  padding: 8px 20px;
  font-size: 0.9rem;
}
.yt-fetch-btn:hover { background: #CC0000; }

/* Error */
.yt-error {
  background: #fff3f3;
  border: 1px solid #fca5a5;
  color: #b91c1c;
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}

/* Loading */
.yt-loading {
  display: flex;
  align-items: center;
  gap: 14px;
  justify-content: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 0.95rem;
}
.yt-spinner {
  width: 24px; height: 24px;
  border: 3px solid var(--border);
  border-top-color: #FF0000;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Video info card */
.yt-info-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  display: flex;
  gap: 20px;
  align-items: flex-start;
}
.yt-thumb {
  width: 180px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  aspect-ratio: 16/9;
}
.yt-meta { flex: 1; min-width: 0; }
.yt-title { font-size: 1.05rem; font-weight: 700; color: var(--text); line-height: 1.4; margin-bottom: 6px; }
.yt-channel { font-size: 0.88rem; color: var(--text-muted); margin-bottom: 4px; }
.yt-duration { font-size: 0.85rem; color: var(--text-muted); }

/* Options card */
.yt-options-card {
  background: var(--bg-white);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Format tabs */
.yt-format-tabs { display: flex; gap: 10px; }
.yt-fmt-tab {
  flex: 1;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--transition);
  text-align: center;
}
.yt-fmt-tab:hover { border-color: #FF0000; color: #FF0000; }
.yt-fmt-tab.active { border-color: #FF0000; background: #fff0f0; color: #CC0000; }

/* Quality buttons */
.yt-quality-label { font-size: 0.85rem; font-weight: 600; color: var(--text-muted); margin-bottom: 8px; display: block; }
.yt-quality-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.yt-q-btn {
  padding: 7px 16px;
  border: 2px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all var(--transition);
}
.yt-q-btn:hover { border-color: #FF0000; color: #CC0000; }
.yt-q-btn.active { border-color: #FF0000; background: #fff0f0; color: #CC0000; }

/* Download button */
.yt-dl-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #FF0000, #CC0000);
  color: white;
  padding: 14px 24px;
  font-size: 1.05rem;
  font-weight: 700;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: opacity var(--transition);
  width: 100%;
}
.yt-dl-btn:hover { opacity: .88; }
.yt-dl-btn:disabled { opacity: .5; cursor: not-allowed; }

.yt-dl-progress { margin-top: 4px; }

@media (max-width: 600px) {
  .yt-info-card { flex-direction: column; }
  .yt-thumb { width: 100%; }
  .yt-format-tabs { flex-direction: column; }
}
