/* Premium Change PDF Page Size - styles */

:root {
  --accent-1: #1D4ED8;
  --accent-2: #93C5FD;
  --ink: #1E1B2E;
  --ink-soft: #6B7280;
  --border: #E5E7EB;
  --bg-soft: #EFF6FF;
  --danger: #DC2626;
  --success: #059669;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: linear-gradient(160deg, #EFF6FF 0%, #F5F3FF 45%, #F8FAFC 100%);
  color: var(--ink);
  min-height: 100vh;
}

.app-wrapper {
  max-width: 720px;
  margin: 0 auto;
  padding: 70px 20px 40px;
}

.glass-card {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 24px;
  box-shadow: 0 20px 60px rgba(29, 78, 216, 0.12), 0 2px 8px rgba(0,0,0,0.04);
  padding: 30px 26px;
}

.app-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
}
.app-icon svg { width: 28px; height: 28px; }

.app-title {
  text-align: center;
  font-size: 26px;
  font-weight: 800;
  margin: 0 0 6px;
  letter-spacing: -0.02em;
}
.app-subtitle {
  text-align: center;
  color: var(--ink-soft);
  font-size: 14.5px;
  margin: 0 0 18px;
}

.privacy-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--bg-soft);
  border: 1px solid #BFDBFE;
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  color: #1E3A8A;
  margin-bottom: 22px;
}
.privacy-note svg { width: 20px; height: 20px; flex: none; margin-top: 1px; color: var(--accent-1); }

.screen { display: none; }
.screen.active { display: block; }

