/* DhimanHub Tools — Tool Page Styles */

body.tool-body { min-height:100vh; }

/* ── Tool States ── */
.tool-state { position:relative; z-index:1; }

/* ── STATE 1: Upload ── */
.upload-hero {
  min-height:calc(100vh - 64px);
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  padding:60px 5%;
  text-align:center;
  position:relative;
}
.upload-hero::before {
  content:''; position:absolute; top:0; left:50%; transform:translateX(-50%);
  width:800px; height:500px;
  background:radial-gradient(ellipse,rgba(59,130,246,0.08) 0%,transparent 65%);
  pointer-events:none;
}
.upload-hero-icon { font-size:52px; margin-bottom:16px; }
.upload-hero h1   { font-size:clamp(28px,4vw,48px); font-weight:900; letter-spacing:-1px; margin-bottom:12px; }
.upload-hero p    { font-size:16px; color:var(--muted); max-width:520px; margin:0 auto 40px; line-height:1.7; }

.upload-zone {
  position:relative; cursor:pointer;
  max-width:560px; width:100%;
}
.upload-zone input[type=file] {
  position:absolute; inset:0; opacity:0; cursor:pointer; width:100%; height:100%; z-index:2;
}
.upload-zone-inner { display:flex; flex-direction:column; align-items:center; gap:12px; }

.upload-btn {
  display:inline-flex; align-items:center; gap:12px;
  background:linear-gradient(135deg,var(--blue),var(--indigo));
  color:white; padding:18px 40px; border-radius:16px;
  font-size:18px; font-weight:700; cursor:pointer;
  box-shadow:0 8px 32px rgba(59,130,246,0.4);
  transition:all 0.2s; position:relative; z-index:1;
  border:none; font-family:'Outfit',sans-serif;
}
.upload-btn:hover { transform:translateY(-3px); box-shadow:0 14px 40px rgba(59,130,246,0.55); }
.upload-btn-icon { font-size:22px; }

.upload-or { font-size:14px; color:var(--muted); font-style:italic; }
.upload-limits { font-size:12px; color:var(--muted); opacity:0.7; }

/* Drag over state */
.upload-zone.drag-over .upload-btn { background:linear-gradient(135deg,var(--teal),var(--green)); box-shadow:0 8px 32px rgba(20,184,166,0.4); }

/* ── STATE 2: Workspace ── */
.workspace {
  min-height:calc(100vh - 64px);
  display:flex;
  position:relative; z-index:1;
}

/* Left file area */
.ws-main {
  flex:1; padding:28px 28px 28px 32px;
  overflow-y:auto; min-height:0;
  display:flex; flex-direction:column; gap:16px;
}

.ws-files {
  display:flex; flex-wrap:wrap; gap:16px;
  align-content:flex-start;
}

/* File thumbnail card */
.ws-file-card {
  background:var(--surface); border:1px solid var(--border);
  border-radius:16px; overflow:hidden;
  width:160px; position:relative;
  transition:all 0.2s; cursor:grab;
  animation:fadeUp 0.3s ease both;
}
.ws-file-card:hover { border-color:var(--border2); transform:translateY(-2px); box-shadow:0 8px 28px rgba(0,0,0,0.3); }
.ws-file-card:hover .ws-card-actions { opacity:1; }

.ws-file-thumb {
  width:100%; aspect-ratio:3/4;
  background:var(--bg3); display:flex; align-items:center; justify-content:center;
  font-size:36px; overflow:hidden; position:relative;
}
.ws-file-thumb img { width:100%; height:100%; object-fit:cover; }

.ws-card-size-badge {
  position:absolute; top:6px; left:6px;
  background:rgba(0,0,0,0.6); backdrop-filter:blur(4px);
  border-radius:6px; padding:2px 7px;
  font-size:10px; font-family:'JetBrains Mono',monospace; color:rgba(255,255,255,0.8);
}

.ws-card-actions {
  position:absolute; top:6px; right:6px;
  display:flex; flex-direction:column; gap:4px;
  opacity:0; transition:opacity 0.15s;
}
.ws-card-btn {
  width:28px; height:28px; border-radius:50%;
  background:rgba(0,0,0,0.65); backdrop-filter:blur(4px);
  border:1px solid rgba(255,255,255,0.15);
  color:white; font-size:12px; cursor:pointer;
  display:flex; align-items:center; justify-content:center;
  transition:background 0.2s;
}
.ws-card-btn:hover { background:rgba(59,130,246,0.6); }
.ws-card-btn.del:hover { background:rgba(239,68,68,0.6); }

.ws-file-name {
  padding:8px 10px 10px;
  font-size:11px; color:var(--muted);
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
  font-family:'JetBrains Mono',monospace;
}

