/* photo_studio.css — A4 Photo Studio Page Styles */

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: #f8f9fa;
  color: #202124;
  font-size: 13px;
  height: 100vh;
  width: 100%;
  max-width: 100vw;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: hidden;
}

/* ── Header (Fit-to-Screen Flex Layout: Left Tabs, Center Brand Capsule, Right Account) ── */
#studio-header {
  background: #ffffff;
  color: #202124;
  border-bottom: 1px solid #dadce0;
  padding: 6px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  width: 100%;
  max-width: 100vw;
  min-width: 0;
  box-sizing: border-box;
  box-shadow: 0 1px 2px 0 rgba(60,64,67,0.08), 0 1px 3px 1px rgba(60,64,67,0.05);
  gap: 8px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.studio-header-left { display: flex; align-items: center; gap: 6px; flex-shrink: 0; min-width: 0; }
.studio-header-center { display: flex; justify-content: center; align-items: center; flex-shrink: 0; }
.studio-brand-container {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 2px 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  user-select: none;
  flex-shrink: 0;
  box-sizing: border-box;
}
.studio-brand-icon {
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
}
.studio-brand-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1.05;
  text-align: left;
}
.studio-brand-text .brand-title {
  font-size: 11px;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.01em;
}
.studio-brand-text .brand-sub {
  font-size: 8.5px;
  font-weight: 700;
  color: #1a73e8;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.studio-logo {
  font-size: 15px;
  font-weight: 700;
  color: #202124;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.studio-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  background: #f1f3f4;
  padding: 3px 4px;
  border-radius: 20px;
  border: 1px solid #e8eaed;
}
.studio-tab-btn {
  background: transparent;
  color: #5f6368;
  border: 1px solid transparent;
  border-radius: 16px;
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.studio-tab-btn:hover {
  background: #e8eaed;
  color: #202124;
}
.studio-tab-btn.active {
  background: #ffffff;
  color: #1a73e8;
  border-color: #dadce0;
  font-weight: 700;
  box-shadow: 0 1px 2px rgba(60,64,67,0.2);
}
.tab-btn-help {
  background: #fef7e0 !important;
  color: #b06000 !important;
  border: 1px solid #fce8b2 !important;
  font-weight: 600 !important;
}
.tab-btn-help:hover {
  background: #feefc3 !important;
  color: #8c4b00 !important;
}
.header-right {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.auth-badge  { font-size: 11.5px; padding: 4px 11px; border-radius: 14px; font-weight: 600; height: 28px; display: inline-flex; align-items: center; white-space: nowrap; }
.auth-ok     { background: #e6f4ea; color: #137333; border: 1px solid #ceead6; }
.auth-fail   { background: #fce8e6; color: #c5221f; border: 1px solid #fad2cf; }
.auth-warn   { background: #fef7e0; color: #b06000; border: 1px solid #feefc3; }
.auth-loading{ background: #f1f3f4; color: #5f6368; border: 1px solid #dadce0; }

/* ── Popup-Matched Profile Avatar & Popover ── */
.header-user-area {
  position: relative;
  display: flex;
  align-items: center;
}

.header-avatar-btn {
  background: #f1f3f4;
  border: 1.5px solid #dadce0;
  color: #3c4043;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
}

.header-avatar-btn:hover {
  background: #e8eaed;
  transform: scale(1.05);
}

.header-avatar-btn.logged-in {
  background: #10b981;
  border-color: #ffffff;
  color: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}

.header-profile-popover {
  position: absolute;
  top: 36px;
  right: 0;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.16);
  width: 220px;
  padding: 12px;
  z-index: 1000;
  color: #1e293b;
  text-align: left;
}

.popover-arrow {
  position: absolute;
  top: -6px;
  right: 9px;
  width: 10px;
  height: 10px;
  background: #ffffff;
  border-left: 1px solid #cbd5e1;
  border-top: 1px solid #cbd5e1;
  transform: rotate(45deg);
}

.popover-user-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.popover-email {
  font-size: 12px;
  font-weight: 700;
  color: #0f172a;
  word-break: break-all;
  line-height: 1.3;
}

.popover-status {
  font-size: 11px;
  color: #64748b;
  font-weight: 600;
  line-height: 1.3;
}

.popover-quota-detail {
  font-size: 11px;
  font-weight: 700;
  color: #1a73e8;
  margin-top: 2px;
  background: #f0f7ff;
  border: 1px solid #d0e3ff;
  border-radius: 4px;
  padding: 3px 6px;
}

.quota-badge {
  font-size: 11.5px;
  padding: 4px 11px;
  border-radius: 14px;
  font-weight: 600;
  background: #e8f0fe;
  color: #1a73e8;
  border: 1px solid #d2e3fc;
  height: 28px;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}
.quota-badge-pro { background: #e8f0fe; color: #1967d2; border: 1px solid #c2e7ff; }
.quota-badge-free{ background: #f1f3f4; color: #3c4043; border: 1px solid #dadce0; }
.quota-badge-none{ background: #fce8e6; color: #c5221f; border: 1px solid #fad2cf; }

/* ── Main layout ── */
#studio-main {
  display: flex;
  flex: 1;
  overflow: hidden;
  width: 100%;
  min-width: 0;
}

/* ── Controls ── */
#studio-controls {
  width: 276px;
  flex-shrink: 0;
  background: #ffffff;
  border-right: 1px solid #dadce0;
  overflow-y: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ctrl-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f1f3f4;
}
.ctrl-section:last-child {
  border-bottom: none;
}
.ctrl-label   { font-size: 11px; font-weight: 700; color: #3c4043; text-transform: uppercase; letter-spacing: 0.05em; }
.ctrl-btn {
  padding: 7px 12px;
  border: 1px solid #dadce0;
  border-radius: 6px;
  background: #ffffff;
  color: #3c4043;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(60,64,67,0.05);
}
.ctrl-btn:hover  { background: #f8f9fa; border-color: #bdc1c6; color: #1a73e8; }
.ctrl-btn:disabled{ opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.ctrl-btn-primary {
  background: #1a73e8;
  color: #fff;
  border-color: #1a73e8;
  box-shadow: 0 1px 2px rgba(26,115,232,0.3);
}
.ctrl-btn-primary:not(:disabled):hover {
  background: #1557b0;
  border-color: #1557b0;
  color: #fff;
}
.ctrl-file-label { cursor: pointer; }
.ctrl-or  { text-align: center; color: #80868b; font-size: 11px; }
.ctrl-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ctrl-input {
  border: 1px solid #dadce0;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12px;
  flex: 1;
  background: #ffffff;
  color: #202124;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.ctrl-input:focus {
  outline: none;
  border-color: #1a73e8;
  box-shadow: 0 0 0 2px rgba(26,115,232,0.15);
}
.ctrl-input-sm {
  border: 1px solid #dadce0;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12px;
  width: 55px;
  text-align: center;
  background: #ffffff;
  color: #202124;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.ctrl-input-sm:focus {
  outline: none;
  border-color: #1a73e8;
  box-shadow: 0 0 0 2px rgba(26,115,232,0.15);
}
.status-box {
  background: #f8f9fa;
  border: 1px solid #e8eaed;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 11.5px;
  color: #5f6368;
  line-height: 1.4;
}
.status-ok  { background: #e6f4ea; border-color: #ceead6; color: #137333; }
.status-err { background: #fce8e6; border-color: #fad2cf; color: #c5221f; }
.quota-val  { font-size: 11px; font-weight: 700; color: #1a73e8; }
.ctrl-hint  {
  background: #f1f3f4;
  border: 1px solid #e8eaed;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 11px;
  line-height: 1.6;
  color: #3c4043;
}

.btn-upgrade-studio {
  background: #1a73e8;
  color: #fff;
  border: none;
  border-radius: 14px;
  padding: 4px 13px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(26,115,232,0.25);
  transition: all 0.15s;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  margin: 0;
}
.btn-upgrade-studio:hover {
  background: #1557b0;
}

.btn-upgrade-studio.btn-renew-pulse {
  background: #d93025;
  color: #ffffff;
  box-shadow: 0 0 0 0 rgba(217, 48, 37, 0.5);
  animation: renewGentlePulse 2s ease-in-out infinite;
}
.btn-upgrade-studio.btn-renew-pulse:hover {
  animation-play-state: paused;
  background: #b3261e;
  box-shadow: 0 2px 8px rgba(179, 38, 30, 0.4);
}

/* Sparkling Pulse Feedback Animation for Download Button */
@keyframes btnSparklePulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(19, 115, 51, 0.6);
  }
  50% {
    transform: scale(1.03);
    box-shadow: 0 0 16px 4px rgba(19, 115, 51, 0.85);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(19, 115, 51, 0);
  }
}

.btn-sparkle {
  animation: btnSparklePulse 1.1s ease-in-out infinite !important;
}

/* Quick Sheets Attached Popover */
.quick-sheets-popover {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  width: 100%;
  box-sizing: border-box;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.16);
  padding: 12px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  animation: popoverFadeIn 0.15s ease-out;
}
.quick-sheets-popover::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 10px;
  height: 10px;
  background: #ffffff;
  border-right: 1px solid #cbd5e1;
  border-bottom: 1px solid #cbd5e1;
}
@keyframes popoverFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes renewGentlePulse {
  0% {
    background-color: #d93025;
    box-shadow: 0 0 0 0 rgba(217, 48, 37, 0.55);
    transform: scale(1);
  }
  50% {
    background-color: #ea4335;
    box-shadow: 0 0 12px 2px rgba(234, 67, 53, 0.45);
    transform: scale(1.02);
  }
  100% {
    background-color: #d93025;
    box-shadow: 0 0 0 0 rgba(217, 48, 37, 0.55);
    transform: scale(1);
  }
}

/* ── Preview area ── */
#studio-preview {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  background: #f8f9fa;
}
#preview-placeholder {
  margin-top: 60px;
  color: #80868b;
  font-size: 14px;
  text-align: center;
}
#printable-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
}

/* ── A4 Page (screen & print view) ── */
.a4-page {
  background: #fff;
  width: 210mm;
  height: 297mm;
  max-height: 297mm;
  box-shadow: 0 1px 3px 0 rgba(60,64,67,0.15), 0 2px 6px 2px rgba(60,64,67,0.08);
  border: 1px solid #dadce0;
  padding: 7mm 8mm;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 2mm;
  position: relative;
  overflow: hidden;
}

.a4-page-header {
  height: 22mm;
  min-height: 22mm;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1.5px solid #202124;
  padding-bottom: 1.5mm;
  margin-bottom: 1.5mm;
  box-sizing: border-box;
}

.a4-page-info { font-size: 8.5pt; color: #202124; line-height: 1.35; }
.a4-page-qr   { flex-shrink: 0; display: flex; align-items: center; }
.a4-page-qr svg { width: 72px; height: 72px; display: block; }

/* ── Grid Container & 4 Optical Registration Markers (Crosshairs for Scale/Tilt Calibration) ── */
.grid-wrap {
  position: relative;
  width: 100%;
  box-sizing: border-box;
}

/* ── Edge Timing Marks (OMR-Style Visual Alignment) ── */
.edge-mark-top {
  position: absolute;
  top: -2.8mm;
  width: 4mm;
  height: 2mm;
  transform: translateX(-50%);
  z-index: 10;
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
}
.edge-mark-left {
  position: absolute;
  left: -2.8mm;
  width: 2mm;
  height: 4mm;
  transform: translateY(-50%);
  z-index: 10;
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
}
.edge-mark-top svg, .edge-mark-left svg {
  display: block;
  width: 100%;
  height: 100%;
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
}

/* ── 5×5 Photo Grid ── */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 2.5mm;
  width: 100%;
  box-sizing: border-box;
}

/* 3.5cm x 4.5cm Passport Photo Boundary */
.photo-box {
  height: 47mm;
  max-height: 47mm;
  box-sizing: border-box;
  border: 1.2px dashed #bdc1c6;
  border-radius: 1.5mm;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: #ffffff;
  position: relative;
  padding: 2mm 1.5mm;
}

/* Watermark Guide Text (Completely hidden beneath pasted 3.5x4.5cm photo) */
.photo-box-watermark {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 1.2mm;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.pb-sl {
  font-size: 7.2pt;
  font-weight: 800;
  color: #1a73e8;
  background: #e8f0fe;
  border: 1px solid #d2e3fc;
  border-radius: 3px;
  padding: 0.5mm 3mm;
  display: inline-block;
  letter-spacing: 0.5px;
}

.pb-name {
  font-size: 6.8pt;
  font-weight: 700;
  color: #202124;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pb-father {
  font-size: 5.8pt;
  font-weight: 500;
  color: #5f6368;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pb-paste-hint {
  font-size: 5.5pt;
  color: #80868b;
  margin-top: 1mm;
  border: 1px dashed #dadce0;
  border-radius: 2px;
  padding: 0.8mm 2mm;
  background: #f8f9fa;
}

/* ── Modals (Login Gate & Plan Purchase Gate) ── */
.studio-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(32, 33, 36, 0.6);
  backdrop-filter: blur(4px);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 12px;
  animation: fadeIn 0.18s ease-out;
}

.studio-modal-card {
  background: #ffffff;
  border-radius: 12px;
  padding: 24px;
  width: 90%;
  max-width: 440px;
  text-align: center;
  box-shadow: 0 4px 24px rgba(60, 64, 67, 0.25);
  border: 1px solid #dadce0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.studio-plans-modal-card {
  max-width: 980px;
  padding: 20px 24px;
  text-align: left;
  align-items: stretch;
}

.plans-modal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #e8eaed;
  padding-bottom: 12px;
  width: 100%;
}

.modal-close-btn {
  background: #f1f3f4;
  border: 1px solid #dadce0;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #5f6368;
  cursor: pointer;
  transition: all 0.15s;
}
.modal-close-btn:hover { background: #fce8e6; color: #d93025; border-color: #fad2cf; }

.modal-icon { font-size: 40px; margin-bottom: 4px; }
.studio-modal-card h2 { font-size: 18px; color: #202124; font-weight: 700; }
.studio-modal-card p { font-size: 13px; color: #5f6368; line-height: 1.55; }

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  margin-top: 8px;
}

.modal-btn-primary {
  background: #1a73e8;
  color: #ffffff;
  border: 1px solid #1a73e8;
  border-radius: 6px;
  padding: 9px 18px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: 0 1px 2px rgba(26, 115, 232, 0.25);
}
.modal-btn-primary:hover {
  background: #1557b0;
  border-color: #1557b0;
}

.modal-btn-secondary {
  background: #ffffff;
  color: #3c4043;
  border: 1px solid #dadce0;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.modal-btn-secondary:hover { background: #f8f9fa; border-color: #bdc1c6; }

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

/* ── Slicing Loading Modal Animation ── */
.slice-icon-anim {
  display: inline-block;
  animation: sliceIconPulse 1.2s ease-in-out infinite;
}

@keyframes sliceIconPulse {
  0% { transform: scale(1) rotate(0deg); }
  50% { transform: scale(1.18) rotate(-8deg); }
  100% { transform: scale(1) rotate(0deg); }
}

.cropper-modal-progress-track {
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* ── Cropper View Layout ── */
.cropper-view-container {
  display: flex;
  flex: 1;
  overflow: hidden;
  width: 100%;
  min-width: 0;
}

.cropper-left-panel {
  width: 290px;
  flex-shrink: 0;
  background: #ffffff;
  border-right: 1px solid #dadce0;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cropper-right-panel {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  background: #f8f9fa;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cropper-dropzone {
  border: 2px dashed #dadce0;
  border-radius: 10px;
  padding: 22px 14px;
  text-align: center;
  background: #f8f9fa;
  transition: all 0.15s ease;
}
.cropper-dropzone:hover, .cropper-dropzone.dropzone-hover {
  border-color: #1a73e8;
  background: #e8f0fe;
}

.drop-icon { font-size: 32px; margin-bottom: 4px; }
.drop-title { font-size: 13px; font-weight: 700; color: #202124; }
.drop-sub { font-size: 11px; color: #5f6368; margin-top: 2px; }

/* ── Progress Bar ── */
.cropper-progress-card {
  background: #e8f0fe;
  border: 1px solid #d2e3fc;
  border-radius: 8px;
  padding: 10px 12px;
}
.cropper-progress-track {
  height: 6px;
  background: #dadce0;
  border-radius: 3px;
  overflow: hidden;
}
.cropper-progress-fill {
  height: 100%;
  background: #1a73e8;
  transition: width 0.25s ease-out;
}

/* ── Cropper Photo Gallery ── */
.cropper-placeholder {
  margin-top: 80px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cropper-filter-pills {
  display: flex;
  align-items: center;
  gap: 6px;
}
.filter-pill {
  background: #f1f3f4;
  border: 1px solid #dadce0;
  border-radius: 16px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 500;
  color: #3c4043;
  cursor: pointer;
  transition: all 0.15s;
}
.filter-pill:hover {
  background: #e8eaed;
  color: #202124;
}
.filter-pill.active {
  background: #e8f0fe;
  color: #1a73e8;
  border-color: #c2e7ff;
  font-weight: 700;
  box-shadow: none;
}
.filter-pill-action {
  background: #fef7e0;
  color: #b06000;
  border-color: #fce8b2;
}
.filter-pill-action:hover {
  background: #feefc3;
  color: #8c4b00;
}

.cropper-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(115px, 1fr));
  gap: 12px;
  width: 100%;
}

.crop-card {
  background: #fff;
  border: 1px solid #dadce0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(60,64,67,0.1);
  display: flex;
  flex-direction: column;
  transition: all 0.15s ease;
}
.crop-card:hover { transform: translateY(-2px); box-shadow: 0 3px 8px rgba(60,64,67,0.15); border-color: #bdc1c6; }

.crop-card-blank {
  opacity: 0.5;
  border: 1px dashed #dadce0;
  background: #f8f9fa;
}

.crop-card-locked {
  border: 1px solid #fecaca;
  background: #fff5f5;
}
.crop-card-locked:hover {
  border-color: #f87171;
  box-shadow: 0 3px 8px rgba(220, 38, 38, 0.15);
}

.crop-img-wrap {
  width: 100%;
  height: 145px;
  position: relative;
  background: #f8f9fa;
  display: flex;
  align-items: center;
  justify-content: center;
}
.crop-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.crop-blank-overlay {
  position: absolute;
  top: 6px;
  right: 6px;
  background: #d93025;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

.crop-meta {
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: #fff;
  border-top: 1px solid #f1f3f4;
}
.crop-sl {
  font-size: 10px;
  font-weight: 800;
  color: #1a73e8;
}
.crop-name {
  font-size: 10px;
  font-weight: 600;
  color: #202124;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Interactive Grid Tuning Panel & Canvas Overlay ── */
#grid-tuning-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #ffffff;
  border: 1px solid #dadce0;
  border-radius: 8px;
  padding: 12px;
}
.grid-tuning-title {
  font-size: 12px;
  font-weight: 700;
  color: #202124;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.grid-slider-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.grid-slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: #5f6368;
}
.grid-slider-val {
  font-weight: 700;
  color: #1a73e8;
  font-size: 11px;
}
.grid-slider-row input[type="range"] {
  width: 100%;
  accent-color: #1a73e8;
  cursor: pointer;
  height: 4px;
}
.grid-slider-control {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}
.grid-slider-control input[type="range"] {
  flex: 1;
  accent-color: #1a73e8;
  cursor: pointer;
  height: 4px;
}
.btn-step {
  width: 22px;
  height: 22px;
  border: 1px solid #dadce0;
  background: #ffffff;
  border-radius: 4px;
  font-weight: 700;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #3c4043;
  transition: all 0.15s ease;
  flex-shrink: 0;
  user-select: none;
}
.btn-step:hover {
  background: #f1f3f4;
  color: #1a73e8;
  border-color: #1a73e8;
}
.btn-step:active {
  background: #e8f0fe;
  transform: scale(0.94);
}
.zoom-badge {
  font-size: 11px;
  font-weight: 700;
  color: #3c4043;
  background: #f1f3f4;
  border: 1px solid #dadce0;
  border-radius: 4px;
  padding: 3px 6px;
  min-width: 44px;
  text-align: center;
  user-select: none;
}
.grid-nudge-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin-top: 4px;
}
.btn-nudge {
  background: #fff;
  border: 1px solid #dadce0;
  border-radius: 4px;
  padding: 4px 6px;
  font-size: 11px;
  font-weight: 600;
  color: #3c4043;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
}
.btn-nudge:hover { background: #f1f3f4; border-color: #bdc1c6; color: #1a73e8; }
.btn-nudge.active {
  background: #e8f0fe;
  border-color: #1a73e8;
  color: #1a73e8;
  font-weight: 700;
}

/* Interactive Scalable Canvas Viewport */
.canvas-interactive-viewport {
  position: relative;
  width: 100%;
  max-width: 950px;
  height: calc(100vh - 170px);
  min-height: 480px;
  overflow: auto;
  border: 1px solid #dadce0;
  border-radius: 8px;
  background: #202124;
  box-shadow: inset 0 1px 4px rgba(0,0,0,0.2);
  display: flex;
  justify-content: safe center;
  align-items: safe center;
  padding: 16px;
}
.canvas-interactive-container {
  margin: auto;
  position: relative;
  display: inline-block;
  cursor: move;
  box-shadow: 0 4px 25px rgba(0,0,0,0.45);
  line-height: 0;
  transform-origin: center center;
  transition: transform 0.15s ease-out;
}
.canvas-interactive-container:active {
  cursor: grabbing;
}
#canvas-interactive-master {
  display: block;
  max-height: calc(100vh - 210px);
  width: auto;
  max-width: 100%;
  object-fit: contain;
}
.grid-overlay-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ✂️ Edit Button on Photo Card */
.crop-btn-edit {
  background: #ffffff;
  border: 1px solid #dadce0;
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 10px;
  font-weight: 600;
  color: #3c4043;
  cursor: pointer;
  margin-top: 4px;
  text-align: center;
  transition: all 0.15s;
}
.crop-btn-edit:hover { background: #e8f0fe; color: #1a73e8; border-color: #1a73e8; }

/* ── Individual Photo Adjustment Modal (15% Margin) ── */
.editor-modal-card {
  max-width: 920px;
  width: 95%;
  max-height: calc(100vh - 30px);
  margin: auto;
  padding: 14px 18px;
  text-align: left;
  align-items: stretch;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  gap: 8px;
}
.editor-canvas-container {
  position: relative;
  background: #202124;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 280px;
  max-height: 64vh;
  flex: 1 1 auto;
  user-select: none;
}
.editor-canvas-container canvas {
  display: block;
  max-width: 100%;
  max-height: 62vh;
  width: auto;
  height: auto;
  object-fit: contain;
}

/* Collapsible Grid Sliders Accordion */
.grid-acc-btn {
  width: 100%;
  background: #ffffff;
  border: 1px solid #dadce0;
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 11.5px;
  font-weight: 600;
  color: #202124;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
  transition: all 0.15s;
}
.grid-acc-btn:hover {
  background: #f8f9fa;
  border-color: #bdc1c6;
}
.btn-acc-cbse {
  background: #edf4fc !important;
  border: 1px solid #cce0f8 !important;
  color: #185abc !important;
}
.btn-acc-cbse:hover {
  background: #e2edfa !important;
  border-color: #b3d1f5 !important;
}
.btn-acc-advance {
  background: #f6f1fc !important;
  border: 1px solid #ded1f8 !important;
  color: #5b21b6 !important;
}
.btn-acc-advance:hover {
  background: #eee4fa !important;
  border-color: #cbaff5 !important;
}
.acc-chevron {
  font-size: 10px;
  transition: transform 0.2s;
}
.acc-chevron.collapsed {
  transform: rotate(-90deg);
}
.grid-sliders-container {
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: all 0.2s ease-in-out;
}
.grid-sliders-container.collapsed {
  display: none !important;
}

/* Active Students Status Bar & Actions */
.active-students-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f8f9fa;
  border: 1px solid #e8eaed;
  border-radius: 6px;
  padding: 5px 8px;
  margin-top: 5px;
  margin-bottom: 6px;
}
.students-badge {
  font-size: 11px;
  font-weight: 600;
  color: #202124;
  display: flex;
  align-items: center;
  gap: 4px;
}
.btn-sm-action {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 8px;
  border: 1px solid #dadce0;
  background: #ffffff;
  color: #3c4043;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-sm-action:hover {
  background: #f1f3f4;
  border-color: #bdc1c6;
  color: #1a73e8;
}
.btn-sm-danger {
  color: #c5221f;
  border-color: #fad2cf;
  background: #fce8e6;
}
.btn-sm-danger:hover {
  background: #f9d8d6;
  border-color: #d93025;
}

/* Bold Toggle Button */
.btn-toggle-bold {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  border: 1px solid #dadce0;
  background: #ffffff;
  color: #5f6368;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-toggle-bold.active {
  background: #e8f0fe;
  color: #1a73e8;
  border-color: #1a73e8;
  font-weight: 800;
}

/* Candidate Name & Date Strip Controls */
.strip-controls-card {
  background: #ffffff;
  border: 1px solid #dadce0;
  border-radius: 8px;
  padding: 10px 12px;
  margin-top: 6px;
  box-shadow: none;
}
.strip-block-box {
  background: #f8f9fa;
  border: 1px solid #e8eaed;
  border-radius: 6px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* 4-Way Move D-Pad for Strip Move */
.pad-4way-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.pad-row {
  display: flex;
  align-items: center;
  gap: 3px;
}
.pad-btn {
  width: 24px;
  height: 22px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid #dadce0;
  background: #ffffff;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  color: #3c4043;
  transition: all 0.15s;
}
.pad-btn:hover {
  background: #e8f0fe;
  border-color: #1a73e8;
  color: #1a73e8;
}

/* Students Viewer Table Modal */
.students-table-wrap {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid #dadce0;
  border-radius: 6px;
  margin: 10px 0;
}
.students-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
}
.students-table th {
  background: #f1f3f4;
  color: #202124;
  font-weight: 700;
  text-align: left;
  padding: 6px 10px;
  position: sticky;
  top: 0;
  border-bottom: 1px solid #dadce0;
}
.students-table td {
  padding: 5px 10px;
  border-bottom: 1px solid #e8eaed;
  color: #202124;
}
.students-table tr:hover {
  background: #f8f9fa;
}

/* ── Print rules (Multi-Page Preserved) ── */
@media print {
  #view-cropper, #studio-header, #studio-controls, .studio-modal-overlay, #preview-placeholder, .active-students-bar, #load-status { display: none !important; }
  html, body {
    background: white !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 210mm !important;
    height: auto !important;
    overflow: visible !important;
  }
  #view-generator, #studio-main, #studio-preview, #printable-area {
    display: block !important;
    overflow: visible !important;
    height: auto !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
  }
  .a4-page {
    box-shadow: none !important;
    page-break-after: always !important;
    break-after: page !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    margin: 0 !important;
    width: 210mm !important;
    height: 297mm !important;
    max-height: 297mm !important;
    padding: 7mm 8mm !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .edge-mark-top, .edge-mark-left, .edge-mark-top svg, .edge-mark-left svg {
    visibility: visible !important;
    display: block !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  @page { size: A4 portrait; margin: 0; }
}
/* Smooth shake animation for empty required fields */
@keyframes shakeError {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.input-error-shake {
  animation: shakeError 0.3s ease-in-out;
}

/* Floating Toast Notifications (Top-Left Below Header for Desktop & Mobile) */
.studio-toast-container {
  position: fixed;
  top: 56px;
  left: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 99999;
  pointer-events: none;
}
.studio-toast {
  background: #1e293b;
  color: #fff;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(0,0,0,0.22);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
  opacity: 0;
  transform: translateY(-10px);
  animation: toastSlideIn 0.25s ease forwards;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.studio-toast.toast-ok {
  background: #15803d;
}
.studio-toast.toast-err {
  background: #b91c1c;
}
.studio-toast.toast-hiding {
  opacity: 0;
  transform: translateY(-8px);
}
@keyframes toastSlideIn {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Responsive Fit-to-Screen Top Bar (Browser Zoom Resilience) ── */
@media (max-width: 1120px) {
  #studio-header {
    padding: 5px 10px;
    gap: 6px;
  }
  .studio-tab-btn {
    padding: 4px 10px;
    font-size: 11.5px;
  }
  .quota-badge {
    max-width: 200px;
    font-size: 11px;
    padding: 3px 8px;
  }
}

@media (max-width: 960px) {
  #studio-header {
    padding: 4px 8px;
    gap: 5px;
  }
  .studio-tab-btn {
    padding: 4px 8px;
    font-size: 11px;
  }
  .btn-upgrade-studio {
    padding: 4px 8px;
    font-size: 11px;
  }
  .quota-badge {
    max-width: 155px;
    font-size: 10.5px;
    padding: 3px 6px;
  }
}

@media (max-width: 820px) {
  .studio-header-center {
    display: none;
  }
}
