/* =========================================
   Image Workshop — Modern UI Refresh
   (Drop-in replacement)
   ========================================= */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;700&family=Source+Sans+3:wght@400;600;700&display=swap');

/* ---------- Design tokens ---------- */
:root{
  /* Neutral base */
  --background: oklch(0.99 0 0);
  --foreground: oklch(0.21 0 0);
  --muted: oklch(0.94 0 0);
  --muted-foreground: rgb(40, 20, 40);
  --muted-footer: rgb(240, 240, 240);

  /* Card & borders */
  --card: oklch(1 0 0);
  --card-contrast: oklch(0.985 0 0);
  --border: oklch(0.88 0 0 / 0.9);
  --ring: oklch(0.70 0.05 250);

  /* Brand accent (calm indigo) */
  --accent: oklch(0.64 0.13 275);
  --accent-strong: oklch(0.58 0.15 275);
  --accent-weak: oklch(0.93 0.05 275);
  --secondary: oklch(0.88 0.05 265);
  --secondary-foreground: oklch(0.22 0.02 265);

  /* Buttons */
  --primary: var(--accent);
  --primary-foreground: oklch(0.985 0 0);
  --ghost: transparent;
  --ghost-border: oklch(0.86 0 0);
  --ghost-foreground: var(--foreground);

  /* Status */
  --success: oklch(0.78 0.12 145);
  --warning: oklch(0.88 0.12 85);
  --danger: oklch(0.64 0.16 25);

  /* Fonts & radii */
  --font-sans: 'Source Sans 3', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --font-serif: 'Playfair Display', Georgia, serif;
  --radius: 8px;
  --radius-sm: 6px;
  --radius-xs: 4px;

  /* Shadows */
  --shadow-1: 0 1px 2px rgba(0,0,0,0.04), 0 6px 24px rgba(0,0,0,0.06);
  --shadow-2: 0 3px 6px rgba(0,0,0,0.07), 0 14px 32px rgba(0,0,0,0.08);

  /* Motion */
  --easing: cubic-bezier(.2,.7,.3,1);
  --fast: 160ms;
  --slow: 280ms;
}

@media (prefers-color-scheme: dark){
  :root{
    --background: oklch(0.15 0 0);
    --foreground: oklch(0.98 0 0);
    --muted: oklch(0.22 0 0);
    --muted-foreground: oklch(0.80 0 0);
    --muted-footer: rgb(240, 240, 240);    

    --card: oklch(0.18 0 0);
    --card-contrast: oklch(0.22 0 0);
    --border: oklch(0.30 0 0 / 1);
    --ring: oklch(0.75 0.10 275);

    --ghost-border: oklch(0.32 0 0);
    --shadow-1: 0 1px 2px rgba(0,0,0,0.35), 0 10px 30px rgba(0,0,0,0.45);
    --shadow-2: 0 6px 12px rgba(0,0,0,0.35), 0 18px 40px rgba(0,0,0,0.55);
  }
}

/* ---------- Base ---------- */
*{box-sizing:border-box}
html,body{height:100%}

body {
    font-family: var(--font-sans);
    margin: 0;
    background-color: var(--background);
    color: var(--foreground);
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-sans);
}

#app {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

#editor {
    flex: 2;
}

#sidebar {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#functions {
    display: flex;
    gap: 20px;
    flex: 1;
}

#sub-functions,
#main-functions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#sub-functions {
    flex: 1;
}

#sub-functions.hidden {
    display: none;
}

#main-functions {
    align-items: flex-end;
    margin-left: auto;
}

#drop-zone {
    border: 2px dashed var(--border);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    margin-bottom: 10px;
}

#drop-zone.hover {
    background-color: var(--card);
}

canvas {
    max-width: 100%;
    border: 1px solid var(--border);
    margin-top: 10px;
}

#filter-controls {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.hidden {
    display: none;
}

