@import url('../assets/font.css');


* { box-sizing: border-box; margin: 0; padding: 0; font-family: YekanBakh;}

:root {
        --primary: #4849E8;
    --primary-light: #6869FF;

  --bg:     #121212;
  --bg2:    #141414;
  --bg3:    #1e1e1e;
  --bg4:    #1e1e1e;
  --border: rgba(255,255,255,0.08);
  --accent: #7c6af7;
  --green:  #34d399;
  --red:    #f87171;
  --text:   #e2e2f0;
  --text2:  #fff;
  --text3:  #878787;
  --r:      10px;
    --bg-tertiary: #181818;
        --bg-secondary: #141414;

}



body {
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #0a0a0a;
    direction: rtl;
}

html, body {
    height: 100%;
    color: var(--text);
    font-family: YekanBakh;
    background-image: linear-gradient(rgba(255, 255, 255, .025) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .025) 1px, transparent 1px);
    background-size: 24px 24px;
}
/* ── App Layout ── */
.app { display: flex; flex-direction: column; height: 100vh; }

        header {
    background: var(--bg-secondary);
    padding: 10px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    z-index: 10;
    backdrop-filter: blur(8px);
    overflow:auto;
}

.header-content {
    display: flex;
    flex-direction: row;
    gap: 40px;
    align-items:center;
}
        
        
        .logo-section {
    display: flex;
    gap: 10px;
    align-items: center;
}

.logo-section img {
    width:50px;
}

.logo-section h1 {
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.menu {
    display: flex;
    gap: 10px;
}

.menu a {
    text-decoration: none;
    color: white;
    padding: 8px 14px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
        display:flex;
    gap:5px;
}

.menu button {
    color: white;
    padding: 8px 14px;
    background: var(--bg-tertiary);
    border: none;
    border-radius: 10px;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    display:flex;
    gap:5px;
    width:auto;
    margin:0;
}

.menu button:hover , .menu a:hover {
    background:#4849e8;
}

/* Popup overlay */
.popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: none;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(2px);
    animation: fadeIn 0.3s ease;
    z-index: 10;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Popup box */
.popup-box {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: 12px;
    text-align: right;
    color: var(--text-primary);
    transform: translateY(-20px);
    animation: slideDown 0.3s ease forwards;
}

.tools-link {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin:20px 0;
}

@keyframes slideDown {
    from { transform: translateY(-20px); opacity: 0; }
    to   { transform: translateY(0); opacity: 1; }
}

.popup-box a {
    padding: 8px 0;
    color: white;
    background: var(--bg-tertiary);
    text-decoration: none;
    transition: 0.2s;
    border-radius: 10px;
    padding: 10px 20px;
    display: flex;
    gap: 10px;
    flex-direction: row-reverse;
    justify-content: space-between;
}

.close-popup {
    width: 100%;
    margin-top: 10px;
    padding: 8px;
    border: none;
    border-radius: 6px;
    background: var(--primary);
    color: var(--text-primary);
    cursor: pointer;
    transition: 0.3s;
}
.close-popup:hover {
    background: var(--primary-light);
}


/* ── Stats in header ── */
.hstat { font-size: 12px; color: var(--text2); display: flex; align-items: center; gap: 5px; }
.hstat strong { color: var(--text); }
.hstat-sep { color: var(--text3); }

/* ── Main ── */
.main { flex: 1; display: flex; overflow: hidden; }

/* ── Drop Screen ── */
.drop-screen {
  flex: 1; display: flex; align-items: center; justify-content: center;
}
.dropzone {
  width: 480px; max-width: calc(100vw - 40px);
  border-radius: 20px; padding: 56px 40px;
  text-align: center; cursor: pointer;
  background: var(--bg2); transition: all .2s;
}
.dropzone:hover, .dropzone.drag-over {
  border-color: var(--accent);
  background: rgba(124,106,247,.05);
}
.drop-icon { font-size: 52px; margin-bottom: 16px; display: block; }
.dropzone h2 { font-size: 20px; margin-bottom: 8px; }
.dropzone p  { color: var(--text2); font-size: 13px; margin-bottom: 24px; line-height: 1.7; }

.fmt-pills { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-top: 14px; }
.fmt-pill {
  padding: 3px 10px; border-radius: 99px;
  background: var(--bg4); border: 1px solid var(--border);
  font-size: 11px; color: var(--text2); letter-spacing: .5px;
}

/* ── Workspace ── */
.workspace {
  flex: 1;
  display: flex;
  overflow: hidden;
  flex-direction: row-reverse;
}
/* ── Side Panel ── */
.panel {
  width: 280px; flex-shrink: 0;
  display: flex; flex-direction: column; overflow: hidden;
  
}
.panel-body { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; justify-content: center; gap: 10px; }
.panel-body::-webkit-scrollbar { width: 3px; }
.panel-body::-webkit-scrollbar-thumb { background: var(--bg4); }

/* ── Section ── */
.sec { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.sec-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; cursor: pointer; user-select: none;
  font-size: 11px;  text-transform: uppercase; letter-spacing: 1px; color: var(--text2);
}
.sec-hd:hover { background: rgba(255,255,255,.02); }
.sec-hd span { font-size: 13px; }
.arrow { font-size: 10px; color: var(--text3); transition: transform .18s; }
.sec.closed .arrow { transform: rotate(-90deg); }
.sec.closed .sec-bd { display: none; }
.sec-bd { padding: 12px; display: flex; flex-direction: column; gap: 10px; }

/* ── Controls ── */
.row {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: space-between;
}.lbl { font-size: 11px; color: var(--text2); min-width: 72px; flex-shrink: 0; }
.ctrl { flex: 1; }

.inp {
  width: 100%; background: var(--bg4); border: 1px solid var(--border);
  border-radius: 7px; padding: 6px 9px; color: var(--text); font-size: 12px; outline: none;
  transition: border-color .15s;
}
.inp:focus { border-color: var(--accent); }
select.inp {
  appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238b8baa' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: left 8px center; padding-left: 24px;
}

/* Range */
.rrow { display: flex; align-items: center; gap: 8px; }
input[type=range] {
  flex: 1; height: 3px; appearance: none; background: var(--bg4); border-radius: 2px; outline: none; cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
  appearance: none; width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--bg2);
  transition: transform .15s;
}
input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.25); }
.rval { font-size: 11px;  color: var(--accent); min-width: 30px; text-align: center; background: var(--bg4); border-radius: 4px; padding: 2px 5px; }