/* List mode (for non-image uploads) */
.ws-files.list-mode { flex-direction:column; }
.ws-files.list-mode .ws-file-card { width:100%; display:flex; align-items:center; gap:12px; padding:12px 16px; border-radius:12px; }
.ws-files.list-mode .ws-file-thumb { width:44px; height:44px; aspect-ratio:1; border-radius:8px; flex-shrink:0; font-size:20px; }
.ws-files.list-mode .ws-file-name { flex:1; font-size:13px; color:var(--text); padding:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ws-files.list-mode .ws-card-actions { position:static; opacity:1; flex-direction:row; }

/* Sort button */
.ws-sort-btn {
  background:var(--surface); border:1px solid var(--border);
  border-radius:8px; color:var(--muted); font-family:'Outfit',sans-serif;
  font-size:13px; font-weight:600; padding:6px 14px; cursor:pointer;
  display:flex; align-items:center; gap:6px; transition:all 0.2s;
}
.ws-sort-btn:hover { border-color:var(--blue2); color:var(--blue2); }

.ws-add-btn {
  background:var(--surface); border:2px dashed var(--border2);
  border-radius:12px; color:var(--muted); font-family:'Outfit',sans-serif;
  font-size:14px; font-weight:600; padding:12px 22px; cursor:pointer;
  display:flex; align-items:center; gap:8px; transition:all 0.2s;
}
.ws-add-btn:hover { border-color:var(--blue); color:var(--blue2); }
.ws-add-more { padding:0 0 20px; }

/* ── Right sidebar ── */
.ws-sidebar {
  width:300px; flex-shrink:0;
  background:var(--bg2); border-left:1px solid var(--border);
  display:flex; flex-direction:column;
  position:sticky; top:64px; height:calc(100vh - 64px);
  overflow-y:auto;
}
.ws-sidebar-title {
  font-size:18px; font-weight:800; padding:24px 24px 0;
  color:var(--text); letter-spacing:-0.3px;
}
.ws-sidebar-options {
  flex:1; padding:20px 24px;
  display:flex; flex-direction:column; gap:16px;
}
.ws-sidebar-tip {
  margin:0 24px 12px;
  background:rgba(59,130,246,0.08); border:1px solid rgba(59,130,246,0.15);
  border-radius:10px; padding:10px 14px;
  font-size:12px; color:var(--blue2); line-height:1.6;
  display:flex; gap:8px;
}
.ws-sidebar-tip:empty { display:none; }
.ws-sidebar-action { padding:20px 24px 28px; border-top:1px solid var(--border); margin-top:auto; }

.ws-action-btn {
  width:100%; padding:16px 20px; border-radius:14px; border:none;
  background:linear-gradient(135deg,var(--blue),var(--indigo));
  color:white; font-family:'Outfit',sans-serif; font-size:16px; font-weight:800;
  cursor:pointer; display:flex; align-items:center; justify-content:center; gap:10px;
  box-shadow:0 6px 24px rgba(59,130,246,0.4); transition:all 0.2s;
  letter-spacing:-0.2px;
}
.ws-action-btn:hover { transform:translateY(-2px); box-shadow:0 10px 32px rgba(59,130,246,0.55); }
.ws-action-btn:disabled { opacity:0.5; cursor:not-allowed; transform:none; }
.ws-action-arrow { font-size:20px; transition:transform 0.2s; }
.ws-action-btn:hover .ws-action-arrow { transform:translateX(4px); }

/* Sidebar form controls */
.opt-group { display:flex; flex-direction:column; gap:6px; }
.opt-label { font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:1px; color:var(--muted); }
.opt-select, .opt-input {
  background:var(--surface); border:1px solid var(--border); border-radius:10px;
  padding:10px 14px; color:var(--text); font-family:'Outfit',sans-serif; font-size:14px;
  outline:none; transition:border-color 0.2s; width:100%;
}
.opt-select:focus, .opt-input:focus { border-color:var(--blue); box-shadow:0 0 0 3px rgba(59,130,246,0.1); }
.opt-select option { background:var(--surface); }
.opt-checkbox { display:flex; align-items:center; gap:8px; cursor:pointer; font-size:14px; color:var(--muted); }
.opt-checkbox input { accent-color:var(--blue); width:16px; height:16px; }

/* ── STATE 3: Processing ── */
.processing-center {
  min-height:calc(100vh - 64px);
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  text-align:center; padding:40px 5%;
  position:relative; z-index:1;
}
.processing-anim { position:relative; width:100px; height:100px; margin-bottom:32px; }
.proc-ring {
  position:absolute; inset:0; border-radius:50%;
  border:3px solid var(--border);
  border-top-color:var(--blue);
  animation:spin 1s linear infinite;
}
.proc-icon { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; font-size:38px; }

.processing-center h2 { font-size:28px; font-weight:800; margin-bottom:8px; }
.processing-center p  { color:var(--muted); font-size:15px; margin-bottom:28px; }

.proc-progress { width:320px; max-width:90vw; height:5px; background:var(--surface); border-radius:100px; overflow:hidden; }
.proc-bar { height:100%; background:linear-gradient(90deg,var(--blue),var(--cyan)); border-radius:100px; width:0%; transition:width 0.4s ease; }
.proc-pct { font-size:12px; color:var(--muted); font-family:'JetBrains Mono',monospace; margin-top:10px; }

/* ── STATE 4: Done ── */
.done-center {
  min-height:calc(100vh - 64px);
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  text-align:center; padding:60px 5%;
  position:relative; z-index:1;
}
.done-check {
  width:72px; height:72px; border-radius:50%;
  background:linear-gradient(135deg,var(--teal),var(--green));
  color:#061a16; font-size:32px; font-weight:900;
  display:flex; align-items:center; justify-content:center;
  margin:0 auto 20px;
  box-shadow:0 8px 32px rgba(20,184,166,0.4);
  animation:fadeUp 0.4s ease both;
}
.done-center h1 { font-size:clamp(24px,4vw,40px); font-weight:900; margin-bottom:8px; animation:fadeUp 0.4s ease 0.1s both; }
.done-meta { color:var(--muted); font-size:14px; margin-bottom:32px; font-family:'JetBrains Mono',monospace; animation:fadeUp 0.4s ease 0.15s both; }

.done-actions { display:flex; align-items:center; gap:12px; margin-bottom:48px; flex-wrap:wrap; justify-content:center; animation:fadeUp 0.4s ease 0.2s both; }
.done-dl-btn {
  display:inline-flex; align-items:center; gap:10px;
  background:linear-gradient(135deg,var(--teal),var(--green));
  color:#061a16; padding:16px 36px; border-radius:16px;
  font-size:17px; font-weight:800; text-decoration:none;
  box-shadow:0 6px 28px rgba(20,184,166,0.4); transition:all 0.2s;
}
.done-dl-btn:hover { transform:translateY(-3px); box-shadow:0 12px 36px rgba(20,184,166,0.55); }
.done-extra-btns { display:flex; gap:8px; }
.done-extra-btn {
  width:46px; height:46px; border-radius:12px;
  background:var(--surface); border:1px solid var(--border);
  color:var(--muted); font-size:18px; cursor:pointer;
  display:flex; align-items:center; justify-content:center;
  transition:all 0.2s;
}
.done-extra-btn:hover { border-color:var(--blue2); color:var(--blue2); }

/* Continue to section */
.continue-section { width:100%; max-width:720px; animation:fadeUp 0.4s ease 0.3s both; }
.continue-label { font-size:11px; font-weight:700; letter-spacing:2px; text-transform:uppercase; color:var(--muted); margin-bottom:14px; text-align:left; }
.continue-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; }
.continue-item {
  background:var(--surface); border:1px solid var(--border);
  border-radius:12px; padding:12px 14px;
  display:flex; align-items:center; gap:10px;
  text-decoration:none; color:var(--text);
  font-size:13px; font-weight:600; transition:all 0.2s;
  cursor:pointer;
}
.continue-item:hover { border-color:var(--blue2); color:var(--blue2); transform:translateY(-2px); background:rgba(59,130,246,0.05); }
.continue-item-icon { font-size:20px; flex-shrink:0; }
.continue-item-arrow { margin-left:auto; color:var(--muted); font-size:16px; }