.sub-btn {
    padding: 8px;
    width: 100%;
}

.export-formats {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sub-btn.active {
    background-color: var(--primary);
    color: var(--primary-foreground);
}

#main-functions button {
    padding: 8px;
    width: 100%;
}

#upgrade {
    margin-top: auto;
}

.button {
    display: inline-block;
    padding: 10px 20px;
    background-color: var(--primary);
    color: var(--primary-foreground);
    text-decoration: none;
    text-align: center;
    border-radius: var(--radius-sm);
    border: none;
    font-family: var(--font-sans);
}

.button.outline {
    background-color: transparent;
    color: var(--foreground);
    border: 1px solid var(--border);
}

.badge {
    display: inline-block;
    padding: 4px 8px;
    background-color: var(--secondary);
    color: var(--secondary-foreground);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-family: var(--font-sans);
}

#filter-controls .filter {
    display: flex;
    align-items: center;
    margin: 5px 0;
    position: relative;
}

.feature-lock {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    cursor: not-allowed;
    background-color: rgba(255, 255, 255, 0.6);
    z-index: 1;
}

#filter-controls .filter label {
    width: 100px;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    background-color: var(--card);
    padding: 10px 20px;
    margin-bottom: 20px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.logo-icon {
    width: 40px;
    height: 40px;
}

.site-title {
    margin: 0;
    font-size: 1.5rem;
}

.tagline {
    margin: 0;
    font-size: 0.875rem;
}

.workshop-texture {
    background-image: radial-gradient(circle at 1px 1px, oklch(0.205 0 0 / 0.05) 1px, transparent 0);
    background-size: 20px 20px;
}

body{
  margin:0;
  background: radial-gradient(1200px 800px at 5% -10%, var(--accent-weak), transparent 35%) var(--background);
  color:var(--foreground);
  font-family:var(--font-sans);
  letter-spacing:.01em;
}

/* Subtle dotted workbench background */
body::before{
  content:"";
  position:fixed; inset:0;
  background:
    radial-gradient(circle at 1px 1px, oklch(0 0 0 / .05) 1px, transparent 1.5px) 0 0/20px 20px;
  pointer-events:none;
  opacity:.6;
}

/* ---------- Header ---------- */
.app-header{
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 20px;
  background:linear-gradient(180deg, var(--card), var(--card-contrast));
  border:1px solid var(--border);
  border-radius:var(--radius-sm);
  box-shadow:var(--shadow-1);
  margin-bottom:24px;
}

.logo{display:flex; gap:12px; align-items:center}
.logo-icon{width:40px;height:40px;border-radius:10px;background:var(--accent);box-shadow:inset 0 -10px 20px oklch(0 0 0 / .15)}
.site-title{font-family:var(--font-sans); font-size:1.6rem; margin:0}
.tagline{margin:0; color:var(--muted-foreground); font-size:.9rem}
.header-actions{display:flex; gap:10px; align-items:center}

footer .global-footer__main,
footer .global-footer__description { color:var(--muted-footer); }

/* ---------- Layout ---------- */
#app{
  display:grid;
  grid-template-columns: minmax(0,2fr) minmax(280px,1fr);
  gap:22px;
  align-items:start;
}

#editor, #sidebar{
  background:linear-gradient(180deg, var(--card), var(--card-contrast));
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:var(--shadow-1);
  padding:18px;
}

/* ---------- Editor area ---------- */
#drop-zone{
  border:2px dashed var(--ghost-border);
  border-radius:var(--radius);
  padding:26px;
  text-align:center;
  cursor:pointer;
  transition:border-color var(--fast) var(--easing), background var(--fast) var(--easing), transform var(--fast) var(--easing);
  background: oklch(1 0 0 / .6);
}

#drop-zone:hover{border-color:var(--accent)}
#drop-zone.hover{
  background:var(--accent-weak);
  transform: translateY(-1px);
}

