/* ==========================================================================
   Docuvate - Master PDF Studio & Master Image Studio Pure CSS Design System
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Outfit:wght@500;600;700;800;900&display=swap');

:root {
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Outfit', 'Inter', -apple-system, sans-serif;

  /* Primary Palette */
  --primary: #e11d48;
  --primary-hover: #be123c;
  --primary-light: #ffe4e6;
  --primary-subtle: #fff1f2;
  --primary-text: #9f1239;

  /* Studio Color Schemes */
  --pdf-accent: #e11d48;
  --pdf-gradient: linear-gradient(135deg, #e11d48 0%, #be123c 100%);
  --image-accent: #0284c7;
  --image-gradient: linear-gradient(135deg, #0284c7 0%, #0369a1 100%);
  --cert-accent: #059669;
  --cert-gradient: linear-gradient(135deg, #059669 0%, #047857 100%);
  --inkscribe-accent: #6366f1;
  --inkscribe-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);

  /* Neutral Spectrum */
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --border-light: #e2e8f0;
  --border-focus: #cbd5e1;

  /* Shadows & Radius */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.07);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.05);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.08), 0 8px 10px -6px rgb(0 0 0 / 0.04);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: var(--font-body);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.25;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* ==========================================================================
   Header & Navigation
   ========================================================================== */

.privacy-banner {
  background: #fef9c3;
  color: #854d0e;
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-bottom: 1px solid #fef08a;
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-navbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
  padding: 0.875rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 33px;
  z-index: 99;
}

.brand-logo {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.25rem;
  letter-spacing: -0.03em;
}

.brand-badge {
  background: var(--primary);
  color: white;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 1.2rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-link {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: color var(--transition-fast);
}

.nav-link:hover {
  color: var(--primary);
}

/* ==========================================================================
   Hero Section
   ========================================================================== */

.hero-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 3.5rem 1.5rem 1.5rem;
  text-align: center;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.875rem;
  background: var(--primary-subtle);
  border: 1px solid var(--primary-light);
  color: var(--primary-text);
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  margin-bottom: 1.25rem;
  letter-spacing: 0.02em;
}

.hero-title {
  font-size: 2.75rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: #0f172a;
  margin-bottom: 0.75rem;
}

.hero-subtitle {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 680px;
  margin: 0 auto;
}

/* ==========================================================================
   Two Flagship Studios Layout
   ========================================================================== */

.studios-container {
  max-width: 1200px;
  margin: 2.5rem auto 5rem;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(480px, 1fr));
  gap: 2rem;
}

@media (max-width: 600px) {
  .studios-container {
    grid-template-columns: 1fr;
  }
}

.studio-flagship-card {
  background: white;
  border: 2px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
}

.studio-flagship-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
}

.studio-pdf:hover {
  border-color: #fca5a5;
}

.studio-image:hover {
  border-color: #93c5fd;
}

.studio-header-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.studio-icon-large {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: var(--shadow-md);
}

.pdf-gradient-icon {
  background: var(--pdf-gradient);
}

.image-gradient-icon {
  background: var(--image-gradient);
}

.studio-badge-pill {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-full);
}

.pdf-badge {
  background: #fff1f2;
  color: #e11d48;
  border: 1px solid #fecdd3;
}

.image-badge {
  background: #f0f9ff;
  color: #0284c7;
  border: 1px solid #bae6fd;
}

.studio-card-title {
  font-size: 1.85rem;
  font-weight: 900;
  margin-bottom: 0.75rem;
  color: #0f172a;
}

.studio-card-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1.75rem;
  flex-grow: 1;
}

.studio-features-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 2rem;
}

.feature-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8125rem;
  font-weight: 600;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #334155;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
}

.feature-tag svg {
  width: 14px;
  height: 14px;
  color: #10b981;
}