/* Images result grid */
.result-images-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(160px,1fr)); gap:12px; width:100%; max-width:900px; margin-top:24px; }
.result-img-card { background:var(--surface); border:1px solid var(--border); border-radius:12px; overflow:hidden; cursor:pointer; transition:all 0.2s; }
.result-img-card:hover { border-color:var(--blue); transform:translateY(-3px); box-shadow:0 8px 24px rgba(59,130,246,0.2); }
.result-img-card img { width:100%; aspect-ratio:3/4; object-fit:cover; display:block; }
.result-img-footer { padding:8px 10px; display:flex; justify-content:space-between; align-items:center; }
.result-img-pg { font-size:11px; color:var(--muted); font-family:'JetBrains Mono',monospace; }
.result-img-dl { font-size:12px; padding:3px 8px; border-radius:6px; background:var(--surface2); border:1px solid var(--border); color:var(--muted); cursor:pointer; text-decoration:none; transition:all 0.2s; }
.result-img-dl:hover { color:var(--blue2); border-color:var(--blue2); }

/* Parts grid (split result) */
.result-parts-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(200px,1fr)); gap:10px; width:100%; max-width:800px; }
.result-part-card { background:var(--surface); border:1px solid var(--border); border-radius:12px; padding:16px; text-align:left; }
.result-part-title { font-size:14px; font-weight:700; color:var(--blue2); margin-bottom:4px; }
.result-part-meta  { font-size:11px; color:var(--muted); font-family:'JetBrains Mono',monospace; margin-bottom:10px; }

/* OCR result */
.result-ocr-box { width:100%; max-width:720px; background:var(--surface); border:1px solid var(--border); border-radius:14px; padding:20px; text-align:left; max-height:340px; overflow-y:auto; font-family:'JetBrains Mono',monospace; font-size:12px; line-height:1.8; color:var(--slate); white-space:pre-wrap; }

/* Responsive */
@media(max-width:860px){
  .workspace { flex-direction:column; }
  .ws-sidebar { width:100%; height:auto; position:static; border-left:none; border-top:1px solid var(--border); }
  .continue-grid { grid-template-columns:repeat(2,1fr); }
}
@media(max-width:500px){
  .ws-file-card { width:130px; }
  .continue-grid { grid-template-columns:1fr; }
  .upload-btn { padding:15px 28px; font-size:16px; }
}