canvas{
  width:100%; max-width:100%;
  border-radius:var(--radius-sm);
  margin-top:14px;
  border:1px solid var(--border);
  box-shadow: var(--shadow-1);
  background: oklch(1 0 0);
}

/* ---------- Sidebar stacks ---------- */
#sidebar{display:flex; gap:20px; flex-direction:column}

.panel{
  border:1px solid var(--border);
  border-radius:var(--radius-sm);
  padding:14px;
  background:var(--card);
  box-shadow:var(--shadow-1);
}

.panel h3{
  margin:0 0 10px;
  font-family:var(--font-sans);
  font-size:1.05rem;
}

/* ---------- Form fields ---------- */
.input{
  width:100%;
  padding:10px 14px;
  border:1px solid var(--border);
  border-radius:var(--radius-xs);
  background:var(--card);
  color:var(--foreground);
}

/* ---------- Segmented control (Formats) ---------- */
.segmented{
  display:flex;
  background:var(--muted);
  border:1px solid var(--border);
  border-radius:999px;
  padding:4px;
  gap:4px;
}

.segmented .seg{
  flex:1;
  min-width:64px;
  text-align:center;
  padding:8px 10px;
  border-radius:999px;
  border:0;
  background:transparent;
  color:var(--foreground);
  font-weight:600;
  cursor:pointer;
  transition: background var(--fast) var(--easing), color var(--fast) var(--easing), transform var(--fast) var(--easing);
}

.segmented .seg:hover{background: oklch(1 0 0)}
.segmented .seg:active{transform: translateY(1px)}
.segmented .seg.active{
  background:var(--primary);
  color:var(--primary-foreground);
  box-shadow: 0 0 0 2px oklch(1 0 0 / .6) inset;
}

/* ---------- Buttons ---------- */
button, .button, .btn{
  display:inline-flex; align-items:center; justify-content:center;
  gap:8px;
  border-radius:999px;
  padding:10px 16px;
  border:1px solid transparent;
  font-weight:700;
  text-decoration:none;
  cursor:pointer;
  transition: background var(--fast) var(--easing), color var(--fast) var(--easing), box-shadow var(--fast) var(--easing), transform var(--fast) var(--easing), border-color var(--fast) var(--easing);
  user-select:none;
}

.btn-primary{background:var(--primary); color:var(--primary-foreground); box-shadow:var(--shadow-1)}
.btn-primary:hover{background:var(--accent-strong)}
.btn-primary:active{transform: translateY(1px)}

.btn-ghost{background:var(--ghost); color:var(--ghost-foreground); border-color:var(--ghost-border)}
.btn-ghost:hover{background:var(--muted)}
.btn-ghost:active{transform: translateY(1px)}

.btn-danger{background:var(--danger); color:white}
.btn-success{background:var(--success); color:white}

.sub-btn,
#main-functions button{
  width:100%;
  margin:0;
}

/* Upgrade CTA pinned to end */
#upgrade{margin-top:auto}

/* ---------- Badges ---------- */
.badge{
  display:inline-flex; align-items:center; gap:6px;
  padding:4px 10px;
  border-radius:999px;
  background:var(--accent-weak);
  color:var(--accent-strong);
  border:1px solid var(--border);
  font-weight:600;
  font-size:.78rem;
}

/* ---------- Filters & Locks ---------- */
#filter-controls{display:flex; flex-direction:column; gap:10px}
#filter-controls .filter{display:flex; align-items:center; gap:12px; position:relative}
#filter-controls .filter label{min-width:110px; color:var(--muted-foreground)}
.feature-lock{
  position:absolute; inset:-2px;
  cursor:not-allowed;
  background: linear-gradient(180deg, oklch(1 0 0 / .35), oklch(1 0 0 / .15));
  border:1px dashed var(--ghost-border);
  border-radius:var(--radius-xs);
  backdrop-filter: blur(2px);
  z-index:2;
}