.btn-studio-launch {
  width: 100%;
  padding: 1.1rem 2rem;
  font-size: 1.05rem;
  font-weight: 800;
  color: white;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  box-shadow: var(--shadow-md);
  transition: all var(--transition-fast);
}

.btn-pdf-launch {
  background: var(--pdf-gradient);
}
.btn-pdf-launch:hover {
  background: linear-gradient(135deg, #be123c 0%, #9f1239 100%);
  transform: translateY(-2px);
  box-shadow: 0 10px 20px -5px rgba(225, 29, 72, 0.4);
}

.btn-image-launch {
  background: var(--image-gradient);
}
.btn-image-launch:hover {
  background: linear-gradient(135deg, #0369a1 0%, #075985 100%);
  transform: translateY(-2px);
  box-shadow: 0 10px 20px -5px rgba(2, 132, 199, 0.4);
}

.studio-cert:hover {
  border-color: #6ee7b7;
}

.cert-gradient-icon {
  background: var(--cert-gradient);
}

.cert-badge {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}

.btn-cert-launch {
  background: var(--cert-gradient);
}
.btn-cert-launch:hover {
  background: linear-gradient(135deg, #047857 0%, #065f46 100%);
  transform: translateY(-2px);
  box-shadow: 0 10px 20px -5px rgba(5, 150, 105, 0.4);
}

.studio-inkscribe:hover {
  border-color: #c7d2fe;
}

.inkscribe-gradient-icon {
  background: var(--inkscribe-gradient);
}

.inkscribe-badge {
  background: #eef2ff;
  color: #6366f1;
  border: 1px solid #c7d2fe;
}

.btn-inkscribe-launch {
  background: var(--inkscribe-gradient);
}
.btn-inkscribe-launch:hover {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  transform: translateY(-2px);
  box-shadow: 0 10px 20px -5px rgba(99, 102, 241, 0.4);
}

/* ==========================================================================
   Master Workstation Modal / Fullscreen Environment
   ========================================================================== */

.workspace-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(10px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.workspace-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.workspace-modal {
  background: #e2e8f0;
  width: 100%;
  max-width: 1320px;
  height: 94vh;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  transform: scale(0.98);
  transition: transform var(--transition-normal);
}

.workspace-overlay.active .workspace-modal {
  transform: scale(1);
}

.workspace-header {
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: white;
  flex-shrink: 0;
}

.workspace-title-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.workspace-title {
  font-size: 1.25rem;
  font-weight: 800;
}

.workspace-close-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  background: #f1f5f9;
  transition: all var(--transition-fast);
}

.workspace-close-btn:hover {
  background: #fee2e2;
  color: var(--primary);
}

.workspace-body {
  overflow: hidden;
  display: flex;
  flex-grow: 1;
}

/* Big Visual Dropzone */
.dropzone-container {
  width: 100%;
  height: 100%;
  padding: 3rem 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8fafc;
}

.dropzone-visual-box {
  width: 100%;
  max-width: 780px;
  border: 4px dashed #cbd5e1;
  border-radius: var(--radius-xl);
  padding: 4.5rem 2rem;
  text-align: center;
  background: white;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

.dropzone-visual-box:hover, .dropzone-visual-box.dragover {
  border-color: var(--primary);
  background: var(--primary-subtle);
  transform: scale(1.01);
}

.dropzone-icon-huge {
  width: 80px;
  height: 80px;
  color: #94a3b8;
  margin-bottom: 1.5rem;
  transition: color var(--transition-fast);
}

.dropzone-visual-box:hover .dropzone-icon-huge, .dropzone-visual-box.dragover .dropzone-icon-huge {
  color: var(--primary);
}

.dropzone-main-text {
  font-size: 1.75rem;
  font-weight: 800;
  color: #1e293b;
  margin-bottom: 1.5rem;
}

.dropzone-select-btn {
  background: var(--primary);
  color: white;
  font-size: 1.1rem;
  font-weight: 800;
  padding: 0.9rem 2.75rem;
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-md);
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.dropzone-select-btn:hover {
  background: var(--primary-hover);
  transform: scale(1.04);
}

/* Two Column Workspace */
.workspace-two-col {
  display: flex;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

@media (max-width: 950px) {
  .workspace-two-col {
    flex-direction: column;
    overflow-y: auto;
  }
}

.workspace-canvas-area {
  flex-grow: 1;
  padding: 1.25rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #e2e8f0;
}

.workspace-sidebar-area {
  width: 390px;
  background: white;
  border-left: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

@media (max-width: 950px) {
  .workspace-sidebar-area {
    width: 100%;
    border-left: none;
    border-top: 1px solid var(--border-light);
  }
}

/* Module Tabs Bar inside Sidebar */
.universal-module-nav {
  display: flex;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-light);
  overflow-x: auto;
  padding: 0.4rem 0.5rem;
  gap: 0.25rem;
  flex-shrink: 0;
}

.universal-module-tab {
  padding: 0.4rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: all var(--transition-fast);
}

.universal-module-tab:hover {
  background: #e2e8f0;
  color: var(--text-main);
}

.universal-module-tab.active {
  background: white;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-light);
}

.sidebar-scroll-content {
  padding: 1.25rem;
  overflow-y: auto;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sidebar-bottom-actions {
  padding: 1.25rem;
  border-top: 1px solid var(--border-light);
  background: #fafafa;
}

/* Page Thumbnail Grid */
.page-grid-container {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  width: 100%;
  max-width: 1000px;
  padding: 0.5rem;
  justify-content: center;
}

.page-list-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  max-width: 650px;
  padding: 0.5rem;
}

.page-card {
  position: relative;
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 0.5rem;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
  display: flex;
  flex-direction: column;
}

.page-grid-container .page-card {
  width: 160px;
}

.page-list-container .page-card {
  width: 100%;
  flex-direction: row;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
}

.page-card:hover {
  border-color: #fca5a5;
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.page-card.selected {
  border-color: var(--primary);
  background: #ffffff;
}

.page-card.excluded {
  border-color: #cbd5e1;
  border-style: dashed;
  opacity: 0.5;
  filter: grayscale(80%);
}

.page-card-order-badge {
  position: absolute;
  top: -8px;
  left: -8px;
  background: #0f172a;
  color: white;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 900;
  box-shadow: var(--shadow-md);
  z-index: 5;
}

.page-img-wrapper {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.page-grid-container .page-img-wrapper {
  width: 100%;
  height: 180px;
}

.page-list-container .page-img-wrapper {
  width: 60px;
  height: 80px;
  flex-shrink: 0;
}

.page-img-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.2s ease;
  pointer-events: none;
}

.page-selected-check {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

.page-details {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-top: 0.5rem;
  flex-grow: 1;
}

.page-list-container .page-details {
  margin-top: 0;
}

.page-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.page-num-label {
  font-size: 0.75rem;
  font-weight: 900;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: -0.01em;
}

.page-source-name {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-muted);
  max-width: 85px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.35rem;
}

.page-action-btn {
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.page-action-btn:hover {
  background: #fee2e2;
  color: var(--primary);
  border-color: #fca5a5;
}

.page-drag-handle {
  cursor: grab;
}
.page-drag-handle:active {
  cursor: grabbing;
}

/* Add More Card in Grid */
.add-page-card {
  width: 160px;
  height: 240px;
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.6);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  color: #64748b;
  gap: 0.5rem;
}

.add-page-card:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: white;
  transform: scale(1.02);
}

/* Preset Buttons */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.preset-btn {
  padding: 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background: white;
  color: var(--text-main);
  transition: all var(--transition-fast);
}

.preset-btn:hover {
  background: #f8fafc;
}

.preset-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* Primary Action Button */
.btn-primary {
  width: 100%;
  padding: 0.875rem 1.25rem;
  background: var(--primary);
  color: white;
  font-weight: 800;
  font-size: 0.95rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all var(--transition-fast);
}

.btn-primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-success {
  background: #10b981;
}
.btn-success:hover {
  background: #059669;
}

/* Progress bar */
.progress-bar-container {
  width: 100%;
  background: #e2e8f0;
  border-radius: var(--radius-full);
  height: 8px;
  overflow: hidden;
  margin-top: 0.5rem;
}

.progress-bar-fill {
  background: var(--primary);
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

/* Results Card */
.result-card {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: var(--radius-lg);
  padding: 2.25rem 2rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  width: 100%;
  max-width: 550px;
  margin: auto;
}

.result-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: white;
  padding: 1rem;
  border-radius: var(--radius-md);
  border: 1px solid #d1fae5;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  background: white;
  border-top: 1px solid var(--border-light);
  padding: 2.5rem 1.5rem;
  text-align: center;
  margin-top: auto;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.dev-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 3px solid var(--primary);
  box-shadow: var(--shadow-md);
  margin-bottom: 0.75rem;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 0.75rem;
}

.footer-link {
  color: var(--text-muted);
  text-decoration: underline;
  font-weight: 500;
}

.footer-link:hover {
  color: var(--primary);
}

/* ==========================================================================
   Visual Crop Overlay & Interactive Bounding Box
   ========================================================================== */

.crop-canvas-wrapper {
  position: relative;
  max-width: 650px;
  width: 100%;
  background: white;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  user-select: none;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: auto;
}

.crop-page-img {
  width: 100%;
  height: auto;
  display: block;
  pointer-events: none;
}

.crop-bounding-overlay {
  position: absolute;
  inset: 0;
  cursor: crosshair;
}

.crop-bounding-box {
  position: absolute;
  border: 2px dashed #e11d48;
  background: rgba(225, 29, 72, 0.12);
  cursor: move;
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.45);
}

.crop-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background: white;
  border: 2px solid #e11d48;
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
}

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

.crop-coords-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(15, 23, 42, 0.85);
  color: white;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  pointer-events: none;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-md);
  background: var(--text-main);
  color: white;
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.2s ease-out;
}

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