/* ---------------- Upload ---------------- */
.upload-zone {
  border: 2px dashed #BFDBFE;
  border-radius: 18px;
  background: var(--bg-soft);
  padding: 56px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--accent-1);
  background: #DBEAFE;
}
.upload-icon { width: 46px; height: 46px; color: var(--accent-1); margin-bottom: 14px; }
.upload-text { font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.upload-subtext { color: var(--ink-soft); font-size: 13px; margin-bottom: 14px; }
.btn-choose {
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  color: #fff;
  border: none;
  padding: 11px 26px;
  border-radius: 30px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.upload-meta { margin-top: 16px; font-size: 12px; color: #9CA3AF; }

.load-progress-card {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-soft);
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
}
.spinner { width: 20px; height: 20px; flex: none; animation: spin 0.9s linear infinite; }
.spinner circle { stroke: var(--accent-1); stroke-dasharray: 46; stroke-dashoffset: 14; stroke-linecap: round; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- Toolbar ---------------- */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.toolbar-file { font-size: 13.5px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.link-btn { background: none; border: none; color: var(--accent-1); font-weight: 700; font-size: 13px; cursor: pointer; padding: 0; }

/* ---------------- Page summary + list ---------------- */
.page-summary-card {
  background: var(--bg-soft);
  border-radius: 14px;
  padding: 14px 18px;
  margin-bottom: 14px;
  text-align: center;
}
.page-summary-row { display: flex; align-items: baseline; justify-content: center; gap: 8px; }
.page-summary-num { font-size: 26px; font-weight: 800; color: var(--accent-1); }
.page-summary-label { font-size: 13px; color: var(--ink-soft); font-weight: 600; }
.page-summary-note { font-size: 12.5px; color: var(--ink-soft); margin-top: 4px; }

.page-list-wrap { margin-bottom: 20px; }
.page-list {
  max-height: 190px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}
.page-list::-webkit-scrollbar { width: 8px; }
.page-list::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 4px; }
.page-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  padding: 9px 14px;
  font-size: 12.5px;
  border-bottom: 1px solid #F1F5F9;
}
.page-row:last-child { border-bottom: none; }
.page-row-num { font-weight: 800; color: var(--ink-soft); width: 26px; flex: none; }
.page-row-orient {
  width: 18px; height: 22px; flex: none; border: 1.5px solid #CBD5E1; border-radius: 3px; background: #F8FAFC;
}
.page-row-orient.landscape { width: 22px; height: 18px; }
.page-row-size { flex: 1; min-width: 90px; color: var(--ink); font-weight: 600; }
.page-row-arrow { color: var(--ink-soft); flex: none; }
.page-row-new { color: var(--accent-1); font-weight: 700; flex: none; }
.page-row-scale {
  flex: none;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  background: #F1F5F9;
  color: var(--ink-soft);
}
.page-row-scale.native { background: #ECFDF5; color: var(--success); }

/* ---------------- Panel sections ---------------- */
.panel-section { margin-bottom: 20px; }
.panel-label {
  display: block;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  margin-bottom: 10px;
}
.panel-hint-inline { text-transform: none; font-weight: 500; letter-spacing: normal; }

.paper-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
@media (max-width: 560px) { .paper-grid { grid-template-columns: repeat(3, 1fr); } }
.paper-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border: 1.5px solid var(--border);
  background: #fff;
  border-radius: 12px;
  padding: 10px 6px 8px;
  cursor: pointer;
  transition: border-color .12s ease, background-color .12s ease;
}
.paper-card:hover { border-color: var(--accent-2); }
.paper-card.active { border-color: var(--accent-1); background: var(--bg-soft); }
.paper-shape {
  display: block;
  background: #E2E8F0;
  border: 1.5px solid #94A3B8;
  border-radius: 2px;
}
.paper-card.active .paper-shape { background: var(--accent-2); border-color: var(--accent-1); }
.paper-shape.a4 { width: 22px; height: 30px; }
.paper-shape.letter { width: 22px; height: 28px; }
.paper-shape.legal { width: 18px; height: 30px; }
.paper-shape.a3 { width: 26px; height: 32px; }
.paper-shape.a5 { width: 20px; height: 26px; }
.paper-name { font-size: 12.5px; font-weight: 800; }
.paper-dims { font-size: 10px; color: var(--ink-soft); text-align: center; }

.orientation-row { display: flex; flex-wrap: wrap; gap: 8px; }
.radio-pill {
  flex: 1;
  min-width: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 10px 8px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  color: var(--ink-soft);
  text-align: center;
}
.radio-pill em { font-style: normal; font-weight: 500; opacity: 0.75; }
.radio-pill input { display: none; }
.radio-pill:has(input:checked) { border-color: var(--accent-1); background: var(--bg-soft); color: var(--accent-1); }
.radio-pill.checked { border-color: var(--accent-1); background: var(--bg-soft); color: var(--accent-1); }

.btn-compress {
  width: 100%;
  margin-top: 4px;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  color: #fff;
  border: none;
  padding: 14px 20px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-compress svg { width: 20px; height: 20px; }
.btn-compress:hover { filter: brightness(1.08); }

/* ---------------- Processing ---------------- */
.processing-screen { text-align: center; padding: 30px 0; }
.progress-circle-wrap { position: relative; width: 170px; height: 170px; margin: 0 auto 20px; }
.progress-circle-wrap svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.progress-circle-bg { fill: none; stroke: var(--bg-soft); stroke-width: 10; }
.progress-circle-fg { fill: none; stroke: var(--accent-1); stroke-width: 10; stroke-linecap: round; transition: stroke-dashoffset 0.2s ease; }
.progress-percent { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 800; }
.processing-message { font-weight: 700; margin-bottom: 4px; }
.processing-subtext { color: var(--ink-soft); font-size: 13px; }

/* ---------------- Result ---------------- */
.result-screen { text-align: center; padding: 10px 0 0; }
.result-badge {
  width: 64px; height: 64px; border-radius: 50%;
  background: #ECFDF5; color: var(--success);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
}
.result-badge svg { width: 30px; height: 30px; }
.result-title { font-size: 20px; font-weight: 800; margin-bottom: 10px; }

.quality-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: #ECFDF5; color: var(--success);
  padding: 6px 14px; border-radius: 30px; font-size: 12.5px; font-weight: 700;
}

.result-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 20px 0; }
@media (max-width: 480px) { .result-stats { grid-template-columns: repeat(2, 1fr); } }
.result-stat { background: var(--bg-soft); border-radius: 12px; padding: 12px 6px; }
.result-stat-label { font-size: 10.5px; color: var(--ink-soft); margin-bottom: 4px; }
.result-stat-value { font-size: 16px; font-weight: 800; }
.result-stat-value.accent { color: var(--accent-1); }

.download-section { max-width: 380px; margin: 0 auto; }
.download-label { display: block; font-size: 12.5px; font-weight: 700; margin-bottom: 6px; text-align: left; }
.download-filename-input { width: 100%; padding: 11px 14px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 14px; font-size: 14px; }
.btn-download {
  width: 100%;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  color: #fff; border: none; padding: 14px; border-radius: 14px;
  font-weight: 700; font-size: 15px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin-bottom: 10px; text-decoration: none;
}
.btn-download svg { width: 20px; height: 20px; }
.btn-compress-another { width: 100%; background: none; border: none; color: var(--accent-1); font-weight: 700; font-size: 14px; cursor: pointer; padding: 8px; }

.app-footer { text-align: center; color: var(--ink-soft); font-size: 12px; margin-top: 18px; }

/* ---------------- Toasts ---------------- */
.toast-container { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 100000; display: flex; flex-direction: column; gap: 10px; width: min(420px, 92vw); }
.toast-error { background: #fff; border-left: 4px solid var(--danger); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,0.12); padding: 14px 16px; display: flex; gap: 12px; align-items: flex-start; }
.toast-icon { width: 22px; height: 22px; color: var(--danger); flex: none; }
.toast-title { font-weight: 700; font-size: 13.5px; margin-bottom: 2px; }
.toast-message { font-size: 13px; color: var(--ink-soft); }
.toast-close { background: none; border: none; cursor: pointer; color: #9CA3AF; margin-left: auto; }

.d-none { display: none !important; }