/* ---------- Range / Slider ---------- */
input[type="range"]{
  -webkit-appearance:none; appearance:none;
  height:6px;
  background:linear-gradient(90deg, var(--accent) 0, var(--accent) var(--_pos,50%), var(--muted) var(--_pos,50%));
  border-radius:999px;
  outline:none;
  border:1px solid var(--border);
}
input[type="range"]::-webkit-slider-thumb{
  -webkit-appearance:none; appearance:none;
  width:18px; height:18px; border-radius:50%;
  background: white; border:2px solid var(--accent);
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
  transition: transform var(--fast) var(--easing);
}
input[type="range"]::-webkit-slider-thumb:active{transform: scale(0.98)}
/* Firefox */
input[type="range"]::-moz-range-thumb{
  width:18px;height:18px;border-radius:50%; background:white; border:2px solid var(--accent)
}

/* ---------- Focus states ---------- */
:where(a,button,.btn,.seg){
  outline:none;
}
:where(a,button,.btn,.seg):focus-visible{
  box-shadow: 0 0 0 3px var(--ring);
}

/* ---------- Utility & misc ---------- */
.hidden{display:none!important}
.workshop-texture{background:none} /* superseded by body pattern */

h1,h2,h3,h4,h5,h6{font-family:var(--font-sans); letter-spacing:.01em}
h2{font-size:1.35rem; margin:0 0 12px}
p{margin:0 0 10px; color:var(--muted-foreground)}

.small{font-size:.9rem}
.muted{color:var(--muted-foreground)}
.divider{height:1px;background:var(--border); margin:12px 0; border-radius:999px}

/* ---------- Responsive ---------- */
@media (max-width: 980px){
  #app{
    grid-template-columns: 1fr;
  }
  #editor, #sidebar{padding:16px}
}


/* ---------- Global site chrome ---------- */
.site-body{
  min-height:100vh;
  display:flex;
  flex-direction:column;
}
.site-main{
  flex:1 0 auto;
  padding:clamp(32px,6vw,72px) 0 72px;
}
.site-container{
  width:min(1180px, 100% - 40px);
  margin:0 auto;
}
.page-content{
  width:min(1100px, 100% - 40px);
  margin:0 auto;
}
.page-content--narrow{
  width:min(520px, 100% - 40px);
}
.section-title{
  margin:0 0 28px;
  font-family:var(--font-sans);
  font-size:clamp(1.8rem, 2.5vw, 2.4rem);
}
.form-stack{
  display:flex;
  flex-direction:column;
  gap:16px;
}
.action-row{
  display:flex;
  gap:12px;
  flex-wrap:wrap;
}
.is-hidden{display:none !important;}

