/* ====== Mobile Gate ====== */
@media (max-width: 1023px) {
  #landing-view, #editor-view, footer { display: none !important; }
}

/* ====== Animations ====== */
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

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

@keyframes toast-in {
  from { opacity: 0; transform: translateX(100%); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(100%); }
}

.animate-fade-in {
  animation: fade-in 0.5s ease-out;
}

.animate-fade-in-up {
  animation: fade-in-up 0.5s ease-out;
}

/* ====== Alpha Badge ====== */
.alpha-badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #ff7800;
  background: rgba(255, 120, 0, 0.12);
  border: 1px solid rgba(255, 120, 0, 0.3);
  border-radius: 9999px;
  vertical-align: middle;
  line-height: 1.4;
}

/* ====== Spinner ====== */
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(59, 130, 246, 0.2);
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto;
}

/* ====== Drop Zone ====== */
#drop-zone.drag-over,
#add-more-zone.drag-over {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.1);
  box-shadow: 0 0 30px rgba(59, 130, 246, 0.1);
}

/* ====== Toolbar Buttons ====== */
.toolbar-btn {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #cbd5e1;
  background: transparent;
  border: 1px solid #334155;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.toolbar-btn:hover {
  background: #1e293b;
  border-color: #475569;
  color: #f1f5f9;
}

/* Compact toolbar buttons (row 2) */
.toolbar-btn-sm {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  color: #cbd5e1;
  background: transparent;
  border: 1px solid #334155;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.toolbar-btn-sm:hover {
  background: #1e293b;
  border-color: #475569;
  color: #f1f5f9;
}

.toolbar-btn-sm-danger {
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.3);
}

.toolbar-btn-sm-danger:hover {
  background: rgba(248, 113, 113, 0.1);
  border-color: rgba(248, 113, 113, 0.5);
}

/* Icon-only toolbar buttons (rotate CW/CCW) */
.toolbar-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: #cbd5e1;
  background: transparent;
  border: 1px solid #334155;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.15s;
}

.toolbar-icon-btn:hover {
  background: #1e293b;
  border-color: #475569;
  color: #f1f5f9;
}

.toolbar-btn-danger {
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.3);
}

.toolbar-btn-danger:hover {
  background: rgba(248, 113, 113, 0.1);
  border-color: rgba(248, 113, 113, 0.5);
}

/* ====== Export Dropdown ====== */
.export-dropdown-item {
  border: none;
  background: transparent;
  cursor: pointer;
  transition: background 0.15s;
}

/* ====== Thumbnail Cards ====== */
.page-card {
  position: relative;
  background: #1a2238;
  border: 2px solid transparent;
  border-radius: 0.75rem;
  overflow: hidden;
  cursor: grab;
  transition: all 0.15s;
  user-select: none;
}

.page-card:hover {
  border-color: #334155;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.page-card.selected {
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

.page-card .page-controls {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 0.375rem;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 10;
}

.page-card:hover .page-controls {
  opacity: 1;
}

.page-controls-left {
  display: flex;
  gap: 2px;
}

.page-control-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.375rem;
  border: none;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.15s;
}

.btn-rotate {
  background: rgba(30, 41, 59, 0.9);
  color: #94a3b8;
}

.btn-rotate:hover {
  background: rgba(59, 130, 246, 0.8);
  color: white;
}

.btn-delete {
  background: rgba(30, 41, 59, 0.9);
  color: #94a3b8;
}

.btn-delete:hover {
  background: rgba(239, 68, 68, 0.8);
  color: white;
}

/* Thumbnail Image */
.page-card .thumb-wrapper {
  width: 100%;
  /* aspect-ratio set dynamically per page via JS */
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #111827;
}

.page-card .thumb-wrapper img,
.page-card .thumb-wrapper canvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Page Info Footer */
.page-card .page-info {
  padding: 0.375rem 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: #64748b;
  background: #0f1629;
}

.page-card .page-number {
  font-weight: 600;
  color: #94a3b8;
}

.page-card .source-name {
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ====== SortableJS Ghost ====== */
.sortable-ghost {
  opacity: 0.3;
}

.sortable-chosen {
  cursor: grabbing;
}

.sortable-drag {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  border-color: #3b82f6 !important;
}

/* ====== Toast Notifications ====== */
.toast {
  padding: 0.75rem 1rem;
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 0.5rem;
  color: #e2e8f0;
  font-size: 0.875rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  animation: toast-in 0.3s ease-out;
  max-width: 360px;
}

.toast.toast-error {
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(127, 29, 29, 0.5);
}

.toast.toast-out {
  animation: toast-out 0.3s ease-in forwards;
}

/* ====== Scrollbar ====== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

/* ====== Duplicate Button (page card) ====== */
.btn-duplicate {
  background: rgba(30, 41, 59, 0.9);
  color: #94a3b8;
}

.btn-duplicate:hover {
  background: rgba(59, 130, 246, 0.8);
  color: white;
}

/* ====== Progress Bar ====== */
.progress-bar-track {
  width: 100%;
  height: 6px;
  background: #1e293b;
  border-radius: 3px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: #3b82f6;
  border-radius: 3px;
  transition: width 0.2s ease-out;
}

/* ====== Zoom Slider ====== */
.zoom-slider {
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: #334155;
  border-radius: 2px;
  outline: none;
}

.zoom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: #94a3b8;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.15s;
}

.zoom-slider::-webkit-slider-thumb:hover {
  background: #cbd5e1;
}

.zoom-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: #94a3b8;
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

/* ====== Preview Modal ====== */
#preview-modal img {
  user-select: none;
  -webkit-user-drag: none;
}

/* ====== Suggestion Type Buttons ====== */
.suggestion-type-btn.active {
  background: rgba(59, 130, 246, 0.15);
  border-color: #3b82f6;
  color: #93c5fd;
}

/* ====== Global body drag-over ====== */
body.drag-over-global::after {
  content: '';
  position: fixed;
  inset: 0;
  border: 3px solid #3b82f6;
  border-radius: 0;
  pointer-events: none;
  z-index: 9999;
}
