/* ==========================================================================
   ArtBot AI — PDF to Images Studio Stylesheet (Dark Tech Neo-SaaS)
   ========================================================================== */

:root {
  --bg-main: #07090e;
  --bg-card: #0e111a;
  --bg-card-hover: #131724;
  --bg-panel: #0a0d15;
  --bg-input: #111522;
  --bg-glass: rgba(14, 17, 26, 0.75);
  
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-active: rgba(0, 240, 255, 0.45);
  
  --cyan: #00f0ff;
  --cyan-glow: rgba(0, 240, 255, 0.25);
  --purple: #a855f7;
  --purple-glow: rgba(168, 85, 247, 0.25);
  --emerald: #00ff9d;
  --danger: #ef4444;

  --text-main: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --font-display: 'Unbounded', sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-pill: 9999px;
  
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background-image: 
    radial-gradient(ellipse 60% 40% at 50% -10%, rgba(0, 240, 255, 0.08), transparent 70%),
    radial-gradient(ellipse 40% 30% at 85% 20%, rgba(168, 85, 247, 0.06), transparent 60%);
  background-attachment: fixed;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */
.app-header {
  height: 72px;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.btn-back-catalog {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-back-catalog:hover {
  background: rgba(0, 240, 255, 0.1);
  border-color: var(--cyan);
  color: var(--cyan);
  box-shadow: 0 0 16px var(--cyan-glow);
  transform: translateX(-2px);
}

.app-branding {
  display: flex;
  align-items: center;
  gap: 12px;
}

.branding-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.2), rgba(168, 85, 247, 0.2));
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cyan);
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.15);
}

.app-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.2;
}

.text-gradient {
  background: linear-gradient(90deg, var(--cyan), var(--purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.app-tagline {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.security-badge {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: rgba(0, 255, 157, 0.05);
  border: 1px solid rgba(0, 255, 157, 0.2);
  color: var(--emerald);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.security-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 8px var(--emerald);
  animation: pulse-dot 2s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #00f0ff, #7928ca);
  border: none;
  color: #ffffff;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-normal);
  box-shadow: 0 4px 18px rgba(0, 240, 255, 0.25);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(0, 240, 255, 0.4);
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-secondary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-icon-text {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-icon-text:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--danger);
}

.btn-icon-text:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-link {
  background: none;
  border: none;
  color: var(--cyan);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-link:hover {
  text-decoration: underline;
}

/* ==========================================================================
   Layout Structure
   ========================================================================== */
.app-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  flex: 1;
  min-height: calc(100vh - 72px);
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

/* ==========================================================================
   Sidebar Settings Panel
   ========================================================================== */
.sidebar-panel {
  background: var(--bg-panel);
  border-right: 1px solid var(--border-subtle);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow-y: auto;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.section-header svg {
  color: var(--cyan);
}

.section-header h2 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  flex: 1;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.control-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.control-hint code {
  color: var(--cyan);
  background: rgba(0, 240, 255, 0.1);
  padding: 2px 4px;
  border-radius: 4px;
}

/* Format Pill Selectors */
.format-pill-group {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  background: var(--bg-input);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.btn-pill {
  padding: 8px 4px;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
}

.btn-pill:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

.btn-pill.active {
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.18), rgba(168, 85, 247, 0.18));
  border: 1px solid var(--cyan);
  color: #ffffff;
  box-shadow: 0 0 14px var(--cyan-glow);
}

/* Inputs & Selects */
.form-select, .form-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition-fast);
}

.form-select:focus, .form-input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px var(--cyan-glow);
}

/* Switch & Toggle */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.toggle-label {
  display: flex;
  flex-direction: column;
  cursor: pointer;
}

.toggle-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-main);
}

.toggle-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: rgba(255, 255, 255, 0.12);
  transition: .3s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
}

