/* Rotate PDF - #3d85c6 */
:root {
  --rp-brand: #3d85c6;
  --rp-brand-dark: #2c6396;
  --rp-brand-light: #eaf4fb;
  --rp-brand-border: #b6d5f2;
  --rp-bg: #f4f8fc;
  --rp-surface: rgba(255, 255, 255, 0.92);
  --rp-solid: #ffffff;
  --rp-text: #1a1a1a;
  --rp-muted: #64748b;
  --rp-success: #15803d;
  --rp-success-bg: #dcfce7;
  --rp-shadow: 0 14px 40px rgba(61, 133, 198, 0.15);
  --rp-radius: 18px;
  --rp-font: 'DM Sans', system-ui, sans-serif;
}

#tool-main {
  font-family: var(--rp-font);
  color: var(--rp-text);
  background: var(--rp-bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(61, 133, 198, 0.12), transparent),
    radial-gradient(ellipse 60% 40% at 90% 0%, rgba(91, 163, 224, 0.1), transparent);
  padding-bottom: 32px;
}

.rp-wrap { max-width: 900px; margin: 0 auto; padding: 16px; }

.rp-hero { text-align: center; margin-bottom: 20px; }
.rp-hero h1 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 800;
  color: var(--rp-brand);
  margin: 0 0 8px;
}
.rp-hero p { color: var(--rp-muted); font-size: 0.92rem; margin: 0 auto 10px; max-width: 520px; }
.rp-trust {
  display: inline-flex;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--rp-brand-dark);
  background: var(--rp-brand-light);
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--rp-brand-border);
}

.rp-glass {
  background: var(--rp-surface);
  backdrop-filter: blur(12px);
  border: 1px solid var(--rp-brand-border);
  border-radius: var(--rp-radius);
  box-shadow: var(--rp-shadow);
  padding: 20px;
  margin-bottom: 16px;
}

.rp-drop {
  text-align: center;
  padding: 28px 20px;
  cursor: pointer;
  border: 2px dashed var(--rp-brand);
  transition: background 0.15s, border-color 0.15s;
}
.rp-drop:hover, .rp-drop:focus-visible, .rp-drop.is-dragover {
  background: var(--rp-brand-light);
  border-color: var(--rp-brand-dark);
  outline: none;
}
.rp-drop.has-file { padding: 16px; border-style: solid; }
.rp-drop-icon { font-size: 2.2rem; margin-bottom: 8px; }
.rp-drop h2 { font-size: 1rem; font-weight: 700; margin: 0 0 4px; color: var(--rp-brand-dark); }
.rp-drop p { font-size: 0.85rem; color: var(--rp-muted); margin: 0; }

.rp-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.rp-file-meta { font-size: 0.85rem; color: var(--rp-muted); margin: 0; }
.rp-file-meta strong { color: var(--rp-brand-dark); }
.rp-toolbar-actions { display: flex; flex-wrap: wrap; gap: 6px; }

.rp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 14px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.82rem;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.rp-btn--primary {
  background: var(--rp-brand);
  color: #fff;
  box-shadow: 0 4px 14px rgba(61, 133, 198, 0.28);
}
.rp-btn--primary:hover:not(:disabled) { background: var(--rp-brand-dark); }
.rp-btn--ghost {
  background: var(--rp-solid);
  border: 1px solid var(--rp-brand-border);
  color: var(--rp-brand-dark);
}
.rp-btn--ghost:hover:not(:disabled) { background: var(--rp-brand-light); }
.rp-btn--lg { padding: 13px 22px; font-size: 0.95rem; width: 100%; }
.rp-btn:disabled { opacity: 0.55; cursor: not-allowed; }

.rp-page-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  min-height: 80px;
}
.rp-loading { width: 100%; text-align: center; color: var(--rp-muted); font-size: 0.88rem; padding: 20px; }

.rp-page-card {
  width: 132px;
  position: relative;
  border-radius: 12px;
  border: 1.5px solid var(--rp-brand-border);
  background: var(--rp-solid);
  overflow: hidden;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.rp-page-card:hover {
  border-color: var(--rp-brand);
  box-shadow: 0 6px 16px rgba(61, 133, 198, 0.15);
}
.rp-page-card.is-rotated { border-color: var(--rp-brand); }

.rp-page-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  padding: 8px;
  background: #f1f5f9;
}
.rp-page-thumb img {
  max-width: 100%;
  max-height: 140px;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.rp-page-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: var(--rp-brand);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
}
.rp-rot-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  background: var(--rp-success-bg);
  color: var(--rp-success);
  font-size: 0.62rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 999px;
}

.rp-page-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 6px;
  border-top: 1px solid var(--rp-brand-border);
}
.rp-page-actions button {
  padding: 6px 4px;
  border-radius: 8px;
  border: 1px solid var(--rp-brand-border);
  background: var(--rp-solid);
  font-size: 0.9rem;
  cursor: pointer;
  font-family: inherit;
  color: var(--rp-brand-dark);
}
.rp-page-actions button:hover { background: var(--rp-brand-light); }

.rp-progress { margin-top: 12px; }
.rp-progress[hidden], .rp-workspace[hidden], .rp-result[hidden] { display: none !important; }
.rp-progress-bar {
  height: 6px;
  background: var(--rp-brand-light);
  border-radius: 999px;
  overflow: hidden;
}
.rp-progress-fill {
  height: 100%;
  background: var(--rp-brand);
  width: 0%;
  transition: width 0.2s;
}
.rp-progress-label { font-size: 0.8rem; font-weight: 600; color: var(--rp-brand-dark); margin: 6px 0 0; }

.rp-result {
  text-align: center;
  scroll-margin-top: calc(var(--header-h, 72px) + 16px);
}
.rp-result-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--rp-success);
  background: var(--rp-success-bg);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
}
.rp-filename { margin: 12px 0; text-align: left; max-width: 320px; margin-left: auto; margin-right: auto; }
.rp-filename label { font-size: 0.75rem; font-weight: 700; color: var(--rp-brand-dark); display: block; margin-bottom: 4px; }
.rp-filename input {
  width: 100%;
  padding: 9px 11px;
  border-radius: 8px;
  border: 1px solid var(--rp-brand-border);
  font-size: 0.88rem;
  font-family: inherit;
}

.rp-related {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.rp-related a {
  display: block;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--rp-brand-border);
  background: var(--rp-surface);
  text-decoration: none;
  color: inherit;
}
.rp-related a:hover { background: var(--rp-brand-light); }
.rp-related strong { display: block; font-size: 0.82rem; color: var(--rp-brand-dark); }
.rp-related span { font-size: 0.72rem; color: var(--rp-muted); }

.rp-toast {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
}
.rp-toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }
.rp-toast--success { background: #166534; color: #fff; }
.rp-toast--warning { background: #b45309; color: #fff; }
.rp-toast--error { background: #b91c1c; color: #fff; }
