/* ============================================================
   Tool Dude v1.1 — Premium Mobile Navigation + Responsive Repair
   Mobile Header · Offcanvas Sidebar · Bottom App Nav
   Author: Mr Arslan CEO
   ============================================================ */

/* ---------- Global safety: no horizontal page scroll ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { width: 100%; max-width: 100%; overflow-x: hidden; }
img, video, iframe, embed, object { max-width: 100%; }
.td-container, .td-wrap, .ad-main, .ad-card, .td-content-card, .td-side-card, .td-form, .td-card { max-width: 100%; }

/* Long URLs/words inside cards shouldn't break layout */
.td-card-desc, .td-card-title, .td-rank-name, .td-rank-desc,
.td-tool-hero h1, .td-content-card p, .td-content-card li,
.td-footer a, .td-footer p, .td-blog-card p, .td-blog-card h3 {
  overflow-wrap: anywhere;
  word-wrap: break-word;
}

/* Iframe wrapper (videos / embeds inside content) */
.td-content-card iframe { width: 100%; aspect-ratio: 16 / 9; height: auto; }

/* ---------- Premium Mobile Header (frontend) ---------- */
.td-mobile-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #fff;
  padding: 12px 16px;
  border-bottom: 1px solid var(--td-border, #e6e8ef);
  position: sticky;
  top: 0;
  z-index: 80;
  min-height: 60px;
}
.td-mobile-header-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--td-secondary, #1a1f36);
  font-weight: 700;
  font-size: 15px;
  flex: 1;
  min-width: 0;
}
.td-mobile-header-brand img { height: 32px; width: auto; flex-shrink: 0; }
.td-mobile-header-brand span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.td-mobile-header-actions { display: inline-flex; align-items: center; gap: 6px; }
.td-icon-btn {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--td-border, #e6e8ef);
  background: #fff;
  border-radius: 12px;
  cursor: pointer;
  color: var(--td-secondary, #1a1f36);
  padding: 0;
  transition: all .15s;
}
.td-icon-btn:hover { background: var(--td-primary, #ff6a00); color: #fff; border-color: var(--td-primary, #ff6a00); }
.td-icon-btn svg { width: 22px; height: 22px; display: block; }

/* ---------- Offcanvas Sidebar (frontend) ---------- */
.td-mobile-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 86%;
  max-width: 360px;
  height: 100vh;
  height: 100dvh;
  background: #fff;
  z-index: 1000;
  transform: translateX(-105%);
  transition: transform .28s cubic-bezier(.4,.0,.2,1);
  box-shadow: 0 18px 40px rgba(20,25,50,0.22);
  display: flex;
  flex-direction: column;
  border-top-right-radius: 18px;
  border-bottom-right-radius: 18px;
  overflow: hidden;
}
body.td-mobile-sidebar-open .td-mobile-sidebar { transform: translateX(0); }
.td-mobile-sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 19, 34, 0.55);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease;
  backdrop-filter: blur(2px);
}
body.td-mobile-sidebar-open .td-mobile-sidebar-overlay { opacity: 1; visibility: visible; }
body.td-mobile-sidebar-open { overflow: hidden; }