input:checked + .slider {
  background-color: var(--cyan);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

.slider.round {
  border-radius: 34px;
}

.slider.round:before {
  border-radius: 50%;
}

/* Target Size Box */
.target-size-box {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.slider-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.slider-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.slider-val-badge {
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--cyan);
  background: rgba(0, 240, 255, 0.12);
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid rgba(0, 240, 255, 0.2);
}

.form-range {
  width: 100%;
  accent-color: var(--cyan);
  cursor: pointer;
}

.quick-size-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.size-chip {
  flex: 1;
  padding: 5px 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  text-align: center;
}

.size-chip:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.size-chip.active {
  background: rgba(0, 240, 255, 0.15);
  border-color: var(--cyan);
  color: var(--cyan);
}

/* Batch Rotate Actions */
.batch-buttons-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn-action-small {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-action-small:hover {
  background: rgba(0, 240, 255, 0.1);
  border-color: var(--cyan);
  color: var(--cyan);
}

/* ==========================================================================
   Workspace & Dropzone
   ========================================================================== */
.workspace-panel {
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  overflow-y: auto;
}

.upload-dropzone {
  border: 2px dashed rgba(255, 255, 255, 0.15);
  padding: 40px 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-normal);
  background: rgba(14, 17, 26, 0.4);
  position: relative;
}

.upload-dropzone:hover, .upload-dropzone.drag-over {
  border-color: var(--cyan);
  background: rgba(0, 240, 255, 0.04);
  box-shadow: 0 0 30px rgba(0, 240, 255, 0.12);
  transform: translateY(-2px);
}

.file-input-hidden {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 10;
}

.dropzone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  pointer-events: none;
}

.dropzone-icon {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.12), rgba(168, 85, 247, 0.12));
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cyan);
  box-shadow: 0 0 25px rgba(0, 240, 255, 0.15);
}

.dropzone-text h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.dropzone-text p {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.btn-browse {
  background: none;
  border: none;
  color: var(--cyan);
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  pointer-events: auto;
}

.file-types-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Progress Box */
.progress-box {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-color: rgba(0, 240, 255, 0.3);
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.1);
}

.progress-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.875rem;
}

.progress-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--cyan);
}

.spinner-inline {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(0, 240, 255, 0.2);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.progress-track {
  width: 100%;
  height: 8px;
  background: var(--bg-input);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--purple));
  border-radius: 4px;
  transition: width 0.2s ease;
  box-shadow: 0 0 12px var(--cyan);
}

/* ==========================================================================
   Pages Gallery & Grid
   ========================================================================== */
.gallery-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.gallery-stats {
  display: flex;
  align-items: center;
  gap: 10px;
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
}

.counter-badge {
  background: rgba(0, 240, 255, 0.12);
  border: 1px solid rgba(0, 240, 255, 0.3);
  color: var(--cyan);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
}

.size-pill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
}

.gallery-help-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.pages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

/* Individual Page Card */
.page-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all var(--transition-normal);
  position: relative;
  user-select: none;
}

.page-card:hover {
  border-color: rgba(0, 240, 255, 0.35);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 240, 255, 0.1);
  transform: translateY(-3px);
}

.page-card.dragging {
  opacity: 0.4;
  border-color: var(--cyan);
  transform: scale(0.96);
}

.page-card.drag-over-target {
  border-color: var(--cyan);
  box-shadow: 0 0 25px var(--cyan);
}

.card-header-bar {
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-subtle);
}

.page-badge {
  font-family: var(--font-display);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--cyan);
  background: rgba(0, 240, 255, 0.12);
  padding: 2px 8px;
  border-radius: 4px;
}

.page-dimensions {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Card Preview Area */
.card-preview-container {
  height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  background: #05070a;
  background-image: 
    linear-gradient(45deg, rgba(255, 255, 255, 0.02) 25%, transparent 25%), 
    linear-gradient(-45deg, rgba(255, 255, 255, 0.02) 25%, transparent 25%), 
    linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.02) 75%), 
    linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, 0.02) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.card-preview-container img, .card-preview-container canvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6);
  transition: transform 0.2s ease;
}

.card-preview-container:hover img {
  transform: scale(1.02);
}

.card-footer-bar {
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.35);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.page-weight-badge {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--emerald);
}

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

.btn-card-action {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-card-action:hover {
  background: rgba(0, 240, 255, 0.15);
  border-color: var(--cyan);
  color: var(--cyan);
}

.btn-card-action.btn-delete:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: var(--danger);
  color: var(--danger);
}

/* Empty State */
.empty-state {
  margin: auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 440px;
  padding: 60px 20px;
}

.empty-icon-pulse {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(0, 240, 255, 0.05);
  border: 1px solid rgba(0, 240, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cyan);
  margin-bottom: 8px;
}

.empty-state h3 {
  font-size: 1.15rem;
  font-weight: 700;
}

.empty-state p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ==========================================================================
   Modals
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-dialog {
  background: #0e111a;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.8), 0 0 35px var(--cyan-glow);
  overflow: hidden;
}

.modal-editor-dialog {
  max-width: 1120px;
  width: 100%;
  height: 90vh;
}

