/* ==========================================================================
   Passport Photo Maker — Premium Upscaled Stylesheet
   Theme: Royal Blue (#1a3566), Amber Gold (#d97706), Slate, Glassmorphism
   CRITICAL: Print Templates & Grid Measurements are 100% Preserved.
   ========================================================================== */

/* --- Tool Header & Badges --- */
.tool-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(26, 53, 102, 0.12);
  box-shadow: 0 4px 16px rgba(26, 53, 102, 0.05);
  font-size: 13px;
  font-weight: 600;
  color: var(--royal-dark, #122549);
  margin-bottom: 18px;
  max-width: 100%;
  text-align: center;
}

.tool-badge i {
  font-size: 15px;
  color: #059669;
  flex-shrink: 0;
}

/* --- Generator Banner Notice --- */
.generator-notice-banner {
  background: linear-gradient(135deg, rgba(239, 246, 255, 0.95), rgba(219, 234, 254, 0.8));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-left: 4px solid #2563eb;
  border-top: 1px solid rgba(191, 219, 254, 0.8);
  border-right: 1px solid rgba(191, 219, 254, 0.8);
  border-bottom: 1px solid rgba(191, 219, 254, 0.8);
  padding: 16px 20px;
  margin-bottom: 24px;
  border-radius: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.08);
}

.generator-notice-content h4 {
  margin: 0 0 3px 0;
  color: #1e3a8a;
  font-size: 15px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 6px;
}

.generator-notice-content p {
  margin: 0;
  color: #2563eb;
  font-size: 13px;
  font-weight: 500;
}

/* --- Dropzone Base & Responsive Ergonomics --- */
.dropzone {
  position: relative;
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 2px dashed rgba(26, 53, 102, 0.22);
  border-radius: 24px;
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  box-sizing: border-box;
}

.dropzone:hover {
  background: rgba(255, 255, 255, 0.95);
  border-color: var(--royal, #1a3566);
  transform: translateY(-2px);
  box-shadow: 0 16px 36px rgba(26, 53, 102, 0.08);
}

.dropzone.dragover,
.dropzone.drag-active {
  background: rgba(238, 246, 255, 0.95);
  border-color: #2563eb;
  border-style: solid;
  transform: scale(1.01);
  box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.15), 0 20px 40px rgba(37, 99, 235, 0.12);
}

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

