/* ==========================================================================
   Rotate PDF Suite Stylesheet (css/rotate.css)
   Clean, modern, glassmorphic UI matching PDF Pro Suite design tokens
   ========================================================================== */

/* Main Container Layout */
.rotate-main-wrapper {
  max-width: 1320px;
  margin: 0 auto;
  padding: 30px 24px 60px;
}

/* Hero Header */
.rotate-hero-header {
  text-align: center;
  margin-bottom: 28px;
}

.rotate-hero-header h1 {
  font-size: 2.3rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.rotate-hero-header h1 span {
  color: #ef4444;
}

.rotate-hero-header p {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 680px;
  margin: 0 auto;
  line-height: 1.5;
}

/* ==========================================================================
   1. Initial Dropzone View
   ========================================================================== */
.rotate-dropzone-section {
  display: flex;
  justify-content: center;
  margin: 30px 0 50px;
}

.rotate-dropzone {
  width: 100%;
  max-width: 640px;
  background: var(--bg-surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 2px dashed var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 50px 30px;
  text-align: center;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: var(--shadow-md);
  cursor: pointer;
}

.rotate-dropzone:hover,
.rotate-dropzone.drag-over {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.04);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg), 0 0 0 4px rgba(239, 68, 68, 0.1);
}

.rotate-drop-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-select-pdf {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #ef4444;
  color: #ffffff;
  border: none;
  border-radius: 50px;
  padding: 14px 34px;
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-select-pdf:hover {
  background: #dc2626;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.45);
}

.rotate-drop-subtitle {
  margin-top: 14px;
  font-size: 0.92rem;
  color: var(--text-muted);
}

/* ==========================================================================
   2. Active Workspace Layout
   ========================================================================== */
.rotate-workspace-wrap {
  display: block;
}

.rotate-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 18px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.rotate-toolbar-left,
.rotate-toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-toolbar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-toolbar:hover {
  color: var(--text-primary);
  background: var(--bg-card-subtle);
  border-color: var(--border-focus);
}

.btn-toolbar-primary {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
}

.btn-toolbar-primary:hover {
  background: #dc2626;
  border-color: #dc2626;
  color: #ffffff;
}

.toolbar-counter-pill {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  padding: 5px 12px;
  border-radius: 20px;
}

/* Split Workspace */
.rotate-workspace {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  align-items: start;
}

@media (max-width: 960px) {
  .rotate-workspace {
    grid-template-columns: 1fr;
  }
}

/* Card Grid */
.rotate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 18px;
  min-height: 300px;
  padding: 18px;
  background: var(--bg-surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

/* Individual Page Card */
.rotate-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, border-color 0.2s ease;
  box-shadow: var(--shadow-sm);
  user-select: none;
}

.rotate-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: rgba(239, 68, 68, 0.4);
}

.rotate-card.is-selected {
  border-color: #ef4444 !important;
  background: rgba(239, 68, 68, 0.04);
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.25), var(--shadow-md);
}

.card-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-select-checkbox {
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: #ef4444;
  margin: 0;
  border-radius: 3px;
  transition: transform 0.1s ease;
}

.card-select-checkbox:hover {
  transform: scale(1.1);
}

.rotate-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.card-seq-badge {
  background: var(--bg-card-subtle);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
}

.card-actions-dock {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn-card-action {
  width: 26px;
  height: 26px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-card-action:hover {
  background: var(--bg-card-subtle);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

.btn-card-rotate-right:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

.btn-card-rotate-left:hover {
  color: #3b82f6;
  background: rgba(59, 130, 246, 0.1);
}

.rotate-card-preview {
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
  border: 1px solid var(--border-subtle);
}

[data-theme="dark"] .rotate-card-preview {
  background: #0f172a;
}

.rotate-card-canvas {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  transform-origin: center center;
}

.rotate-card-footer {
  margin-top: 10px;
}

.card-filename {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}

.card-meta-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.card-orient-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-subtle);
  text-transform: capitalize;
}

.card-angle-badge {
  font-weight: 700;
  color: #ef4444;
  font-family: var(--font-mono);
}

/* Add More Card */
.rotate-card-add {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed var(--border-subtle);
  background: var(--bg-card-subtle);
  min-height: 220px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.rotate-card-add:hover {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.05);
  transform: translateY(-3px);
}

.card-add-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.9rem;
}