.td-msb-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--td-border, #e6e8ef);
  background: linear-gradient(135deg, #fff6ee 0%, #ffffff 100%);
}
.td-msb-logo { display: inline-flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.td-msb-logo img { height: 38px; width: auto; }
.td-msb-logo .td-msb-site {
  font-weight: 800;
  font-size: 16px;
  color: var(--td-secondary, #1a1f36);
  letter-spacing: -.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.td-msb-close {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: #f4f5fa;
  color: var(--td-secondary, #1a1f36);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
}
.td-msb-close:hover { background: var(--td-primary, #ff6a00); color: #fff; }
.td-msb-close svg { width: 20px; height: 20px; }

.td-msb-search {
  padding: 12px 16px;
  border-bottom: 1px solid var(--td-border, #e6e8ef);
}
.td-msb-search form {
  display: flex;
  background: #f4f5fa;
  border-radius: 50px;
  padding: 4px 4px 4px 14px;
  align-items: center;
}
.td-msb-search input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 14px;
  padding: 10px 4px;
  min-width: 0;
}
.td-msb-search button {
  background: var(--td-primary, #ff6a00);
  color: #fff;
  border: none;
  border-radius: 50px;
  width: 38px;
  height: 38px;
  cursor: pointer;
}

.td-msb-body { flex: 1; overflow-y: auto; padding: 8px 0 16px; -webkit-overflow-scrolling: touch; }
.td-msb-section-label {
  padding: 14px 18px 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--td-muted, #6c7591);
  font-weight: 700;
}
.td-msb-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 18px;
  color: var(--td-secondary, #1a1f36);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all .15s;
}
.td-msb-link:hover { background: #fff8f3; color: var(--td-primary, #ff6a00); }
.td-msb-link.active {
  background: linear-gradient(90deg, rgba(255,106,0,0.10), transparent);
  color: var(--td-primary, #ff6a00);
  border-left-color: var(--td-primary, #ff6a00);
}
.td-msb-link svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  stroke-width: 1.8;
}
.td-msb-link .td-msb-chip {
  margin-left: auto;
  font-size: 11px;
  background: var(--td-primary, #ff6a00);
  color: #fff;
  padding: 2px 8px;
  border-radius: 50px;
  font-weight: 700;
}
.td-msb-divider { height: 1px; background: var(--td-border, #e6e8ef); margin: 8px 16px; }

.td-msb-footer {
  border-top: 1px solid var(--td-border, #e6e8ef);
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  background: #fafbfd;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.td-msb-footer .td-btn { width: 100%; justify-content: center; min-height: 44px; }
.td-msb-social { display: flex; gap: 8px; justify-content: center; padding-top: 6px; }
.td-msb-social a {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #fff;
  border: 1px solid var(--td-border, #e6e8ef);
  color: var(--td-muted, #6c7591);
}
.td-msb-social a:hover { background: var(--td-primary, #ff6a00); color: #fff; border-color: var(--td-primary, #ff6a00); }

/* ---------- Mobile Bottom Navigation Bar (frontend) ---------- */
.td-bottom-nav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 70;
  background: #fff;
  border-top: 1px solid var(--td-border, #e6e8ef);
  box-shadow: 0 -4px 22px rgba(15, 19, 34, 0.08);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  border-top-left-radius: 18px;
  border-top-right-radius: 18px;
}
.td-bottom-nav-inner {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2px;
  max-width: 640px;
  margin: 0 auto;
}
.td-bn-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 4px;
  border: none;
  background: transparent;
  color: var(--td-muted, #6c7591);
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 12px;
  transition: all .15s;
  min-height: 56px;
  position: relative;
}
.td-bn-item svg {
  width: 24px;
  height: 24px;
  stroke-width: 1.8;
  display: block;
}
.td-bn-item span {
  display: block;
  font-size: 10.5px;
  letter-spacing: .2px;
  line-height: 1.1;
}
.td-bn-item:hover { color: var(--td-primary, #ff6a00); }
.td-bn-item.active {
  color: var(--td-primary, #ff6a00);
  background: rgba(255, 106, 0, 0.08);
}
.td-bn-item.active::before {
  content: '';
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 3px;
  border-radius: 3px;
  background: var(--td-primary, #ff6a00);
}
.td-bn-item .td-bn-badge {
  position: absolute;
  top: 4px;
  right: 18%;
  background: #ef4444;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 50px;
  line-height: 1.3;
}

/* ---------- Responsive switches ---------- */
@media (max-width: 992px) {
  /* Show mobile UI starting at tablet */
  .td-mobile-header { display: flex; }
  .td-bottom-nav { display: block; }
  /* Hide desktop chrome on mobile/tablet */
  .td-header { display: none !important; }
  /* Give body bottom padding so bottom nav doesn't cover footer/buttons.
     v1.1.2: increased from 80px -> 88px (covers 72px bar + safe-area). */
  body.td-body { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
  /* Footer should sit cleanly above the bottom nav, never behind it. */
  .td-footer { margin-bottom: 0; padding-bottom: 18px; }
}

@media (min-width: 993px) {
  .td-mobile-header,
  .td-mobile-sidebar,
  .td-mobile-sidebar-overlay,
  .td-bottom-nav { display: none !important; }
}

/* ---------- Frontend responsive cleanup ---------- */
@media (max-width: 992px) {
  .td-section { padding: 30px 0; }
  .td-section-head { align-items: flex-start; }
  .td-hero { padding: 36px 0 30px; }
  .td-hero-grid { grid-template-columns: 1fr; gap: 24px; text-align: center; }
  .td-hero-mascot { order: -1; }
  .td-hero-mascot img { max-height: 220px; }
  .td-hero h1 { font-size: 30px; }
  .td-hero p.lead { font-size: 15px; }
  .td-hero-search, .td-hero-stats { margin-left: auto; margin-right: auto; }
  .td-hero-stats { justify-content: center; flex-wrap: wrap; gap: 18px; }
  .td-tool-grid { grid-template-columns: 1fr; }
  .td-footer { padding: 36px 0 16px; margin-top: 36px; }
}

/* ---------- v1.1.2: Premium mobile sidebar action buttons ---------- */
.td-msb-footer .td-msb-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 10px 16px;
  font-weight: 700;
  font-size: 14px;
  border-radius: 12px;
  width: 100%;
}
.td-msb-footer .td-msb-action svg { width: 18px; height: 18px; }
.td-msb-footer .td-msb-action.td-btn-primary { background: var(--td-primary, #ff6a00); color: #fff !important; border: 1px solid var(--td-primary, #ff6a00); }
.td-msb-footer .td-msb-action.td-btn-outline { background: #fff; color: var(--td-secondary, #1a1f36) !important; border: 1px solid var(--td-border, #e6e8ef); }
.td-msb-footer .td-msb-action.td-btn-outline:hover { border-color: var(--td-primary, #ff6a00); color: var(--td-primary, #ff6a00) !important; }

/* v1.1.2: Premium mobile tool-card polish */
@media (max-width: 768px) {
  /* Single-column app-like cards on phones, 2-col only on small tablets */
  .td-card-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .td-card {
    border-radius: 14px;
    box-shadow: 0 2px 14px rgba(20,25,50,0.06);
    overflow: hidden;
  }
  /* Trim the orange decorative edge that overflowed some grid layouts */
  .td-card::before, .td-card::after { display: none !important; }
  .td-card-title { font-size: 15.5px; line-height: 1.3; }
  .td-card-desc {
    font-size: 13px;
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .td-card-meta { gap: 6px; }
  .td-cat-badge, .td-pricing-badge { font-size: 11px; padding: 3px 9px; }
  .td-card-stats { font-size: 12px; gap: 8px; }
  .td-card-actions { display: flex; flex-wrap: wrap; gap: 6px; }
  .td-card-actions .td-btn { flex: 1 1 calc(50% - 4px); min-height: 38px; padding: 8px 10px; font-size: 12.5px; justify-content: center; }
  .td-card-actions .td-compare-btn { flex: 0 0 42px; padding: 8px; }
  .td-card-actions .td-compare-btn.is-active { background: var(--td-primary, #ff6a00); color: #fff !important; border-color: var(--td-primary, #ff6a00); }
  /* Override original media block (keep grid 2-col here) */

  .td-cat-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; }
  .td-blog-grid { grid-template-columns: 1fr; gap: 16px; }
  .td-footer-grid { grid-template-columns: 1fr 1fr; gap: 22px; }
  .td-hero h1 { font-size: 26px; }
  .td-hero-stats div b { font-size: 20px; }
  .td-section-head h2 { font-size: 22px; }
  .td-pros-cons { grid-template-columns: 1fr; }
  .td-feature-list { grid-template-columns: 1fr; }
  .td-form .td-row { grid-template-columns: 1fr; }
  .td-tool-hero { padding: 18px; }
  .td-tool-hero-top { grid-template-columns: 76px 1fr; gap: 14px; }
  .td-tool-hero-logo { width: 76px; height: 76px; }
  .td-tool-hero h1 { font-size: 22px; }
  .td-tool-hero .td-visit { grid-column: 1 / -1; text-align: center; width: 100%; justify-content: center; }
  .td-card-thumb { padding: 18px; }
  .td-card-thumb img { width: 64px; height: 64px; }
  .td-card-initials { width: 64px; height: 64px; font-size: 24px; }
  .td-newsletter { padding: 34px 18px; border-radius: 14px; }
  .td-newsletter h3 { font-size: 22px; }
  .td-newsletter form { flex-direction: column; background: transparent; gap: 8px; padding: 0; }
  .td-newsletter input, .td-newsletter button { border-radius: 12px; width: 100%; padding: 13px 16px; }
  /* v1.1.2: floating compare bar removed; only keep scroll-to-top offset. */
  .td-scrolltop { bottom: 92px; right: 14px; }
  /* Tables become horizontally scrollable wrappers */
  .td-table-wrap, .td-content-card table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  /* Buttons/badges wrap */
  .td-card-actions { flex-wrap: wrap; }
  .td-card-actions .td-btn { flex: 1 1 calc(50% - 4px); min-height: 40px; }
  .td-meta, .td-card-meta, .td-card-badges, .td-hero-popular { flex-wrap: wrap; }
  /* Make filter chips wrap */
  .td-filters { gap: 8px; padding: 12px; }
  .td-filters select, .td-filters input { flex: 1 1 140px; min-height: 42px; }
}

@media (max-width: 576px) {
  .td-container { padding: 0 14px; }
  .td-cat-grid { grid-template-columns: repeat(2, 1fr); }
  .td-footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .td-hero h1 { font-size: 24px; line-height: 1.2; }
  .td-hero p.lead { font-size: 14px; }
  .td-section-head h2 { font-size: 20px; }
  .td-tool-hero h1 { font-size: 20px; }
  .td-tool-hero-top { grid-template-columns: 64px 1fr; }
  .td-tool-hero-logo { width: 64px; height: 64px; padding: 8px; }
  .td-rank-row { grid-template-columns: 36px 46px 1fr; gap: 10px; padding: 10px 12px; }
  .td-rank-stars, .td-rank-views { display: none; }
}

@media (max-width: 430px) {
  /* Phones: 1-col tool grid */
  .td-card-grid { grid-template-columns: 1fr; }
  .td-hero { padding: 28px 0 22px; }
  .td-hero h1 { font-size: 22px; }
  .td-hero-mascot img { max-height: 180px; }
  .td-mobile-header { padding: 10px 12px; min-height: 56px; }
  .td-mobile-header-brand span { font-size: 14px; }
  .td-mobile-header-brand img { height: 28px; }
  .td-icon-btn { width: 38px; height: 38px; }
  .td-icon-btn svg { width: 20px; height: 20px; }
  .td-bn-item span { font-size: 9.5px; }
  .td-bn-item svg { width: 22px; height: 22px; }
  .td-bn-item { min-height: 52px; padding: 6px 2px; }
  .td-msb-header { padding: 14px 14px 12px; }
  .td-msb-logo img { height: 32px; }
}

@media (max-width: 390px) {
  .td-cat-grid { grid-template-columns: 1fr 1fr; }
  .td-card-actions { flex-direction: column; }
  .td-card-actions .td-btn { width: 100%; flex: 1 1 100%; }
  .td-hero h1 { font-size: 20px; }
  .td-card-title { font-size: 15px; }
  .td-hero-stats { gap: 12px; }
  .td-hero-stats div b { font-size: 18px; }
}

@media (max-width: 360px) {
  .td-container { padding: 0 12px; }
  .td-mobile-sidebar { width: 92%; }
  .td-bn-item span { font-size: 9px; }
  .td-msb-link { padding: 12px 14px; font-size: 14px; }
}

/* Hide bottom nav / mobile header / sidebar inside admin pages */
body.ad-body .td-mobile-header,
body.ad-body .td-mobile-sidebar,
body.ad-body .td-mobile-sidebar-overlay,
body.ad-body .td-bottom-nav { display: none !important; }

/* Dark mode adjustments */
body.td-dark .td-mobile-header,
body.td-dark .td-mobile-sidebar,
body.td-dark .td-bottom-nav { background: #1a1f36; border-color: #2a3151; }
body.td-dark .td-mobile-header-brand,
body.td-dark .td-msb-logo .td-msb-site,
body.td-dark .td-msb-link,
body.td-dark .td-icon-btn { color: #e6e8f0; }
body.td-dark .td-icon-btn { background: #1a1f36; border-color: #2a3151; }
body.td-dark .td-msb-header { background: #1a1f36; }
body.td-dark .td-msb-footer { background: #141828; }
body.td-dark .td-msb-search form { background: #2a3151; }
body.td-dark .td-msb-close { background: #2a3151; color: #e6e8f0; }
body.td-dark .td-msb-divider { background: #2a3151; }

/* =====================================================================
   ADMIN PANEL — Premium Mobile Sidebar + Responsive Fixes
   ===================================================================== */

/* Admin sidebar overlay */
.ad-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 19, 34, 0.55);
  z-index: 95;
  backdrop-filter: blur(2px);
}
body.ad-sidebar-open .ad-overlay { display: block; }

/* Admin sidebar close button (mobile only) */
.ad-sidebar-close {
  display: none;
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.10);
  color: #fff;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.ad-sidebar-close svg { width: 18px; height: 18px; }

/* Admin global responsive cleanups */
.ad-body { width: 100%; max-width: 100%; }
body.ad-body { overflow-x: hidden; }

/* Wrap admin tables in horizontal scroll without breaking page */
.ad-card .td-table-wrap,
.ad-card > .td-table {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  display: block;
}

@media (max-width: 1100px) {
  .ad-stats { grid-template-columns: repeat(2, 1fr); }
  .ad-grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .ad-body { grid-template-columns: 1fr; grid-template-rows: 60px 1fr auto; }
  .ad-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    max-width: 86%;
    height: 100vh;
    height: 100dvh;
    z-index: 100;
    transform: translateX(-105%);
    transition: transform .28s cubic-bezier(.4,.0,.2,1);
    border-top-right-radius: 18px;
    border-bottom-right-radius: 18px;
    box-shadow: 0 18px 40px rgba(0,0,0,0.4);
  }
  body.ad-sidebar-open .ad-sidebar { transform: translateX(0); }
  .ad-sidebar-close { display: inline-flex; }
  .ad-mtoggle { display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px; border-radius: 10px; border: 1px solid var(--td-border, #e6e8ef); background: #fff; }
  .ad-header { padding: 10px 14px; gap: 8px; }
  .ad-header h1 { font-size: 16px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ad-header-right { gap: 6px; }
  .ad-main { padding: 16px; }
  .ad-card { padding: 16px; }
  .ad-toolbar { flex-direction: column; align-items: stretch; }
  .ad-toolbar form { flex-wrap: wrap; }
  .ad-toolbar input, .ad-toolbar select { flex: 1 1 140px; min-height: 42px; }
  /* Admin tables become scrollable */
  .ad-card .td-table,
  .ad-card table { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
  /* Forms full-width */
  .ad-card form .td-row { grid-template-columns: 1fr; }
  .ad-card input, .ad-card select, .ad-card textarea { min-height: 42px; }
  /* Action button column wrap */
  .ad-actions { display: flex; flex-wrap: wrap; gap: 4px; }
}

@media (max-width: 640px) {
  .ad-stats { grid-template-columns: 1fr 1fr; gap: 12px; }
  .ad-stat { padding: 14px; gap: 10px; }
  .ad-stat-icon { width: 42px; height: 42px; font-size: 18px; }
  .ad-stat-value { font-size: 18px; }
  .ad-health-grid { grid-template-columns: 1fr; }
  .ad-header h1 { font-size: 15px; }
  .ad-header-right .td-btn span,
  .ad-header-right .ad-user { display: none; }
  .ad-header-right .td-btn { min-height: 38px; padding: 6px 10px; }
  .ad-main { padding: 12px; }
  .ad-card { padding: 14px; border-radius: 12px; }
}

@media (max-width: 430px) {
  .ad-stats { grid-template-columns: 1fr; }
  .ad-sidebar { width: 92%; }
  .ad-mtoggle { width: 38px; height: 38px; }
}

/* Hamburger icon style upgrades */
.ad-mtoggle i { font-size: 18px; }

/* Form rows inside admin */
.ad-card .td-form, .ad-card .td-content-card { padding: 0; box-shadow: none; border: none; background: transparent; }

/* Premium scrollbar inside sidebars */
.td-mobile-sidebar .td-msb-body::-webkit-scrollbar,
.ad-sidebar::-webkit-scrollbar { width: 6px; }
.td-mobile-sidebar .td-msb-body::-webkit-scrollbar-thumb,
.ad-sidebar::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.18); border-radius: 6px; }

/* v1.1.3: Mobile tool card repair - premium single-column cards on phones */
@media (max-width: 600px) {
  /* Force every tool-card section to use readable one-column cards on phones */
  .td-card-grid,
  .tools-grid,
  .tool-grid,
  .featured-tools-grid,
  .trending-tools-grid,
  .latest-tools-grid,
  .similar-tools-grid,
  .td-main .td-card-grid,
  .td-section .td-card-grid,
  .td-content-card .td-card-grid,
  .td-sidebar .td-card-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
    width: 100% !important;
  }

  /* App-style card shell */
  .td-card {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    border-radius: 18px !important;
    overflow: hidden !important;
    border: 1px solid rgba(226, 232, 240, 0.95) !important;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08) !important;
    transform: none !important;
  }
  .td-card:hover { transform: none !important; }
  .td-card::before,
  .td-card::after { display: none !important; content: none !important; }

  /* Compact logo/thumbnail area */
  .td-card-thumb {
    padding: 16px 14px 10px !important;
    min-height: auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  .td-card-thumb img,
  .td-card-initials {
    width: 58px !important;
    height: 58px !important;
    max-width: 58px !important;
    max-height: 58px !important;
  }
  .td-card-initials {
    font-size: 22px !important;
    border-radius: 16px !important;
  }
  .td-fav-btn {
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    min-height: 34px !important;
    top: 10px !important;
    right: 10px !important;
    z-index: 5 !important;
  }

  /* Balanced body spacing */
  .td-card-body {
    padding: 12px 14px 14px !important;
    gap: 0 !important;
  }
  .td-card-top {
    align-items: flex-start !important;
    gap: 8px !important;
    min-width: 0 !important;
  }
  .td-card-title {
    font-size: 16px !important;
    line-height: 1.35 !important;
    font-weight: 800 !important;
    min-width: 0 !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
  }
  .td-badge-verified { flex: 0 0 auto !important; margin-top: 2px !important; }
  .td-card-desc {
    font-size: 13px !important;
    line-height: 1.45 !important;
    margin: 6px 0 10px !important;
    min-height: 0 !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
  }

  /* Turn overlay badges into normal inline badges on phones */
  .td-card-badges {
    position: static !important;
    order: -1 !important;
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 5px !important;
    margin: 0 0 8px !important;
    padding: 0 !important;
    max-width: calc(100% - 44px) !important;
  }
  .td-card-badges span {
    font-size: 10px !important;
    line-height: 1.15 !important;
    padding: 4px 7px !important;
    border-radius: 999px !important;
    max-width: 100% !important;
    white-space: normal !important;
  }

  /* Meta + stats alignment */
  .td-card-meta {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    margin-bottom: 10px !important;
  }
  .td-cat-badge,
  .td-pricing-badge {
    font-size: 11px !important;
    line-height: 1.2 !important;
    padding: 4px 8px !important;
    max-width: 100% !important;
    overflow-wrap: anywhere !important;
  }
  .td-card-stats {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 8px !important;
    font-size: 12px !important;
    margin-bottom: 12px !important;
    flex-wrap: wrap !important;
  }
  .td-stars-row {
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    min-width: 0 !important;
  }

  /* Fix the oversized Details/Visit action area */
  .td-card-actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
    align-items: stretch !important;
    margin-top: 10px !important;
  }
  .td-card-actions .td-btn {
    width: 100% !important;
    min-width: 0 !important;
    min-height: 40px !important;
    height: 40px !important;
    padding: 0 10px !important;
    font-size: 12.5px !important;
    border-radius: 11px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 5px !important;
    white-space: nowrap !important;
    line-height: 1 !important;
    flex: unset !important;
  }
  /* Compare page exists in bottom nav, so hide card compare icon on phone cards for cleaner layout */
  .td-card-actions .td-compare-btn {
    display: none !important;
  }
}

@media (min-width: 601px) and (max-width: 768px) {
  /* Small tablets can use two columns without crowding */
  .td-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .td-card-actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr auto !important;
    gap: 8px !important;
  }
  .td-card-actions .td-btn {
    min-height: 38px !important;
    height: 38px !important;
    border-radius: 11px !important;
    padding: 0 10px !important;
    flex: unset !important;
  }
  .td-card-actions .td-compare-btn {
    width: 38px !important;
    min-width: 38px !important;
    max-width: 38px !important;
    padding: 0 !important;
  }
}

@media (max-width: 390px) {
  .td-card-actions {
    grid-template-columns: 1fr !important;
  }
  .td-card-actions .td-btn {
    height: 42px !important;
    min-height: 42px !important;
  }
}

/* =====================================================================
   Tool Dude v1.1.4 — Final Admin Responsive Overrides
   Loaded after admin.css, so these rules win over older mobile admin CSS.
   ===================================================================== */
body.ad-body,
body.ad-body * { box-sizing: border-box; }
body.ad-body { width: 100%; max-width: 100%; overflow-x: hidden; }
body.ad-body img,
body.ad-body iframe,
body.ad-body video,
body.ad-body embed,
body.ad-body object { max-width: 100%; height: auto; }
.ad-main,
.ad-header,
.ad-footer,
.ad-card,
.ad-toolbar { min-width: 0; max-width: 100%; }
.ad-main { overflow-x: hidden; }
.ad-sidebar { z-index: 110; }
.ad-overlay { z-index: 105; }
.ad-header { z-index: 80; }
.ad-header h1 { min-width: 0; line-height: 1.25; }
.ad-header-right { min-width: 0; }
.ad-stats,
.ad-health-grid,
.ad-grid-2 { min-width: 0; }
.ad-stat,
.ad-health-item { min-width: 0; }
.ad-stat > div:last-child { min-width: 0; }
.ad-stat-value,
.ad-stat-label,
.ad-health-item,
.ad-card h3 { overflow-wrap: anywhere; }

.ad-toolbar > div:first-child { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-width: 0; }
.ad-toolbar form { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.ad-toolbar input,
.ad-toolbar select,
.ad-toolbar button { min-width: 0; }

body.ad-body .td-form input[type=text],
body.ad-body .td-form input[type=email],
body.ad-body .td-form input[type=password],
body.ad-body .td-form input[type=url],
body.ad-body .td-form input[type=number],
body.ad-body .td-form input[type=date],
body.ad-body .td-form input[type=file],
body.ad-body .td-form select,
body.ad-body .td-form textarea,
.ad-card input[type=text],
.ad-card input[type=email],
.ad-card input[type=password],
.ad-card input[type=url],
.ad-card input[type=number],
.ad-card input[type=date],
.ad-card input[type=file],
.ad-card select,
.ad-card textarea { max-width: 100%; min-width: 0; }
body.ad-body input[type="checkbox"],
body.ad-body input[type="radio"] { width: auto; min-height: auto; }

.ad-table-scroll { width: 100%; max-width: 100%; overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; border-radius: 12px; }
.ad-table-scroll .td-table { display: table !important; width: 100%; min-width: 760px; box-shadow: none; }
.ad-table-scroll .td-table th,
.ad-table-scroll .td-table td { white-space: normal; vertical-align: middle; }
.ad-table-scroll .td-table td small,
.ad-table-scroll .td-table td strong { overflow-wrap: anywhere; }
.ad-actions { display: inline-flex; flex-wrap: nowrap; gap: 4px; min-width: max-content; }
.ad-actions a,
.ad-actions button { margin: 0; flex: 0 0 30px; }
.ad-bulk-card { display: flex !important; gap: 8px !important; align-items: center !important; flex-wrap: wrap !important; }
.ad-bulk-card select { width: auto; min-width: 180px; }
.ad-bulk-card span { margin-left: auto; }

@media (max-width: 1200px) {
  body.ad-body .ad-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  body.ad-body .ad-health-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  body.ad-body .ad-grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 992px) {
  body.ad-body { display: block !important; min-height: 100vh; padding-top: 60px; }
  body.ad-body .ad-header { position: fixed; top: 0; left: 0; right: 0; height: 60px; padding: 9px 12px; gap: 8px; }
  body.ad-body .ad-header h1 { flex: 1; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  body.ad-body .ad-header-right { flex-wrap: nowrap; gap: 6px; justify-content: flex-end; }
  body.ad-body .ad-user { max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  body.ad-body .ad-main { padding: 16px; }
  body.ad-body .ad-footer { padding: 14px 12px 18px; }

  body.ad-body .ad-sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: min(86vw, 340px) !important;
    max-width: min(86vw, 340px) !important;
    height: 100vh !important;
    height: 100dvh !important;
    transform: translateX(-110%) !important;
    transition: transform .28s cubic-bezier(.4,0,.2,1) !important;
    border-top-right-radius: 20px;
    border-bottom-right-radius: 20px;
    box-shadow: 0 24px 60px rgba(0,0,0,.35);
    padding-top: 14px;
  }
  body.ad-body.ad-sidebar-open .ad-sidebar,
  body.ad-sidebar-open .ad-sidebar { transform: translateX(0) !important; }
  body.ad-sidebar-open { overflow: hidden; }
  body.ad-body .ad-sidebar-close { display: inline-flex; }
  body.ad-body .ad-logo { padding: 0 52px 14px 18px; margin-bottom: 8px; min-height: 54px; display: flex; align-items: center; }
  body.ad-body .ad-logo img { height: 34px; max-width: 170px; object-fit: contain; }
  body.ad-body .ad-nav a { min-height: 46px; padding: 12px 18px; font-size: 14px; }
  body.ad-body .ad-nav a i { flex: 0 0 18px; text-align: center; }
  body.ad-body .ad-nav-group { padding: 14px 18px 6px; }
  body.ad-body .ad-mtoggle { display: inline-flex !important; align-items: center; justify-content: center; width: 42px; height: 42px; flex: 0 0 42px; border-radius: 12px; border: 1px solid #e6e8ef; background: #fff; color: #1a1f36; }

  body.ad-body .ad-stats,
  body.ad-body .ad-stats[style] { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 12px; }
  body.ad-body .ad-health-grid { grid-template-columns: 1fr; }
  body.ad-body .ad-grid-2 { grid-template-columns: 1fr !important; gap: 16px; }
  body.ad-body .ad-card { padding: 16px; margin-bottom: 16px; border-radius: 14px; }
  body.ad-body .td-form { padding: 0; box-shadow: none; border: none; background: transparent; }
  body.ad-body .td-form .td-row { grid-template-columns: 1fr; gap: 0; }
  body.ad-body .td-form input,
  body.ad-body .td-form select,
  body.ad-body .td-form textarea,
  body.ad-body .ad-card input,
  body.ad-body .ad-card select,
  body.ad-body .ad-card textarea { width: 100%; min-height: 44px; font-size: 14px; }
  body.ad-body .td-btn { min-height: 42px; }
  body.ad-body .ad-toolbar { flex-direction: column; align-items: stretch; gap: 12px; }
  body.ad-body .ad-toolbar > div:first-child,
  body.ad-body .ad-toolbar form { width: 100%; justify-content: flex-start; }
  body.ad-body .ad-toolbar .td-btn { flex: 1 1 auto; min-height: 42px; }
  body.ad-body .ad-toolbar form input,
  body.ad-body .ad-toolbar form select,
  body.ad-body .ad-toolbar form button { flex: 1 1 180px; min-height: 42px; }
}

@media (max-width: 768px) {
  body.ad-body .ad-main { padding: 14px 12px; }
  body.ad-body .ad-card { padding: 14px; }
  body.ad-body .ad-header h1 { font-size: 15.5px; }
  body.ad-body .ad-header-right .ad-user { display: none; }
  body.ad-body .ad-header-right .td-btn { min-width: 40px; padding: 7px 10px; }
  body.ad-body .ad-header-right .td-btn:first-child { max-width: 42px; overflow: hidden; }
  body.ad-body .ad-stats,
  body.ad-body .ad-stats[style] { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  body.ad-body .ad-stat { padding: 13px; border-radius: 12px; gap: 10px; }
  body.ad-body .ad-stat-icon { width: 42px; height: 42px; border-radius: 11px; font-size: 18px; flex: 0 0 42px; }
  body.ad-body .ad-stat-value { font-size: 18px; line-height: 1.15; }
  body.ad-body .ad-stat-label { font-size: 10.5px; line-height: 1.25; }
  body.ad-body .ad-bulk-card { align-items: stretch !important; }
  body.ad-body .ad-bulk-card select,
  body.ad-body .ad-bulk-card button { flex: 1 1 150px; min-height: 42px; }
  body.ad-body .ad-bulk-card span { flex: 1 1 100%; margin-left: 0 !important; text-align: left; }
  body.ad-body .ad-table-scroll .td-table { min-width: 720px; }
  body.ad-body [style*="grid-template-columns:repeat(2,1fr)"] { grid-template-columns: 1fr 1fr !important; }
}

@media (max-width: 576px) {
  body.ad-body { padding-top: 58px; }
  body.ad-body .ad-header { height: 58px; }
  body.ad-body .ad-header h1 { font-size: 14.5px; }
  body.ad-body .ad-mtoggle { width: 40px; height: 40px; flex-basis: 40px; }
  body.ad-body .ad-header-right { gap: 4px; }
  body.ad-body .ad-header-right .td-btn { width: 38px; min-width: 38px; height: 38px; padding: 0; border-radius: 10px; }
  body.ad-body .ad-main { padding: 12px 10px; }
  body.ad-body .ad-card { padding: 12px; border-radius: 13px; }
  body.ad-body .ad-stats,
  body.ad-body .ad-stats[style] { grid-template-columns: 1fr !important; }
  body.ad-body .ad-toolbar > div:first-child { flex-direction: column; align-items: stretch; }
  body.ad-body .ad-toolbar .td-btn,
  body.ad-body .ad-toolbar form input,
  body.ad-body .ad-toolbar form select,
  body.ad-body .ad-toolbar form button { width: 100%; flex: 1 1 100%; }
  body.ad-body [style*="width:70px"],
  body.ad-body [style*="width:60px"],
  body.ad-body [style*="width:140px"],
  body.ad-body [style*="width:200px"] { width: 100% !important; }
  body.ad-body [style*="display:flex"][style*="align-items:end"] { align-items: stretch !important; }
  body.ad-body [style*="display:flex"][style*="align-items:end"] > div { flex: 1 1 100%; }
  body.ad-body [style*="display:grid"][style*="grid-template-columns:repeat(2,1fr)"] { grid-template-columns: 1fr !important; }
}

@media (max-width: 430px) {
  body.ad-body .ad-sidebar { width: 92vw !important; max-width: 92vw !important; }
  body.ad-body .ad-logo img { max-width: 150px; }
  body.ad-body .ad-nav a { font-size: 13.5px; padding: 11px 16px; }
  body.ad-body .ad-nav-group { padding-left: 16px; padding-right: 16px; }
  body.ad-body .ad-header { padding: 9px 10px; }
  body.ad-body .ad-main { padding-left: 8px; padding-right: 8px; }
  body.ad-body .ad-card { padding: 11px; }
  body.ad-body .ad-table-scroll .td-table { min-width: 680px; }
}

/* v1.1.5 mobile ads and comments */
@media (max-width:768px){.td-ad-slot{margin:18px auto}.td-ad{border-radius:14px;padding:8px}.td-ad-label{font-size:9px;margin-bottom:6px}.td-post-wrap{padding-left:14px;padding-right:14px}.td-comments{padding:16px}.td-comment-form-card{padding:14px}.td-comment-item{grid-template-columns:38px 1fr;padding:12px;gap:10px}.td-comment-avatar{width:38px;height:38px;border-radius:12px}.td-comment-meta{flex-direction:column;align-items:flex-start;gap:2px}.td-post-featured{border-radius:12px}.td-post-content{font-size:15px;line-height:1.7}}
@media (max-width:430px){.td-ad-slot{margin:14px auto}.td-ad{padding:7px;border-radius:12px}.td-comments h2{font-size:21px}.td-comment-item{grid-template-columns:1fr}.td-comment-avatar{width:42px;height:42px}.td-comment-form-card{padding:12px}.td-comment-form .td-btn{width:100%;justify-content:center}}