.dz-content {
  position: relative;
  z-index: 5;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.dz-icon-wrapper {
  width: 76px;
  height: 76px;
  border-radius: 22px;
  background: linear-gradient(135deg, #1a3566 0%, #2563eb 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  box-shadow: 0 12px 24px rgba(26, 53, 102, 0.22);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
}

.dropzone:hover .dz-icon-wrapper {
  transform: translateY(-4px) scale(1.06);
  box-shadow: 0 18px 36px rgba(37, 99, 235, 0.35);
}

.dz-icon-wrapper svg {
  width: 38px;
  height: 38px;
}

.dropzone h3 {
  font-size: 22px;
  font-weight: 800;
  color: var(--royal-dark, #122549);
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.dropzone p {
  font-size: 15px;
  color: var(--slate-600, #475569);
  margin-bottom: 18px;
  line-height: 1.5;
  max-width: 480px;
}

.dz-chips {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
  max-width: 100%;
}

.dz-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: rgba(26, 53, 102, 0.06);
  border: 1px solid rgba(26, 53, 102, 0.1);
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--royal, #1a3566);
  white-space: nowrap;
}

.dz-chip i {
  font-size: 12px;
  flex-shrink: 0;
}

.dz-btn {
  pointer-events: auto;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 700;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(26, 53, 102, 0.22);
}

/* --- Settings & Controls --- */
.settings-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 20px;
  border-radius: 18px;
  border: 1px solid rgba(226, 232, 240, 0.9);
}

.settings-row {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.settings-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 150px;
}

.settings-group label {
  font-weight: 700;
  font-size: 13.5px;
  color: var(--royal-dark, #122549);
  display: flex;
  align-items: center;
  gap: 6px;
}

.form-select, .form-input {
  padding: 11px 14px;
  border: 1.5px solid #cbd5e1;
  border-radius: 12px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  outline: none;
  transition: all 0.2s;
  background: white;
  color: #1e293b;
  box-sizing: border-box;
}

.form-select:focus, .form-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3.5px rgba(37, 99, 235, 0.12);
}

.canvas-container {
  max-width: 100%;
  width: 100%;
  height: 420px;
  max-height: 440px;
  overflow: hidden;
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  background: #0f172a;
  border: 1.5px solid rgba(226, 232, 240, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  position: relative;
  box-sizing: border-box;
}

.canvas-container img {
  display: block;
  max-width: 100%;
}

.cropper-container {
  width: 100% !important;
  height: 100% !important;
  max-height: 440px !important;
}

.cropper-view-box,
.cropper-face {
  border-radius: 0;
}

.cropper-view-box {
  outline: 2px solid #2563eb !important;
  outline-color: rgba(37, 99, 235, 0.9) !important;
}

.cropper-line,
.cropper-point {
  background-color: #2563eb !important;
}

/* --- A4 Print Template Styles (PRESERVED 100% FOR PHYSICAL ACCURACY) --- */
.a4-page-template, .print-grid {
  width: 210mm;
  min-height: 297mm;
  background: white;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: repeat(var(--cols, 5), max-content);
  justify-content: flex-start;
  align-content: flex-start;
}

/* On-screen Preview Scaling */
.a4-preview-wrapper {
  background: #e2e8f0;
  padding: 20px;
  border-radius: 16px;
  display: flex;
  justify-content: center;
  overflow-x: auto;
}

#a4PreviewContainer {
  transform: scale(0.6);
  transform-origin: top center;
  margin-bottom: -118mm;
  box-shadow: 0 14px 35px rgba(15, 23, 42, 0.15);
}

@media (max-width: 768px) {
  #a4PreviewContainer {
    transform: scale(0.35);
    margin-bottom: -193mm; 
  }
}

.cut-wrapper {
  position: relative;
  box-sizing: border-box;
  padding: 1mm;
  border: 0.5px dashed #9ca3af;
  background: white;
  display: flex;
  justify-content: center;
  align-items: center;
}

.scissor-icon {
  position: absolute;
  top: -4px;
  right: -4px;
  font-size: 8px;
  color: #6b7280;
  background: #fff;
  z-index: 2;
  line-height: 1;
}

.print-photo {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #fff;
  border: 0.6px solid #111827;
  box-sizing: border-box;
}

.print-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Interactive Grid Selection Styles (On-Screen Preview) */
.empty-slot .photo-img {
  opacity: 0;
}
.empty-slot .print-photo {
  border-color: rgba(17, 24, 39, 0.12);
  background: transparent;
}

/* DEV CALIBRATION - Grid Numbering Overlay */
.grid-number {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 32px;
  font-weight: 900;
  color: rgba(255, 0, 0, 0.7);
  background: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
  pointer-events: none;
}

/* Hide print area on screen */
#printArea {
  display: none;
}

/* --- Print Layout Styles (Only applied during actual browser print) --- */
@media print {
  @page {
    size: A4 portrait;
    margin: 0;
  }

  body {
    background: transparent !important;
    margin: 0;
    padding: 0;
    width: 210mm;
    height: 297mm;
    overflow: hidden;
  }

  body > :not(#printArea) {
    display: none !important;
  }
  
  .navbar,
  .btn,
  .print-controls,
  .process-panel,
  .upload-panel,
  footer,
  .header {
    display: none !important;
  }
  
  .grid-number {
    display: none !important;
  }
  
  .empty-slot .scissor-icon {
    display: none !important;
  }
  
  .empty-slot .print-photo {
    border-color: transparent !important;
    border: none !important;
  }
  
  .empty-slot.cut-wrapper {
    border: none !important;
  }
  
  #printArea {
    display: block !important;
    position: relative;
    width: 210mm;
    height: 297mm;
    margin: 0;
    padding: 0;
    background: #ffffff !important;
    overflow: hidden;
    page-break-after: avoid;
    page-break-inside: avoid;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  
  .cut-wrapper {
    background: transparent !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  
  .scissor-icon {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  
  .print-photo {
    background: #ffffff !important;
    border: 0.25mm solid #000000 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  
  .print-grid {
    box-shadow: none;
  }

  .print-photo img {
    image-rendering: high-quality;
    image-rendering: -webkit-optimize-contrast;
  }
}

/* --- Floating Sticky Action Footer --- */
.action-footer {
  margin-top: 24px;
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 18px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  bottom: 20px;
  z-index: 100;
}

.selection-status {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--slate-700, #334155);
  display: flex;
  align-items: center;
  gap: 8px;
}

.action-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.action-buttons .btn {
  padding: 12px 20px;
  font-size: 14.5px;
  font-weight: 700;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* --- Section Headlines & Subtitles --- */
.section-headline {
  font-size: 26px;
  font-weight: 900;
  color: var(--royal-dark, #122549);
  text-align: center;
  margin-bottom: 10px;
  letter-spacing: -0.02em;
}

.section-subtitle {
  font-size: 15px;
  color: var(--slate-600, #475569);
  text-align: center;
  max-width: 680px;
  margin: 0 auto 32px;
  line-height: 1.6;
}

/* --- Info Grid & Card Containers --- */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  margin-bottom: 60px;
}

.info-card {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-radius: 20px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  padding: 28px 24px;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.04);
  box-sizing: border-box;
}

.info-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}

.info-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(26, 53, 102, 0.1), rgba(37, 99, 235, 0.15));
  color: var(--royal, #1a3566);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.info-card-icon.gold {
  background: linear-gradient(135deg, rgba(217, 119, 6, 0.12), rgba(245, 158, 11, 0.2));
  color: #d97706;
}

.info-card-header h3 {
  font-size: 18px;
  font-weight: 800;
  color: var(--royal-dark, #122549);
  margin: 0;
}

/* --- Step Items List --- */
.steps-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.step-item {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1a3566, #2563eb);
  color: #ffffff;
  font-size: 13.5px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(26, 53, 102, 0.22);
}

.step-text {
  flex: 1;
}

.step-text h5 {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--slate-800, #1e293b);
  margin: 0 0 3px 0;
}

.step-text p {
  font-size: 13.5px;
  color: var(--slate-600, #475569);
  line-height: 1.5;
  margin: 0;
}

/* --- Guidelines List --- */
.guidelines-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.guideline-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(248, 250, 252, 0.85);
  border-radius: 14px;
  border: 1px solid rgba(226, 232, 240, 0.9);
}

.guideline-icon {
  font-size: 18px;
  color: #d97706;
  flex-shrink: 0;
  margin-top: 2px;
}

.guideline-text {
  font-size: 13.5px;
  color: var(--slate-700, #334155);
  line-height: 1.5;
  flex: 1;
}

.guideline-text strong {
  color: var(--slate-900, #0f172a);
}

/* --- Video Section --- */
.video-section {
  margin-bottom: 60px;
}

.video-container {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
  height: 0;
  overflow: hidden;
  border-radius: 24px;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.08);
  border: 4px solid rgba(255, 255, 255, 0.8);
  background: #000;
}

.video-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

/* --- SEO Article Block --- */
.article-block {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 20px;
  padding: 32px;
  margin-bottom: 60px;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.03);
}

.article-block h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--royal-dark, #122549);
  margin-top: 0;
  margin-bottom: 14px;
}

.article-block h3 {
  font-size: 17px;
  font-weight: 800;
  color: var(--royal-dark, #122549);
  margin-top: 24px;
  margin-bottom: 10px;
}

.article-block p {
  font-size: 14.5px;
  color: var(--slate-600, #475569);
  line-height: 1.7;
  margin-bottom: 14px;
}

.article-highlight-box {
  background: #eff6ff;
  border-left: 4px solid #2563eb;
  padding: 16px 20px;
  border-radius: 12px;
  margin: 20px 0;
}

.article-highlight-box h4 {
  margin: 0 0 6px 0;
  font-size: 15px;
  font-weight: 800;
  color: #1e3a8a;
  display: flex;
  align-items: center;
  gap: 8px;
}

.article-highlight-box p {
  margin: 0;
  font-size: 13.5px;
  color: #1e40af;
  line-height: 1.6;
}

/* --- FAQ Section & Accordion --- */
.faq-section {
  margin-bottom: 60px;
}

.faq-accordion {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 860px;
  margin: 0 auto;
}

.accordion-item {
  background: #ffffff;
  border: 1.5px solid rgba(226, 232, 240, 0.9);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.03);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.accordion-item:hover {
  border-color: #bfdbfe;
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.06);
}

.accordion-header {
  width: 100%;
  padding: 18px 22px;
  background: none;
  border: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  color: var(--royal-dark, #122549);
  text-align: left;
  cursor: pointer;
  outline: none;
  transition: color 0.2s ease;
}

.accordion-header:hover {
  color: #2563eb;
}

.accordion-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  font-size: 12px;
  flex-shrink: 0;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.2s ease, color 0.2s ease;
}

.accordion-item.active .accordion-icon {
  transform: rotate(180deg);
  background: #2563eb;
  color: #ffffff;
}

.accordion-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.accordion-body p {
  padding: 0 22px 20px 22px;
  margin: 0;
  font-size: 14px;
  color: var(--slate-600, #475569);
  line-height: 1.6;
}

/* ==========================================================================
   Comprehensive Responsive Breakpoints (Mobile, Tablet, Desktop)
   ========================================================================== */

/* --- Tablet (max-width: 768px) --- */
@media (max-width: 768px) {
  .generator-notice-banner {
    flex-direction: column;
    align-items: flex-start;
  }

  .canvas-container {
    height: 320px !important;
    max-height: 340px !important;
  }

  .cropper-container {
    max-height: 340px !important;
  }

  .action-footer {
    flex-direction: column;
    gap: 14px;
    align-items: stretch;
    text-align: center;
  }

  .action-buttons {
    flex-direction: column;
  }
}

/* --- Mobile Devices (max-width: 480px) --- */
@media (max-width: 480px) {
  .canvas-container {
    height: 250px !important;
    max-height: 270px !important;
  }

  .cropper-container {
    max-height: 270px !important;
  }

  .tool-badge {
    font-size: 11px;
    padding: 5px 12px;
    gap: 6px;
    margin-bottom: 12px;
  }

  .dropzone {
    padding: 24px 14px 20px;
    border-radius: 16px;
  }

  .dz-icon-wrapper {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    margin-bottom: 12px;
  }

  .dz-icon-wrapper svg {
    width: 28px;
    height: 28px;
  }

  .dropzone h3 {
    font-size: 17px;
    margin-bottom: 4px;
  }

  .dropzone p {
    font-size: 12.5px;
    margin-bottom: 12px;
  }

  .dz-chips {
    gap: 6px;
    margin-bottom: 14px;
  }

  .dz-chip {
    font-size: 10.5px;
    padding: 3px 8px;
    gap: 4px;
  }

  .dz-btn {
    width: 100%;
    max-width: 260px;
    font-size: 14px;
    padding: 11px 18px;
    border-radius: 12px;
  }

  .settings-row {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .settings-group {
    min-width: 100%;
  }

  .action-footer {
    padding: 12px 14px;
    border-radius: 14px;
    bottom: 12px;
  }

  .action-buttons .btn {
    font-size: 14px;
    padding: 12px 18px;
    border-radius: 12px;
    min-height: 44px;
  }

  .info-card {
    padding: 20px 16px;
  }

  .article-block {
    padding: 20px 16px;
  }

  .accordion-header {
    padding: 14px 16px;
    font-size: 14px;
  }

  .accordion-body p {
    padding: 0 16px 16px 16px;
    font-size: 13px;
  }
}