.rotate-card-add:hover .card-add-inner {
  color: #ef4444;
}

.workspace-drag-over {
  outline: 3px dashed #ef4444;
  outline-offset: -6px;
  background: rgba(239, 68, 68, 0.03);
  border-radius: var(--radius-lg);
}

/* ==========================================================================
   3. Sidebar Control Panel
   ========================================================================== */
.rotate-sidebar {
  background: var(--bg-surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 90px;
}

.rotate-sidebar-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.sidebar-section-label {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.btn-sidebar-reset {
  background: none;
  border: none;
  color: #ef4444;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.btn-sidebar-reset:hover {
  text-decoration: underline;
}

/* Orientation Filter Pills */
.filter-pills-group {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}

.filter-pill-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  color: var(--text-secondary);
}

.filter-pill-btn svg {
  color: var(--text-muted);
  transition: color 0.15s ease;
}

.filter-pill-btn span {
  font-size: 0.8rem;
  font-weight: 600;
}

.filter-pill-btn:hover {
  border-color: var(--border-focus);
  background: var(--bg-card-subtle);
  color: var(--text-primary);
}

.filter-pill-btn.active {
  background: rgba(239, 68, 68, 0.08);
  border-color: #ef4444;
  color: #ef4444;
}

.filter-pill-btn.active svg {
  color: #ef4444;
}

/* Global Rotation Action Buttons */
.batch-rotation-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 22px;
}

.btn-batch-rotate {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 10px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  color: var(--text-primary);
  font-weight: 700;
  font-size: 0.88rem;
}

.btn-batch-rotate svg {
  color: #ef4444;
  transition: transform 0.2s ease;
}

.btn-batch-rotate:hover {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.05);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.btn-batch-rotate-right:hover svg {
  transform: rotate(30deg);
}

.btn-batch-rotate-left:hover svg {
  transform: rotate(-30deg);
}

/* Sidebar Summary Metrics */
.summary-metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border-subtle);
  font-size: 0.9rem;
}

.summary-metric-label {
  color: var(--text-secondary);
}

.summary-metric-val {
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

/* Output Filename Field */
.summary-filename-group {
  margin-bottom: 22px;
}

.summary-filename-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.summary-filename-input-wrap {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color 0.15s ease;
}

.summary-filename-input-wrap:focus-within {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.summary-filename-input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 9px 12px;
  font-size: 0.9rem;
  color: var(--text-primary);
  outline: none;
}

.summary-filename-ext {
  padding-right: 12px;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
}

/* Main Execute Action */
.btn-rotate-action {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #ef4444;
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  padding: 14px 20px;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.35);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-rotate-action:hover {
  background: #dc2626;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.45);
}

/* ==========================================================================
   4. Success View
   ========================================================================== */
.rotate-success-view {
  background: var(--bg-surface);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 50px 30px;
  text-align: center;
  max-width: 680px;
  margin: 30px auto;
  box-shadow: var(--shadow-md);
  animation: fadeIn 0.3s ease-out;
}

.success-badge-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(34, 197, 94, 0.12);
  color: #22c55e;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}

.rotate-success-view h2 {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.rotate-success-view p {
  color: var(--text-muted);
  font-size: 1rem;
  margin-bottom: 28px;
}

.success-action-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.btn-download-rotated {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #ef4444;
  color: #ffffff;
  text-decoration: none;
  font-size: 1.1rem;
  font-weight: 700;
  padding: 14px 34px;
  border-radius: 50px;
  box-shadow: 0 4px 16px rgba(239, 68, 68, 0.35);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  min-width: 260px;
}

.btn-download-rotated:hover {
  background: #dc2626;
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(239, 68, 68, 0.45);
}

.btn-crossover {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  padding: 11px 22px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  min-width: 240px;
}

.btn-crossover:hover {
  border-color: var(--border-focus);
  background: var(--bg-card-subtle);
  transform: translateY(-1px);
}

.btn-rotate-reset {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  padding: 8px;
  margin-top: 6px;
  transition: color 0.15s ease;
}

.btn-rotate-reset:hover {
  color: var(--text-primary);
  text-decoration: underline;
}

/* ==========================================================================
   5. Loading Overlay
   ========================================================================== */
.rotate-loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.2);
  border-top-color: #ef4444;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}

.loading-text {
  color: #ffffff;
  font-size: 1.1rem;
  font-weight: 600;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.hide {
  display: none !important;
}