.modal-preview-dialog {
  max-width: 850px;
  width: 100%;
  max-height: 90vh;
}

.modal-header {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.15rem;
  font-weight: 700;
}

.editor-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.btn-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  transition: all var(--transition-fast);
}

.btn-close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* Editor Toolbar */
.editor-toolbar {
  padding: 10px 24px;
  background: rgba(10, 13, 21, 0.95);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.toolbar-tool-group, .toolbar-actions-group, .toolbar-right-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-right-group {
  margin-left: auto;
}

.toolbar-divider {
  width: 1px;
  height: 24px;
  background: var(--border-subtle);
}

.btn-tool {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-tool:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.btn-tool.active {
  background: rgba(0, 240, 255, 0.15);
  border-color: var(--cyan);
  color: var(--cyan);
  box-shadow: 0 0 12px var(--cyan-glow);
}

.btn-tool-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-tool-action:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.btn-tool-action:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.toolbar-blur-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.blur-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.slider-small {
  width: 100px;
}

.blur-badge {
  font-size: 0.75rem;
  color: var(--cyan);
  font-weight: 700;
  min-width: 36px;
}

/* Editor Body & Canvas */
.editor-body {
  flex: 1;
  overflow: hidden;
  background: #05070a;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
}

.editor-canvas-wrapper {
  position: relative;
  display: inline-block;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
  border-radius: 4px;
  overflow: hidden;
}

#editor-canvas {
  display: block;
  max-width: 100%;
  max-height: calc(90vh - 220px);
  object-fit: contain;
}

/* Crop Box & Handles */
.crop-box {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  border: 2px solid var(--cyan);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.65);
  cursor: move;
  z-index: 20;
}

.crop-grid {
  width: 100%;
  height: 100%;
  position: relative;
  pointer-events: none;
}

.crop-grid-line {
  position: absolute;
  background: rgba(0, 240, 255, 0.3);
}

.crop-grid-line.h1 { top: 33.33%; left: 0; right: 0; height: 1px; }
.crop-grid-line.h2 { top: 66.66%; left: 0; right: 0; height: 1px; }
.crop-grid-line.v1 { left: 33.33%; top: 0; bottom: 0; width: 1px; }
.crop-grid-line.v2 { left: 66.66%; top: 0; bottom: 0; width: 1px; }

.crop-handle {
  position: absolute;
  width: 14px;
  height: 14px;
  background: #ffffff;
  border: 2px solid var(--cyan);
  border-radius: 3px;
  box-shadow: 0 0 8px var(--cyan);
}

.handle-nw { top: -7px; left: -7px; cursor: nwse-resize; }
.handle-ne { top: -7px; right: -7px; cursor: nesw-resize; }
.handle-sw { bottom: -7px; left: -7px; cursor: nesw-resize; }
.handle-se { bottom: -7px; right: -7px; cursor: nwse-resize; }
.handle-n { top: -7px; left: calc(50% - 7px); cursor: ns-resize; }
.handle-s { bottom: -7px; left: calc(50% - 7px); cursor: ns-resize; }
.handle-w { top: calc(50% - 7px); left: -7px; cursor: ew-resize; }
.handle-e { top: calc(50% - 7px); right: -7px; cursor: ew-resize; }

/* Blur Box */
.blur-selection-box {
  position: absolute;
  border: 2px dashed var(--cyan);
  background: rgba(0, 240, 255, 0.2);
  pointer-events: none;
  z-index: 30;
}

/* Modal Footer */
.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border-subtle);
  background: rgba(14, 17, 26, 0.95);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.editor-hint {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.editor-hint strong {
  color: var(--cyan);
}

.footer-buttons {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Preview Modal */
.modal-body-preview {
  padding: 20px;
  background: #05070a;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  max-height: 70vh;
}

.modal-body-preview img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 6px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
}

.preview-meta {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* Hidden Utility */
.hidden {
  display: none !important;
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 1024px) {
  .app-layout {
    grid-template-columns: 1fr;
  }
  .sidebar-panel {
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }
}

@media (max-width: 768px) {
  .app-header {
    height: auto;
    padding: 12px 16px;
    flex-direction: column;
    gap: 12px;
  }
  .header-left, .header-right {
    width: 100%;
    justify-content: space-between;
  }
  .workspace-panel {
    padding: 16px;
  }
  .pages-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 480px) {
  .pages-grid {
    grid-template-columns: 1fr;
  }
}