/* ---------- Global header from Web321 ---------- */
.global-header{
  background:white;
  color:#333;
  box-shadow:var(--shadow-1);
}
.global-header__top{
  background:rgba(0,0,0,0.35);
  font-size:0.85rem;
}
.global-header__top-inner{
  display:flex;
  gap:16px;
  align-items:center;
  flex-wrap:wrap;
  padding:10px 0;
  color:#c8d4ff;
}
.global-header__tagline{opacity:0.8;}
.global-header__top-link{
  color:#323;
  text-decoration:none;
  font-weight:600;
}
.global-header__top-link:hover{color:#fff;}
.global-header__main{
  display:flex;
  align-items:center;
  gap:32px;
  padding:20px 0;
  flex-wrap:wrap;
}
.global-header__brand{
  display:flex;
  align-items:center;
  gap:12px;
  text-decoration:none;
  color:inherit;
}
.global-header__brand img{
  height:44px;
  width:auto;
}
.global-header__brand-text{
  font-weight:700;
  letter-spacing:0.08em;
  text-transform:uppercase;
}
.global-header__nav{
  display:flex;
  align-items:center;
  gap:18px;
  flex-wrap:wrap;
}
.global-header__nav a {
  color:#323;
  text-decoration:none;
  font-weight:600;
  position:relative;
  padding-bottom:4px;
}
.global-header__nav a::after{
  content:"";
  position:absolute;
  left:0;
  bottom:0;
  width:100%;
  height:2px;
  background:transparent;
  transition:background var(--fast) var(--easing);
}
.global-header__nav a:hover::after{background:var(--accent);}
.global-header__actions{
  margin-left:auto;
  display:flex;
  gap:12px;
  flex-wrap:wrap;
}
.global-header__action{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:10px 18px;
  border-radius:999px;
  border:1px solid rgba(229,235,255,0.4);
  color:#f5f7ff;
  text-decoration:none;
  transition:background var(--fast) var(--easing), color var(--fast) var(--easing), border-color var(--fast) var(--easing);
}
.global-header__action:hover{
  border-color:#fff;
  color:#fff;
}
.global-header__action--primary{
  background:var(--accent);
  border-color:transparent;
  color:var(--primary-foreground);
}
.global-header__action--primary:hover{
  background:var(--accent-strong);
}
.global-header__local{
  border-top:1px solid rgba(229,235,255,0.15);
  background:rgba(40,30,40,0.75);
}
.global-header__local-nav{
  display:flex;
  gap:18px;
  flex-wrap:wrap;
  padding:12px 0;
}
.global-header__local-nav a {
  color:#fcfafc;
  text-decoration:none;
  font-weight:600;
}
.global-header__local-nav a:hover{color:#fff; text-decoration: underline;}

@media (max-width: 900px){
  .global-header__main{flex-direction:column; align-items:flex-start;}
  .global-header__actions{margin-left:0;}
}

/* ---------- Global footer from Web321 ---------- */

.global-footer{
  margin-top:auto;
  background:#1e003e;
  color:#fbe3ff;
}

.global-footer a {
  color:#fbe3ff !important;
  text-decoration: none;
}

.global-footer a:hover {
  color:#fff !important;
  text-decoration: underline;
}

.global-footer__main{
  display:flex;
  flex-wrap:wrap;
  gap:36px;
  padding:48px 0 32px;
}
.global-footer__brand{
  flex:1 1 260px;
}
.global-footer__brand-link{
  display:inline-flex;
  align-items:center;
  gap:12px;
  margin-bottom:12px;
}
.global-footer__brand-link img{
  min-height: 72px;
  width: 100%;
  height: auto;
}
.global-footer__description{
  max-width:360px;
  margin:0;
  opacity:0.85;
  line-height:1.6;
}
.global-footer__columns{
  flex:2 1 380px;
  display:flex;
  flex-wrap:wrap;
  gap:30px;
}
.global-footer__column{
  min-width:180px;
}
.global-footer__heading{
  margin:0 0 12px;
  font-family:var(--font-sans);
  font-size:1.05rem;
  color:#fff;
}
.global-footer__column ul{
  list-style:none;
  margin:0;
  padding:0;
  display:flex;
  flex-direction:column;
  gap:8px;
}
.global-footer__column a{
  color:#dbe3ff;
  text-decoration:none;
}
.global-footer__column a:hover{color:#fff;}
.global-footer__bottom{
  border-top:1px solid rgba(219,227,255,0.2);
  background:rgba(0,0,0,0.25);
  padding:18px 0;
}
.global-footer__bottom-inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  flex-wrap:wrap;
}
.global-footer__bottom-inner p{
  margin:0;
}
.global-footer__legal{
  display:flex;
  gap:16px;
  flex-wrap:wrap;
}
.global-footer__legal a{
  color:#dbe3ff;
  text-decoration:none;
}
.global-footer__legal a:hover{color:#fff;}

@media (max-width: 640px){
  .page-content{width:100%; padding:0 20px;}
  .site-container{width:100%; padding:0 20px;}
  .global-header__actions{width:100%;}
}