/* ==========================================================================
   Certificate Downloader Component Styling
   ========================================================================== */

.cert-tool-wrapper {
  max-width: 760px;
  margin: 3rem auto 5rem;
  padding: 0 1.5rem;
  flex-grow: 1;
}

.cert-main-card {
  background: white;
  border-radius: var(--radius-xl);
  border: 2px solid var(--border-light);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  position: relative;
  transition: all var(--transition-normal);
}

.cert-card-header {
  background: linear-gradient(135deg, #059669 0%, #0284c7 100%);
  padding: 3rem 2rem 2.5rem;
  text-align: center;
  color: white;
  position: relative;
}

.cert-header-pattern {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.12;
  pointer-events: none;
}

.cert-icon-wrapper {
  width: 72px;
  height: 72px;
  background: white;
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  margin: 0 auto 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #059669;
  position: relative;
  z-index: 2;
}

.cert-card-title {
  font-size: 1.85rem;
  font-weight: 900;
  color: white;
  margin-bottom: 0.4rem;
  position: relative;
  z-index: 2;
  letter-spacing: -0.02em;
}

.cert-card-subtitle {
  font-size: 0.95rem;
  font-weight: 500;
  color: #e0e7ff;
  position: relative;
  z-index: 2;
}

.cert-card-body {
  padding: 2.5rem 2.25rem;
  position: relative;
  min-height: 380px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.token-input-group {
  margin-bottom: 1.5rem;
}

.token-input-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.65rem;
}

.token-input-wrapper {
  position: relative;
  width: 100%;
}

.token-input {
  width: 100%;
  background: #f8fafc;
  border: 2px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0.25em;
  text-align: center;
  text-transform: uppercase;
  color: #0f172a;
  outline: none;
  transition: all var(--transition-fast);
  font-family: monospace;
}

.token-input:focus {
  background: white;
  border-color: #059669;
  box-shadow: 0 0 0 4px rgba(5, 150, 105, 0.15);
}

.token-input.is-error {
  border-color: #e11d48 !important;
  box-shadow: 0 0 0 4px rgba(225, 29, 72, 0.15) !important;
}

.token-input-icon {
  position: absolute;
  right: 1.25rem;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  pointer-events: none;
}

.token-error-text {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #e11d48;
  margin-top: 0.5rem;
  display: none;
  align-items: center;
  gap: 0.4rem;
}

.token-error-text.is-visible {
  display: flex;
}

.cert-btn-verify {
  width: 100%;
  padding: 1.15rem 1.5rem;
  font-size: 1.05rem;
  font-weight: 800;
  color: white;
  background: var(--cert-gradient);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 16px -4px rgba(5, 150, 105, 0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  transition: all var(--transition-fast);
  margin-top: 1rem;
}

.cert-btn-verify:hover {
  background: linear-gradient(135deg, #047857 0%, #065f46 100%);
  transform: translateY(-2px);
  box-shadow: 0 12px 20px -4px rgba(5, 150, 105, 0.45);
}

.cert-btn-verify:active {
  transform: scale(0.99);
}

/* Loader View */
.cert-loader-container {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 0;
  text-align: center;
}

.cert-loader-spinner {
  width: 52px;
  height: 52px;
  border: 5px solid #e2e8f0;
  border-bottom-color: #059669;
  border-radius: 50%;
  animation: rotation 1s linear infinite;
  margin-bottom: 1.25rem;
}

@keyframes rotation {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.cert-loader-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 0.35rem;
}

.cert-loader-desc {
  font-size: 0.875rem;
  color: #64748b;
  max-width: 280px;
}

/* Result View */
.cert-result-container {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

.cert-success-badge {
  width: 80px;
  height: 80px;
  background: #ecfdf5;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #059669;
  box-shadow: 0 0 35px rgba(16, 185, 129, 0.25);
  margin-bottom: 1.25rem;
}

.cert-result-title {
  font-size: 1.65rem;
  font-weight: 900;
  color: #0f172a;
  margin-bottom: 0.3rem;
}

.cert-result-desc {
  font-size: 0.9rem;
  color: #64748b;
  margin-bottom: 1.75rem;
}

.cert-token-display-pill {
  background: #f8fafc;
  border: 1.5px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.75rem 1.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
}

.cert-token-label {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  color: #94a3b8;
  letter-spacing: 0.05em;
}

.cert-token-val {
  font-family: monospace;
  font-size: 1.35rem;
  font-weight: 900;
  color: #0f172a;
  letter-spacing: 0.15em;
}

.cert-action-btn-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
}

.cert-btn-download {
  width: 100%;
  padding: 1.15rem 1.5rem;
  font-size: 1.05rem;
  font-weight: 800;
  color: white;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 16px -4px rgba(16, 185, 129, 0.4);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  transition: all var(--transition-fast);
}

.cert-btn-download:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  transform: translateY(-2px);
  box-shadow: 0 12px 20px -4px rgba(16, 185, 129, 0.5);
}

.cert-btn-secondary {
  width: 100%;
  padding: 0.875rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: #334155;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all var(--transition-fast);
}

.cert-btn-secondary:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.cert-btn-reset {
  margin-top: 1.25rem;
  font-size: 0.875rem;
  font-weight: 700;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: color var(--transition-fast);
}

.cert-btn-reset:hover {
  color: #059669;
}

/* Shake Animation */
@keyframes inputShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.shake-it {
  animation: inputShake 0.35s ease-in-out;
}

/* Info and Guide Grid */
.cert-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 3rem;
}

.cert-info-card {
  background: white;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.cert-info-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cert-info-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.6;
}
