/* =========================================================
   Convertium.tools — Merge PDF (Original Stable Spinner)
   ========================================================= */

:root {
  --bg-dark:#0d1117;
  --fg-dark:#e6edf3;
  --panel-dark:#161b22;
  --accent:#58a6ff;
  --accent-strong:#1f6feb;
  --ok:#2ea043;
  --warn:#d29922;
  --err:#f85149;
}

/* === Base === */
body {
  margin:0;
  font-family:'JetBrains Mono',monospace;
  background:var(--bg-dark);
  color:var(--fg-dark);
  overflow-x:hidden;
}

.tool-area {
  display:flex;
  justify-content:center;
  align-items:flex-start;
  padding:60px 20px;
  margin-top:110px;
}
.tool-box {
  width:100%;
  max-width:900px;
  text-align:center;
}

/* === Upload === */
.upload-box {
  display:block;
  border:2px dashed var(--accent);
  border-radius:12px;
  padding:30px;
  margin-bottom:15px;
  color:var(--accent);
  background:rgba(88,166,255,0.05);
  cursor:pointer;
  transition:background .2s,box-shadow .2s;
}
.upload-box:hover {
  background:rgba(88,166,255,0.12);
  box-shadow:0 0 12px rgba(88,166,255,0.4);
}
.upload-box.dragover {
  background:rgba(88,166,255,0.25);
  box-shadow:0 0 16px rgba(88,166,255,0.6);
}

/* === Buttons === */
.btn {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  padding:10px 18px;
  border:none;
  border-radius:8px;
  cursor:pointer;
  font-family:'Exo 2',sans-serif;
  font-weight:700;
  text-transform:uppercase;
  transition:background .2s,box-shadow .2s,transform .1s;
}
.btn:hover {transform:translateY(-1px);}
.btn.success {background:linear-gradient(135deg,var(--ok),#3fb950);color:#fff;}
.btn.success:hover {background:linear-gradient(135deg,#3fb950,#4ccd64);box-shadow:0 0 10px var(--ok);}
.btn.secondary {background:#6c757d;color:#fff;}
.btn.secondary:hover {background:#848e97;}

/* === Progress === */
.progress-container {
  position: relative;
  width: 100%;
  max-width: 420px;
  height: 26px;
  margin: 28px auto 12px;
  background: rgba(88,166,255,0.08);
  border: 1px solid var(--accent);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 0 14px rgba(88,166,255,0.25);
}

.progress-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg,var(--accent-strong),var(--accent));
  border-radius: 12px 0 0 12px;
  transition: width 0.3s ease;
  position: relative;
  z-index: 1;
}

.progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%);
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  text-shadow: 0 0 8px rgba(0,0,0,0.8);
  z-index: 2;
}

.spin {
  display:inline-block;
  animation: spin 1.25s linear infinite;
  transform-origin:center center;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}


/* === Debug === */
.debug-box {
  margin-top:12px;
  background:rgba(255,255,255,0.05);
  border-radius:6px;
  padding:8px 10px;
  font-size:0.75rem;
  text-align:left;
  max-height:120px;
  overflow-y:auto;
  white-space:pre-wrap;
  color:#ccc;
  font-family:'JetBrains Mono',monospace;
}
.debug-box:empty::before {
  content:"⚙️ Debug log initialized — waiting for runtime output...";
  color:#888;
  font-style:italic;
}

/* === Preview === */
.preview-container {
  display:flex;
  flex-wrap:wrap;
  justify-content:center;
  gap:10px;
  margin-top:20px;
  z-index:0;
}
.preview-item {
  width:120px;
  height:150px;
  border:1px solid rgba(255,255,255,0.15);
  border-radius:8px;
  background:rgba(255,255,255,0.05);
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:space-between;
  padding:6px;
  cursor:grab;
  position:relative;
  transition:transform 0.2s ease;
}
.preview-item.dragging {
  opacity:0.6;
  transform:scale(1.05);
  border-color:var(--accent);
}
.preview-item iframe.pdf-thumb {
  width:100%;
  height:100px;
  display:block;
  border:none;
  border-radius:6px;
  background:#0d1117;
  margin:0;
}
.preview-item .file-name {
  font-size:0.75rem;
  text-align:center;
  margin-top:4px;
  word-break:break-all;
  color:#ccc;
}

/* === Remove Button === */
.remove-btn {
  position:absolute;
  top:3px;
  right:3px;
  background:rgba(0,0,0,0.6);
  border:none;
  border-radius:50%;
  color:#fff;
  width:22px;
  height:22px;
  font-size:12px;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  transition:background 0.2s;
  z-index:4;
}
.remove-btn:hover {background:rgba(220,53,69,0.85);}

/* === Download Bar === */
.download-bar {
  text-align:center;
  margin:10px 0 20px;
}
.download-bar .btn {
  transition: background .2s, box-shadow .2s, transform .1s;
  backface-visibility: hidden;
  transform: translateZ(0);  
  box-shadow:0 0 10px rgba(46,160,67,0.4);
}
.download-bar .btn:hover {
  transform: translateY(-1px);
  box-shadow:0 0 15px rgba(46,160,67,0.8);
}

.footer {
  text-align:center;
  padding:12px;
  font-size:13px;
  color:#6bc8f0;
  opacity:0.85;
}

.btn.disabled-state {
  opacity: 0.6;
  pointer-events: none;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

#resultMERGE {
    display:none;
}

/* === File Upload Status — Refined Cyber Style === */
.file-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 6px;
  padding: 8px 16px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: rgba(88,166,255,0.08);
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.25px;
  box-shadow:
    0 0 10px rgba(88,166,255,0.25),
    inset 0 0 10px rgba(88,166,255,0.08);
  text-shadow: 0 0 6px rgba(88,166,255,0.3);
  backdrop-filter: blur(4px);
  transition: transform .2s ease, box-shadow .2s ease;
}
.file-status:hover {
  transform: translateY(-1px);
  box-shadow:
    0 0 14px rgba(88,166,255,0.4),
    inset 0 0 10px rgba(88,166,255,0.1);
}
.file-status i {
  color: var(--ok);
  font-size: 1rem;
  text-shadow: 0 0 8px rgba(46,160,67,0.5);
}
.file-status strong {
  color: var(--fg-dark);
  font-weight: 700;
}

/* =========================================================
   Tool: IMG → PDF
   ========================================================= */
#resultIMG {
  display: none;
}