/* Segs */
.segs { display: flex; gap: 2px; background: var(--bg4); border-radius: 7px; padding: 2px; }
.seg {
  flex: 1; padding: 5px 3px; border: none; background: transparent;
  color: var(--text2); font-size: 11px;  border-radius: 5px;
  cursor: pointer; transition: all .14s;
}
.seg.on { background: var(--accent); color: #fff; }

/* Format tabs */
.ftabs { display: flex; gap: 2px; background: var(--bg4); border-radius: 7px; padding: 2px; }
.ftab {
  flex: 1; padding: 5px 2px; border: none; background: transparent;
  color: var(--text3); font-size: 11px; border-radius: 5px;
  cursor: pointer; transition: all .14s; letter-spacing: .3px;
}
.ftab:hover { color: var(--text2); }
.ftab.on { background: var(--accent); color: #fff; }

/* Dim inputs */
.dims { display: flex; gap: 6px; align-items: end; }
.df { flex: 1; }
.dlbl { font-size: 9px; color: var(--text3); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 3px; }
.di {
  width: 100%; background: var(--bg4); border: 1px solid var(--border);
  border-radius: 7px; padding: 7px 8px; color: var(--text); font-size: 13px;
   outline: none; text-align: center; transition: border-color .15s;
}
.di:focus { border-color: var(--accent); }

.lock-btn {
  background: var(--bg4); border: 1px solid var(--border); border-radius: 6px;
  padding: 5px; cursor: pointer; font-size: 14px; transition: all .14s; flex-shrink: 0;
}
.lock-btn:hover { border-color: var(--accent); }
.lock-btn.on { border-color: var(--green); }

/* Size card */
.size-card {
  background: var(--bg4); border-radius: 7px; padding: 10px;
  display: flex; align-items: center; gap: 0;
}
.sz { text-align: center; flex: 1; }
.sz-num { font-size: 16px; line-height:1em;  }
.sz-lbl { font-size: 9px; color: var(--text3); text-transform: uppercase; letter-spacing: .8px; margin-top: 2px; }
.sz-arr { color: var(--text3); font-size: 14px; }
.sz-pct { font-size: 18px;  }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  padding: 7px 14px; border: none; border-radius: 7px;
  font-size: 12px;  cursor: pointer; transition: all .18s; white-space: nowrap;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #9b8ff7; }
.btn-ghost { background: var(--bg4); border: 1px solid var(--border); color: var(--text2); }
.btn-green { background: #059669; color: #fff; }

.btn-green:hover { background: var(--green); }
.btn-sm { padding: 5px 10px; font-size: 11px; }
.btn-full { width: 100%; }
.btn:disabled { opacity: .35; cursor: not-allowed; }

/* Download panel */
.dl-panel { padding: 12px; flex-shrink: 0; }
.dl-info {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 8px;
    font-size: 14px !important;
    color: var(--text2);
    justify-content: flex-start;
    flex-direction: row-reverse;
} 
.badge { padding: 2px 7px; border-radius: 99px; font-size: 14px;  letter-spacing: .5px; text-transform: uppercase; }
.badge-p { padding: 4px 12px;
    background: rgba(124, 106, 247, .2);
    border-radius: 10px; }
.badge-g { background: rgba(52,211,153,.15); color: var(--green); }

/* Progress */
.prog-wrap { background: var(--bg4); border-radius: 3px; height: 3px; overflow: hidden; margin-top: 6px; display: none; }
.prog-bar { height: 100%; background: var(--accent); border-radius: 3px; transition: width .2s; }

/* ── Preview ── */
.preview-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* Toolbar */
.ptoolbar {
  display: flex; align-items: center; justify-content:center; gap: 8px; padding:20px 20px;
   flex-shrink: 0;
}
.zoom-ctrl { display: flex; align-items: center; gap: 4px; }
.zbtn {
  width: 24px; height: 24px; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 5px; color: var(--text2); font-size: 14px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: all .14s; padding: 0;
}
.zbtn:hover { border-color: var(--accent); color: var(--accent); }
.zval { font-size: 11px; color: var(--text2); min-width: 34px; text-align: center; }

/* Preview container */
.preview-wrap {
    flex: 1;
    overflow: hidden;
    position: relative;
    cursor: grab;
    border-radius: 20px;
    margin: 20px;
}
.preview-wrap:active { cursor: grabbing; }
.preview-wrap.wheel-zoom { cursor: crosshair; }

/* ── Compare Slider ── */
.compare-root {
  position: absolute;
  top: 0; left: 0;
  transform-origin: 0 0;
  /* transform set by JS */
  user-select: none;
}

.compare-box {
  position: relative;
  overflow: hidden;
  /* width/height set by JS */
}

/* Bottom image (output) fills the box */
.cimg-back {
  display: block;
  position: absolute; top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: fill;
  pointer-events: none;
}

/* Top image (original) — clipped by JS */
.cimg-front-wrap {
  position: absolute; top: 0; left: 0;
  height: 100%;
  overflow: hidden;
  /* width set by JS */
}
.cimg-front {
  display: block;
  position: absolute; top: 0; left: 0;
  /* width set to full compare-box width by JS */
  height: 100%;
  object-fit: fill;
  pointer-events: none;
}

/* Divider line */
.c-divider {
  position: absolute; top: 0; bottom: 0;
  width: 2px; background: #fff;
  transform: translateX(-50%);
  /* left set by JS */
  cursor: col-resize;
  z-index: 10;
}
.c-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 36px;
    height: 36px;
    background: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: #333;
    cursor: col-resize;
    border: 1px solid #bdbdbd;
}
/* Labels */
.c-label {
  position: absolute; top: 12px;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(6px);
  border-radius: 5px; padding: 3px 9px;
  font-size: 11px; color: rgba(255,255,255,.8);
  pointer-events: none;
  z-index: 5;
}
.c-label-orig { left: 12px; }
.c-label-out  { right: 12px; }

/* Empty state */
.empty-msg {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  text-align: center; color: var(--text3);
}
.empty-msg span { font-size: 40px; display: block; margin-bottom: 10px; }

/* Thumb strip */
.thumbs {
  display: flex; gap: 5px; padding: 15px 14px;
  overflow-x: auto; flex-shrink: 0;
}
.thumbs::-webkit-scrollbar { height: 3px; }
.thumbs::-webkit-scrollbar-thumb { background: var(--bg4); }
.th {
  flex-shrink: 0; width: 46px; height: 46px; border-radius: 7px;
  overflow: hidden; cursor: pointer; border: 2px solid transparent; transition: border-color .15s;
  position: relative; background: var(--bg3);
}
.th:hover { border-color: #a78bfa; }
.th.on   { border-color: var(--accent); }
.th img  { width: 100%; height: 100%; object-fit: cover; }
.th-del {
  position: absolute; top: 1px; right: 1px;
  background: rgba(248,113,113,.9); border: none; border-radius: 50%;
  width: 14px; height: 14px; font-size: 9px; line-height: 14px;
  text-align: center; cursor: pointer; color: #fff; display: none;
}
.th:hover .th-del { display: block; }
.th-add {
  flex-shrink: 0; width: 46px; height: 46px; border-radius: 7px;
  border: 2px dashed rgba(124,106,247,.35); background: transparent;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: var(--accent); transition: all .15s;
}
.th-add:hover { border-color: var(--accent); background: rgba(124,106,247,.07); }

/* Processing overlay */
.proc-ov {
  position: absolute; inset: 0;
  background: rgba(12,12,17,.7); backdrop-filter: blur(3px);
  display: none; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  z-index: 50;
}
.spinner {
  width: 36px; height: 36px; border: 3px solid var(--bg4);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin .7s linear infinite;
}

span#dl-sz {
    padding: 4px 12px;
    background: rgba(124, 106, 247, .2);
    border-radius: 10px;
}

p#h-name {
    width: 70px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

div#hstats {
    display: flex;
}

@keyframes spin { to { transform: rotate(360deg); } }
.proc-txt { font-size: 12px; color: var(--text2);  }

/* Toast */
.toast {
  position: fixed; bottom: 20px; left: 50%;
  transform: translateX(-50%) translateY(60px);
  background: var(--bg3); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 18px; font-size: 12px;  color: var(--text);
  transition: transform .28s cubic-bezier(.34,1.56,.64,1); z-index: 999;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* Checkbox style */
input[type=checkbox] { accent-color: var(--accent); cursor: pointer; }