/* =========================
   GLOBAL / THEME
========================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', sans-serif;
}

body {
  background: #0b0b0d;
  color: #eaeaea;
  min-height: 100vh;
}

.container {
  width: 100%;
  padding: 20px;
}

h1 {
  font-size: 22px;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.desc {
  font-size: 13px;
  color: #a0a0a0;
  margin-bottom: 20px;
}

/* =========================
   UPLOAD BOX
========================= */
.upload-box {
  width: 100%;
  height: 180px;
  border: 2px dashed #2f2f2f;
  background: #121214;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  margin-bottom: 20px;
  transition: 0.2s;
}

.upload-box:hover {
  border-color: #00d4ff;
  background: #151518;
}

.upload-box input[type="file"] {
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  position: absolute;
}

.upload-box::before {
  content: "15b";
  font-family: "Font Awesome 5 Free";
  font-weight: 900;
  font-size: 42px;
  color: #444;
  position: absolute;
}

.upload-box::after {
  content: "Drop PDF / Click to Upload";
  position: absolute;
  bottom: 20px;
  font-size: 13px;
  color: #777;
}

/* =========================
   CONTROL PANEL
========================= */
.panel {
  position: fixed;
  bottom: 90px;
  left: 20px;
  width: 320px;
  background: #0f0f12;
  border: 1px solid #1e1e1e;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: 0.2s ease;
}

.panel.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.panel button {
  border: none;
  padding: 14px;
  text-align: left;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  border-bottom: 1px solid #111;
}

#downloadSelected {
  background: #0078d7;
}

#downloadAll {
  background: #00a300;
}

#downloadRange {
  background: #ff8c00;
}

.panel button:hover {
  filter: brightness(1.1);
}

#rangeInput {
  padding: 12px;
  border: none;
  outline: none;
  background: #1a1a1f;
  color: #fff;
  border-top: 1px solid #111;
}

/* =========================
   FLOATING BUTTON
========================= */
#hidden-colapsible-button {
  position: fixed;
  bottom: 20px;
  left: 20px;
  background: #e81123;
  color: white;
  padding: 16px 22px;
  font-weight: bold;
  cursor: pointer;
  user-select: none;
  box-shadow: 0 4px 0 #7a0b12;
}

#hidden-colapsible-button::after {
  content: " ➜";
  display: inline-block;
  transition: 0.2s;
}

#hidden-colapsible-button.open::after {
  transform: rotate(-90deg);
}

/* =========================
   PREVIEW GRID (FIXED)
========================= */
.preview-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 20px;
  width: 100%;
}

/* FIXED CARD STYLE */
.page-card {
  background: #141418;
  border: 1px solid #1f1f1f;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  overflow: hidden;
  padding: 8px;
}

/* CANVAS FIX (IMPORTANT) */
.page-card canvas {
  width: 100%;
  height: auto;
  display: block;
  max-width: 100%;
}

/* label */
.page-card label {
  margin-top: 6px;
  font-size: 12px;
  color: #aaa;
}

/* =========================
   TABLET
========================= */
@media (max-width: 900px) {
  .panel {
    width: 260px;
  }

  .preview-container {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }
}

/* =========================
   MOBILE
========================= */
@media (max-width: 600px) {
  .preview-container {
    grid-template-columns: 1fr;
  }

  .panel {
    width: calc(100% - 40px);
    left: 20px;
  }

  #hidden-colapsible-button {
    width: calc(100% - 40px);
    text-align: center;
  }
}