.preview-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
}

.preview-item {
  width: 120px;
  height: 150px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  background: rgba(255,255,255,0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 6px;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease;
}

.preview-item.dragging {
  opacity: 0.6;
  transform: scale(1.05);
  border-color: var(--accent);
}

.preview-item .img-thumb {
  width: 100%;
  height: 100px;
  object-fit: contain;
  border-radius: 6px;
  background: #0d1117;
}

.preview-item .file-name {
  font-size: 0.75rem;
  text-align: center;
  color: #ccc;
  word-break: break-all;
  margin-top: 4px;
}

.order-badge {
  position: absolute;
  top: 3px;
  left: 3px;
  font-size: 0.7rem;
  background: rgba(88,166,255,0.4);
  color: #fff;
  border-radius: 4px;
  padding: 2px 4px;
}

.remove-btn {
  position: absolute;
  top: 3px;
  right: 3px;
  background: rgba(0,0,0,0.6);
  border: none;
  border-radius: 50%;
  color: #fff;
  width: 22px;
  height: 22px;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}

.remove-btn:hover {
  background: rgba(220,53,69,0.85);
}

.spinner-icon i.spin {
  display:inline-block;
  animation:spin 1s linear infinite;
}
@keyframes spin {
  100% { transform:rotate(360deg); }
}

/* === Convert Button Breathing Glow when Ready === */
@keyframes pulseReady {
  0%   { box-shadow: 0 0 0px rgba(100, 200, 255, 0.5); }
  50%  { box-shadow: 0 0 10px rgba(100, 200, 255, 0.8); }
  100% { box-shadow: 0 0 0px rgba(100, 200, 255, 0.5); }
}
.btn.breathing {
  animation: pulseReady 2s ease-in-out infinite;
}
