/* =========================================================
   Olutil Image Tools — shared stylesheet
   Common UI shell: topbar, layout, panels, dropzone,
   seo-content, modal, footer, ad-slot.
   Tool pages add a small inline <style> for tool-specific bits.
   ========================================================= */
*{box-sizing:border-box;}
html,body{height:100%;}
body{
  margin:0;display:flex;flex-direction:column;min-height:100vh;
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
  background:#eef1f7;color:#1f2430;-webkit-font-smoothing:antialiased;
}
:root{--page-w:1200px;--gutter:10px;}

/* ===== Top bar — sticky ===== */
.topbar{
  position:sticky;top:0;z-index:100;
  display:flex;align-items:center;gap:10px;flex-wrap:wrap;
  padding:10px 16px;background:#fff;border-bottom:1px solid #e4e8f0;
  box-shadow:0 1px 4px rgba(20,30,60,.05);
}
.topbar a{color:#3b82f6;text-decoration:none;font-size:13px;font-weight:600;}
.topbar a:hover{text-decoration:underline;}
.topbar .divider{color:#d7deea;font-size:13px;}
.topbar .brand-name{font-weight:700;font-size:15px;color:#1f2430;letter-spacing:.3px;}
.topbar .brand-name span{color:#3b82f6;}
.spacer{flex:1;}

/* ===== Buttons ===== */
.btn{
  border:1px solid #dde3ee;background:#fff;color:#39435a;
  padding:7px 12px;border-radius:9px;font-size:13px;cursor:pointer;
  transition:.15s;font-family:inherit;
}
.btn:hover:not(:disabled){background:#f4f7fd;border-color:#c3cee3;}
.btn:active:not(:disabled){transform:translateY(1px);}
.btn:disabled{opacity:.4;cursor:not-allowed;}
.btn.primary{background:#3b82f6;border-color:#3b82f6;color:#fff;}
.btn.primary:hover:not(:disabled){background:#2f74e6;border-color:#2f74e6;}
.btn.help{background:#fff7ed;border-color:#fed7aa;color:#c2410c;font-weight:600;}
.btn.help:hover{background:#ffedd5;border-color:#fdba74;}
.btn.block{display:block;width:100%;margin-top:6px;text-align:center;}

/* ===== App layout ===== */
.container{
  flex:1;display:flex;flex-direction:column;gap:10px;
  padding:var(--gutter);
  max-width:calc(var(--page-w) + var(--gutter) * 2);
  width:100%;margin:0 auto;
}
.main{flex:1;display:flex;min-height:0;gap:10px;}
.center{flex:1;min-width:0;display:flex;flex-direction:column;gap:8px;}
.panel{
  background:#fff;border-radius:14px;padding:12px;
  box-shadow:0 2px 12px rgba(20,30,60,.06);
  overflow-y:auto;flex:none;
}
.panel.left{width:250px;}
.panel.right{width:250px;}
.panel::-webkit-scrollbar{width:8px;}
.panel::-webkit-scrollbar-thumb{background:#d7deea;border-radius:8px;}
.group{margin-bottom:16px;}
.group:last-child{margin-bottom:4px;}
h3.section-label{
  font-size:11px;text-transform:uppercase;letter-spacing:1px;
  color:#8b93a7;margin:0 0 8px;font-weight:700;
}

/* ===== Stage (canvas area) ===== */
.stage{
  flex:1;min-height:0;background:#fff;border-radius:14px;
  box-shadow:0 2px 12px rgba(20,30,60,.06);
  overflow:auto;padding:20px;display:flex;
}
.view{margin:auto;display:flex;align-items:center;justify-content:center;}
.view[hidden]{display:none;}
.placeholder{
  color:#b6bdcd;font-size:14px;text-align:center;
  line-height:2;user-select:none;padding:40px;
}
.placeholder b{display:block;font-size:34px;margin-bottom:8px;opacity:.55;}

/* ===== Dropzone / upload ===== */
.dropzone{
  border:2px dashed #cdd7e8;border-radius:12px;
  padding:18px 10px;text-align:center;cursor:pointer;
  transition:.18s;background:#fafcff;
}
.dropzone:hover,.dropzone.over{border-color:#3b82f6;background:#f0f6ff;}
.dz-icon{font-size:24px;line-height:1;}
.dz-text{font-size:13px;color:#39435a;margin-top:6px;font-weight:600;}
.dz-sub{font-size:11px;color:#a8b0c2;margin-top:3px;}
.thumb-wrap{margin-top:10px;text-align:center;}
.thumb-wrap img{
  max-width:100%;max-height:110px;border-radius:9px;
  box-shadow:0 2px 10px rgba(20,30,60,.13);display:block;margin:0 auto;
}
.thumb-info{font-size:11px;color:#8b93a7;margin-top:5px;}

/* ===== Form controls ===== */
.size-row{display:flex;align-items:center;gap:6px;}
.size-row input{
  width:100%;min-width:0;padding:7px 4px;text-align:center;
  border:1px solid #dde3ee;border-radius:8px;font-size:13px;
  font-family:inherit;color:#1f2430;background:#fff;
}
.size-row input:focus{outline:none;border-color:#3b82f6;box-shadow:0 0 0 3px rgba(59,130,246,.12);}
.size-row span{color:#a8b0c2;font-size:13px;}
.presets{display:flex;flex-wrap:wrap;gap:5px;margin-top:9px;}
.presets button{
  border:1px solid #dde3ee;background:#fff;border-radius:20px;
  padding:3px 11px;font-size:11px;cursor:pointer;color:#5a6580;font-family:inherit;
}
.presets button:hover{background:#f4f7fd;border-color:#c3cee3;}
.chk{display:flex;align-items:center;gap:7px;font-size:13px;padding:5px 0;cursor:pointer;color:#39435a;}
.chk input{accent-color:#3b82f6;width:15px;height:15px;cursor:pointer;}
input[type=range]{width:100%;accent-color:#3b82f6;cursor:pointer;margin:2px 0 0;}
.zoom-label{font-size:11px;color:#8b93a7;text-align:center;margin-top:2px;}
.slabel{font-size:12px;color:#5a6580;display:flex;justify-content:space-between;margin-top:10px;}
.slabel b{color:#3b82f6;font-variant-numeric:tabular-nums;}
.hint{font-size:11px;color:#a8b0c2;line-height:1.7;margin-top:6px;}
.hint b{color:#f4511e;font-weight:600;}

/* ===== SEO content ===== */
.seo-content{
  max-width:var(--page-w);margin:0 auto;width:100%;
  background:#fff;border-radius:14px;padding:28px 32px;
  box-shadow:0 2px 12px rgba(20,30,60,.06);
  font-size:14px;line-height:1.85;color:#39435a;
}
.seo-content h2{
  font-size:20px;font-weight:700;color:#1f2430;
  margin:36px 0 14px;padding-bottom:9px;border-bottom:2px solid #eef1f7;
}
.seo-content h2:first-child{margin-top:0;}
.seo-content h3{font-size:15.5px;font-weight:700;color:#33405c;margin:22px 0 8px;}
.seo-content p{margin:10px 0;}
.seo-content ul,.seo-content ol{margin:10px 0;padding-left:22px;}
.seo-content li{margin:6px 0;}
.seo-content strong{color:#1f2430;}
.seo-content a{color:#3b82f6;text-decoration:none;}
.seo-content a:hover{text-decoration:underline;}
.seo-content code{
  background:#f1f4f9;border:1px solid #e4e9f2;border-radius:5px;
  padding:1px 6px;font-size:12.5px;
  font-family:ui-monospace,SFMono-Regular,Menlo,monospace;color:#c2410c;
}
.privacy-badge{display:inline-block;background:#ecfdf5;color:#065f46;font-size:12px;padding:2px 10px;border-radius:12px;font-weight:500;margin-left:8px;vertical-align:middle}
.related-grid{
  display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));
  gap:10px;margin:14px 0;list-style:none;padding:0;
}
.related-grid li{margin:0;}
.related-grid a{
  display:block;padding:12px 14px;background:#f7fafd;
  border:1px solid #e8edf5;border-radius:10px;
  font-weight:600;font-size:13.5px;transition:.15s;
}
.related-grid a:hover{background:#eef4ff;border-color:#c3d6f5;text-decoration:none;}
.related-grid a span{display:block;font-weight:400;font-size:12px;color:#8b93a7;margin-top:3px;}

/* ===== Ad placeholder ===== */
.ad-slot{min-height:15px;margin-top:40px;margin-bottom:32px}

/* ===== Footer ===== */
footer{margin-top:40px;padding-top:20px;border-top:1px solid #e4e8f0;color:#8b93a7;font-size:13px;text-align:center}
footer a{color:#3b82f6;text-decoration:none;font-weight:600}
footer a:hover{text-decoration:underline}

/* ===== Brand header (on index pages) ===== */
.brand-header{font-size:14px;margin-bottom:10px;color:#5a6580;}
.brand-header a{color:#3b82f6;text-decoration:none;font-weight:700;}
.brand-header .brand-desc{color:#8b93a7;}

/* ===== Tool grid (index pages) ===== */
.tool-grid{
  display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));
  gap:12px;margin:20px 0;list-style:none;padding:0;
}
.tool-grid li{margin:0;}
.tool-card{
  display:block;padding:16px 18px;background:#fff;
  border:1px solid #e4e8f0;border-radius:12px;
  text-decoration:none;color:#1f2430;
  box-shadow:0 2px 8px rgba(20,30,60,.05);transition:.15s;
}
.tool-card:hover{background:#f4f7fd;border-color:#c3cee3;transform:translateY(-2px);box-shadow:0 6px 18px rgba(20,30,60,.1);}
.tool-card h3{margin:0 0 5px;font-size:15px;}
.tool-card p{margin:0;font-size:12.5px;color:#8b93a7;line-height:1.5;}

/* ===== Modal (help overlay) ===== */
.modal-overlay{
  position:fixed;inset:0;z-index:1000;
  background:rgba(20,28,48,.48);
  -webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px);
  display:flex;align-items:center;justify-content:center;
  padding:24px;opacity:0;pointer-events:none;transition:opacity .2s;
}
.modal-overlay.show{opacity:1;pointer-events:auto;}
.modal{
  background:#fff;border-radius:18px;width:min(680px,100%);max-height:86vh;
  display:flex;flex-direction:column;
  box-shadow:0 24px 70px rgba(15,25,50,.35);
  transform:translateY(14px) scale(.98);
  transition:transform .22s cubic-bezier(.2,.9,.3,1);
}
.modal-overlay.show .modal{transform:translateY(0) scale(1);}
.modal-header{
  display:flex;align-items:center;gap:10px;
  padding:18px 22px 14px;border-bottom:1px solid #eef1f7;flex:none;
}
.modal-header .mh-icon{font-size:22px;line-height:1;}
.modal-header h2{margin:0;font-size:17px;font-weight:700;letter-spacing:.3px;}
.modal-header .mh-sub{font-size:12px;color:#8b93a7;margin-top:2px;}
.modal-close{
  margin-left:auto;width:32px;height:32px;flex:none;
  border:none;background:#f1f4f9;border-radius:9px;
  font-size:17px;color:#5a6580;cursor:pointer;
  display:flex;align-items:center;justify-content:center;transition:.15s;font-family:inherit;line-height:1;
}
.modal-close:hover{background:#e4e9f2;color:#1f2430;}
.modal-body{padding:6px 22px 24px;overflow-y:auto;scrollbar-width:thin;}
.modal-body::-webkit-scrollbar{width:9px;}
.modal-body::-webkit-scrollbar-thumb{background:#d7deea;border-radius:9px;}
.modal-body h3{font-size:15px;font-weight:700;color:#1f2430;margin:18px 0 8px;}
.modal-body h3:first-child{margin-top:0;}
.modal-body p,.modal-body ul,.modal-body ol{margin:8px 0;font-size:13.5px;line-height:1.7;color:#39435a;}
.modal-body ul,.modal-body ol{padding-left:22px;}
.modal-body li{margin:5px 0;}
.modal-body b{color:#1f2430;}

/* ===== Responsive ===== */
@media(max-width:1020px){
  .main{flex-direction:column;}
  .panel.left,.panel.right{width:100%;}
  .stage{min-height:48vh;}
  .seo-content{padding:20px 18px;}
}
@media(max-width:640px){
  .topbar{padding:8px 12px;}
  .topbar .brand-name{font-size:14px;}
  .modal-overlay{padding:10px;}
  .modal{max-height:92vh;border-radius:14px;}
  .modal-header{padding:14px 16px 12px;}
  .modal-body{padding:4px 16px 20px;}
}

/* ===== Language dropdown (top-right switcher) ===== */
.lang-dropdown{position:relative;}
.lang-dropdown summary{list-style:none;cursor:pointer;font-size:13px;font-weight:600;color:#39435a;background:#fff;border:1px solid #dde3ee;border-radius:9px;padding:7px 12px;display:inline-flex;align-items:center;gap:6px;}
.lang-dropdown summary::-webkit-details-marker{display:none;}
.lang-dropdown summary::after{content:'\25BE';font-size:10px;color:#8b93a7;margin-left:2px;}
.lang-menu{position:absolute;right:0;top:calc(100% + 6px);background:#fff;border:1px solid #e4e8f0;border-radius:9px;box-shadow:0 6px 18px rgba(20,30,60,.12);overflow:hidden;min-width:140px;z-index:200;display:flex;flex-direction:column;}
.lang-menu a{display:block;padding:9px 14px;color:#39435a;text-decoration:none;font-size:13px;font-weight:500;}
.lang-menu a:hover{background:#f4f7fd;color:#3b82f6;}
.lang-menu a[aria-current="true"]{background:#eef4ff;color:#2563eb;font-weight:700;}
