/* ============================================================
   WebP Tools Suite — shared.css  v2.0
   Production-ready design system
   ============================================================ */

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

/* ---------- Tokens ---------- */
:root {
  --c-bg:      #f1f5f9;
  --c-white:   #ffffff;
  --c-zone:    #eff6ff;
  --c-muted:   #f8fafc;
  --c-icon-bg: #eff6ff;

  --c-primary:   #2563eb;
  --c-primary-d: #1d4ed8;
  --c-success:   #10b981;
  --c-success-d: #059669;
  --c-danger:    #ef4444;
  --c-warn:      #f59e0b;

  --c-head:   #0f172a;
  --c-body:   #475569;
  --c-mute:   #94a3b8;
  --c-link:   #2563eb;

  --c-border: #e2e8f0;
  --c-dash:   #93c5fd;

  --r-sm:  8px;
  --r-md:  12px;
  --r-lg:  16px;
  --r-xl:  20px;
  --r-pill:9999px;

  --sh-card:  0 4px 6px -1px rgba(0,0,0,.06), 0 2px 4px -1px rgba(0,0,0,.04);
  --sh-card-h:0 10px 25px -5px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
  --sh-btn:   0 1px 3px rgba(0,0,0,.12);

  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --t:    0.2s ease;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); background: var(--c-bg); color: var(--c-body); line-height: 1.6; min-height: 100vh; }
img  { max-width: 100%; height: auto; display: block; }
a    { color: var(--c-link); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }

/* ---------- Layout ---------- */
.wrap { width: 100%; max-width: 960px; margin: 0 auto; padding: 0 20px; }

/* ---------- Header ---------- */
.site-hdr {
  background: var(--c-white);
  border-bottom: 1px solid var(--c-border);
  padding: 14px 0;
  position: sticky; top: 0; z-index: 100;
}
.site-hdr__inner { display: flex; align-items: center; justify-content: space-between; }
.site-logo {
  font-size: 1.1rem; font-weight: 800; color: var(--c-head);
  display: flex; align-items: center; gap: 8px;
}
.site-logo svg { color: var(--c-primary); }
.site-nav a {
  font-size: .85rem; font-weight: 500; color: var(--c-body);
  margin-left: 22px; transition: color var(--t);
}
.site-nav a:hover, .site-nav a[aria-current] { color: var(--c-primary); text-decoration: none; }

/* ---------- Breadcrumb ---------- */
.bc { font-size: .83rem; color: var(--c-mute); margin-bottom: 20px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.bc a { color: var(--c-primary); font-weight: 500; }

/* ---------- Main ---------- */
.page-main { padding: 36px 0 60px; }

/* ---------- Hub Hero ---------- */
.hub-hero { text-align: center; margin-bottom: 36px; }
.hub-hero h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); font-weight: 800; color: var(--c-head); margin-bottom: 10px; }
.hub-hero p  { font-size: .95rem; color: var(--c-body); }

/* ---------- Tools Grid ---------- */
.tools-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; margin-bottom: 44px; }
.tool-card {
  background: var(--c-white); border-radius: var(--r-lg); box-shadow: var(--sh-card);
  padding: 30px 22px 26px; display: flex; flex-direction: column; align-items: center;
  text-align: center; transition: box-shadow var(--t), transform var(--t); border: 1px solid transparent;
}
.tool-card:hover { box-shadow: var(--sh-card-h); transform: translateY(-2px); border-color: var(--c-border); }
.tool-card__icon {
  width: 62px; height: 62px; border-radius: 50%; background: var(--c-icon-bg);
  display: flex; align-items: center; justify-content: center; margin-bottom: 18px; color: var(--c-primary);
}
.tool-card__title { font-size: 1.05rem; font-weight: 700; color: var(--c-head); margin-bottom: 10px; }
.tool-card__desc  { font-size: .85rem; color: var(--c-body); line-height: 1.65; margin-bottom: 22px; flex: 1; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-family: var(--font); font-size: .875rem; font-weight: 600;
  border-radius: var(--r-pill); padding: 10px 22px; border: 2px solid transparent;
  cursor: pointer; white-space: nowrap; line-height: 1; box-shadow: var(--sh-btn);
  transition: background var(--t), color var(--t), border-color var(--t),
              box-shadow var(--t), transform var(--t);
}
.btn:active { transform: scale(.97); }
.btn:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }

.btn--primary { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }
.btn--primary:hover { background: var(--c-primary-d); border-color: var(--c-primary-d); box-shadow: 0 4px 12px rgba(37,99,235,.35); }

.btn--success { background: var(--c-success); color: #fff; border-color: var(--c-success); }
.btn--success:hover { background: var(--c-success-d); border-color: var(--c-success-d); }

.btn--outline { background: transparent; color: var(--c-head); border-color: var(--c-border); box-shadow: none; }
.btn--outline:hover { border-color: #94a3b8; background: var(--c-muted); }

.btn--ghost-danger { background: transparent; color: var(--c-danger); border-color: var(--c-danger); box-shadow: none; }
.btn--ghost-danger:hover { background: #fef2f2; }

.btn--full { width: 100%; }

/* File card Download button */
.btn--dl {
  background: var(--c-success); color: #fff; border: 2px solid var(--c-success);
  border-radius: var(--r-pill); padding: 7px 16px; font-size: .8rem; font-weight: 600;
  display: inline-flex; align-items: center; gap: 5px; cursor: pointer; white-space: nowrap;
  transition: background var(--t);
}
.btn--dl:hover { background: var(--c-success-d); border-color: var(--c-success-d); }

/* Delete icon button */
.btn--icon-del {
  width: 34px; height: 34px; padding: 0; border-radius: var(--r-sm);
  background: transparent; border: 1px solid var(--c-border); color: var(--c-body);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background var(--t), color var(--t), border-color var(--t);
  box-shadow: none; font-size: 0;
}
.btn--icon-del:hover { background: #fef2f2; color: var(--c-danger); border-color: var(--c-danger); }

/* ---------- Tool Card Main ---------- */
.tool-main {
  background: var(--c-white); border-radius: var(--r-xl);
  box-shadow: var(--sh-card); padding: 38px 40px 34px; margin-bottom: 22px;
}
.tool-hdr { text-align: center; margin-bottom: 28px; }
.tool-hdr h1 { font-size: clamp(1.45rem, 3.5vw, 1.9rem); font-weight: 800; color: var(--c-head); margin-bottom: 8px; }
.tool-hdr p  { font-size: .9rem; color: var(--c-body); }

/* ---------- Upload Zone ---------- */
.drop-zone {
  border: 2px dashed var(--c-dash); border-radius: var(--r-lg);
  background: var(--c-zone); padding: 54px 28px; text-align: center;
  cursor: pointer; transition: border-color var(--t), background var(--t);
}
.drop-zone.is-dragover { border-color: var(--c-primary); background: #dbeafe; }
.drop-zone__icon {
  width: 70px; height: 70px; border-radius: 50%; background: rgba(37,99,235,.1);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 18px; color: var(--c-primary);
}
.drop-zone__title  { font-size: 1.15rem; font-weight: 700; color: var(--c-head); margin-bottom: 6px; }
.drop-zone__hint   { font-size: .85rem; color: var(--c-body); margin-bottom: 22px; }
.drop-zone__fmts   { font-size: .76rem; color: var(--c-mute); margin-top: 14px; }

/* ---------- Advanced Options ---------- */
.adv-wrap { margin-top: 18px; }
.adv-trigger {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; background: var(--c-muted); border: 1px solid var(--c-border);
  border-radius: var(--r-md); padding: 11px 16px; cursor: pointer;
  font-family: var(--font); font-size: .85rem; font-weight: 700; color: var(--c-head);
  user-select: none; transition: background var(--t), border-color var(--t), border-radius var(--t);
}
.adv-trigger:hover { background: #f1f5f9; border-color: #cbd5e1; }
.adv-trigger__left { display: flex; align-items: center; gap: 8px; }
.adv-trigger__ico  {
  width: 26px; height: 26px; border-radius: 50%; background: var(--c-icon-bg);
  display: flex; align-items: center; justify-content: center; color: var(--c-primary);
  transition: background var(--t), color var(--t);
}
.adv-trigger__right { display: flex; align-items: center; gap: 9px; }
.adv-badge {
  font-size: .68rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: 3px 9px; border-radius: var(--r-pill);
  background: #dbeafe; color: var(--c-primary);
  transition: background var(--t), color var(--t);
}
.adv-chevron { color: var(--c-mute); transition: transform .3s ease, color var(--t); }
.adv-wrap.is-open .adv-trigger { background: #eff6ff; border-color: var(--c-dash); border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.adv-wrap.is-open .adv-trigger__ico { background: var(--c-primary); color: #fff; }
.adv-wrap.is-open .adv-badge { background: var(--c-primary); color: #fff; }
.adv-wrap.is-open .adv-chevron { transform: rotate(180deg); color: var(--c-primary); }

.adv-body {
  max-height: 0; overflow: hidden;
  transition: max-height .35s ease, padding .35s ease;
  background: var(--c-muted); border: 1px solid var(--c-dash);
  border-top: none; border-radius: 0 0 var(--r-md) var(--r-md); padding: 0 16px;
}
.adv-wrap.is-open .adv-body { max-height: 300px; padding: 16px; }
.adv-body__row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.adv-body label { font-size: .8rem; font-weight: 600; color: var(--c-body); white-space: nowrap; }
.adv-body select {
  font-family: var(--font); font-size: .8rem; border: 1px solid var(--c-border);
  border-radius: var(--r-sm); padding: 6px 10px; background: white;
  color: var(--c-head); cursor: pointer;
}
.adv-body select:focus { outline: 2px solid var(--c-primary); }
.adv-hint { font-size: .74rem; color: var(--c-mute); margin-top: 8px; line-height: 1.5; }

/* ---------- Queue ---------- */
.queue-hdr {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; flex-wrap: wrap; gap: 10px;
}
.queue-title { font-size: 1rem; font-weight: 700; color: var(--c-head); }
.queue-stats { font-size: .85rem; font-weight: 500; color: var(--c-mute); margin-left: 7px; }
.queue-acts  { display: flex; gap: 9px; flex-wrap: wrap; }
.file-list   { display: flex; flex-direction: column; gap: 11px; margin-bottom: 4px; }
.queue-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 18px; flex-wrap: wrap; gap: 9px;
}

/* ---------- File Card ---------- */
.fc {
  display: flex; align-items: center; gap: 13px;
  background: var(--c-white); border: 1px solid var(--c-border);
  border-radius: var(--r-md); padding: 13px 14px;
  transition: box-shadow var(--t);
}
.fc:hover { box-shadow: 0 2px 8px rgba(0,0,0,.06); }

.fc__thumb {
  width: 54px; height: 54px; border-radius: var(--r-sm);
  object-fit: cover; flex-shrink: 0; border: 1px solid var(--c-border);
}
.fc__thumb-ph {
  width: 54px; height: 54px; border-radius: var(--r-sm); flex-shrink: 0;
  background: var(--c-muted); border: 1px solid var(--c-border);
  display: flex; align-items: center; justify-content: center; color: var(--c-mute);
}

.fc__body { flex: 1; min-width: 0; }
.fc__name {
  font-size: .85rem; font-weight: 600; color: var(--c-head);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 2px;
}
.fc__meta  { font-size: .75rem; color: var(--c-mute); margin-bottom: 7px; }
.fc__saved { color: var(--c-success); font-weight: 600; }

.fc__bar-wrap { height: 5px; background: var(--c-border); border-radius: var(--r-pill); overflow: hidden; margin-bottom: 5px; }
.fc__bar      { height: 100%; background: var(--c-primary); border-radius: var(--r-pill); width: 0; transition: width .4s ease; }
.fc__bar--done  { background: var(--c-success); }
.fc__bar--error { background: var(--c-danger); }

.fc__status { font-size: .74rem; font-weight: 600; display: flex; align-items: center; gap: 4px; }
.fc__status--pending    { color: var(--c-mute); }
.fc__status--processing { color: var(--c-primary); }
.fc__status--done       { color: var(--c-success); }
.fc__status--error      { color: var(--c-danger); }

.fc__actions { display: flex; align-items: center; gap: 7px; flex-shrink: 0; }

/* ---------- Info / SEO Sections ---------- */
.info-box {
  background: var(--c-white); border-radius: var(--r-lg);
  box-shadow: var(--sh-card); padding: 34px 40px; margin-bottom: 22px;
}
.info-box h2 { font-size: 1.2rem; font-weight: 700; color: var(--c-head); margin-bottom: 13px; }
.info-box p  { font-size: .88rem; color: var(--c-body); line-height: 1.75; margin-bottom: 11px; }
.info-box p:last-child { margin-bottom: 0; }

.feat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-top: 14px; }
.feat-item { display: flex; align-items: flex-start; gap: 11px; padding: 14px; background: var(--c-muted); border-radius: var(--r-md); border: 1px solid var(--c-border); }
.feat-item__ico { width: 34px; height: 34px; border-radius: 50%; background: var(--c-icon-bg); display: flex; align-items: center; justify-content: center; color: var(--c-primary); flex-shrink: 0; }
.feat-item__txt h3 { font-size: .84rem; font-weight: 700; color: var(--c-head); margin-bottom: 3px; }
.feat-item__txt p  { font-size: .76rem; color: var(--c-body); margin-bottom: 0; line-height: 1.6; }

/* ---------- FAQ ---------- */
.faq-list { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.faq-item { background: var(--c-muted); border: 1px solid var(--c-border); border-radius: var(--r-md); overflow: hidden; }
.faq-q {
  font-size: .88rem; font-weight: 700; color: var(--c-head); padding: 15px 18px;
  cursor: pointer; display: flex; align-items: center; justify-content: space-between;
  user-select: none; width: 100%; border: none; background: transparent;
  font-family: var(--font); transition: background var(--t); text-align: left;
}
.faq-q:hover { background: #f1f5f9; }
.faq-q svg   { transition: transform var(--t); flex-shrink: 0; }
.faq-item.is-open .faq-q svg { transform: rotate(180deg); }
.faq-a {
  font-size: .85rem; color: var(--c-body); line-height: 1.75;
  padding: 0 18px; max-height: 0; overflow: hidden;
  transition: max-height .3s ease, padding .3s ease;
}
.faq-item.is-open .faq-a { max-height: 400px; padding: 0 18px 16px; }

/* ---------- Related Tools ---------- */
.related-box { background: var(--c-white); border-radius: var(--r-lg); box-shadow: var(--sh-card); padding: 24px 40px; margin-bottom: 22px; }
.related-box h2 { font-size: .95rem; font-weight: 700; color: var(--c-head); margin-bottom: 12px; }
.related-links { display: flex; flex-wrap: wrap; gap: 9px; }
.related-link {
  display: inline-flex; align-items: center; gap: 5px; font-size: .78rem; font-weight: 600;
  color: var(--c-primary); background: var(--c-zone); border: 1px solid #bfdbfe;
  border-radius: var(--r-pill); padding: 5px 13px;
  transition: background var(--t), color var(--t), border-color var(--t);
}
.related-link:hover { background: var(--c-primary); color: #fff; border-color: var(--c-primary); text-decoration: none; }

/* ---------- PDF Mode Toggle ---------- */
.mode-toggle { display: flex; gap: 8px; margin-bottom: 18px; background: var(--c-muted); border: 1px solid var(--c-border); border-radius: var(--r-md); padding: 5px; }
.mode-btn { flex: 1; padding: 9px 14px; border-radius: var(--r-sm); font-family: var(--font); font-size: .83rem; font-weight: 600; cursor: pointer; border: none; background: transparent; color: var(--c-body); transition: background var(--t), color var(--t); }
.mode-btn.active { background: var(--c-white); color: var(--c-primary); box-shadow: var(--sh-btn); }

/* ---------- Combined Mode ---------- */
.combined-info { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: var(--r-md); padding: 13px 16px; font-size: .85rem; color: #1e40af; margin-bottom: 14px; }
.combined-list { display: flex; flex-direction: column; gap: 7px; margin: 14px 0; max-height: 260px; overflow-y: auto; }
.cf-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; background: var(--c-muted); border: 1px solid var(--c-border); border-radius: var(--r-sm); }
.cf-row img  { width: 34px; height: 34px; object-fit: cover; border-radius: 4px; border: 1px solid var(--c-border); flex-shrink: 0; }
.cf-name { flex: 1; font-size: .83rem; font-weight: 600; color: var(--c-head); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cf-size { font-size: .73rem; color: var(--c-mute); white-space: nowrap; }
.cf-del  { background: none; border: none; cursor: pointer; color: var(--c-danger); font-size: 1.1rem; line-height: 1; padding: 2px 4px; }
.combined-acts { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.combined-status { font-size: .83rem; color: var(--c-mute); margin-top: 10px; text-align: center; }

/* ---------- Site Footer ---------- */
.site-ftr { background: var(--c-white); border-top: 1px solid var(--c-border); padding: 24px 0; text-align: center; }
.site-ftr p { font-size: .78rem; color: var(--c-mute); }
.site-ftr a { color: var(--c-primary); font-weight: 500; }

/* ---------- Toast ---------- */
.wt-toast-wrap { position: fixed; bottom: 22px; right: 22px; z-index: 9999; display: flex; flex-direction: column; gap: 9px; }
.wt-toast {
  background: var(--c-head); color: #fff; font-size: .83rem; font-weight: 500;
  padding: 11px 18px; border-radius: var(--r-md); box-shadow: 0 4px 20px rgba(0,0,0,.2);
  opacity: 0; transform: translateY(10px); transition: opacity .3s ease, transform .3s ease; max-width: 300px;
}
.wt-toast--show   { opacity: 1; transform: translateY(0); }
.wt-toast--success { background: var(--c-success); }
.wt-toast--error   { background: var(--c-danger); }

/* ---------- Animations ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 1s linear infinite; display: inline-block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.fade-in { animation: fadeIn .3s ease forwards; }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .tools-grid  { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .tool-main   { padding: 22px 18px; }
  .info-box    { padding: 22px 18px; }
  .related-box { padding: 18px; }
  .drop-zone   { padding: 36px 18px; }
  .queue-hdr   { flex-direction: column; align-items: flex-start; }
  .fc          { flex-wrap: wrap; }
  .fc__actions { width: 100%; justify-content: flex-end; }
}
@media (max-width: 480px) {
  .tools-grid { grid-template-columns: 1fr; }
  .tool-hdr h1 { font-size: 1.35rem; }
  .queue-acts  { width: 100%; }
  .queue-acts .btn { flex: 1; justify-content: center; }
  .queue-footer { flex-direction: column; }
}


/* ==========================================================================
   FIX: Mobile Navigation Bridge Styles
   ========================================================================== */

/* Ensure the main mobile drawer can slide into view and sits on top of tools */
.mobile-menu-drawer {
    position: fixed;
    top: 60px; /* Adjust based on your header height */
    left: 0;
    width: 100%;
    height: calc(100vh - 60px);
    background: var(--c-white);
    z-index: 99999; /* Must be higher than tool layers */
    transform: translateX(-100%);
    transition: transform var(--t);
    overflow-y: auto;
    display: block !important; /* Override template defaults */
}

/* Slide drawer in when active */
.mobile-menu-drawer.is-open {
    transform: translateX(0);
}

/* Ensure sub-dropdown wrappers default to hidden status */
.mobile-dropdown-menu {
    display: none;
    list-style: none;
}

/* Reveal sub-dropdown lists when clicked */
.mobile-dropdown-menu.is-visible {
    display: block !important;
}

/* Prevent layout breaking collisions inside the mobile grid links */
.mobile-grid-card {
    display: flex;
    align-items: center;
    text-decoration: none !important;
}
