/* ==========================================================================
   Passport & Visa Photo Maker - Stylesheet
   Usetra Tools Design System
   ========================================================================== */

:root {
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-border: #bfdbfe;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --border-focus: #3b82f6;
  --bg-page: #f8fafc;
  --bg-surface: #ffffff;
  --bg-subtle: #f1f5f9;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 14px -2px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 10px 25px -3px rgba(15, 23, 42, 0.12);
}

/* Base resets & layout */
.ppm-app-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1rem 3rem 1rem;
}

/* Breadcrumbs */
.ppm-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}
.ppm-breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
}
.ppm-breadcrumb a:hover {
  color: var(--primary);
}
.ppm-breadcrumb .separator {
  color: #cbd5e1;
}

/* Hero Header */
.ppm-hero {
  text-align: center;
  margin-bottom: 2rem;
}
.ppm-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.85rem;
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  border-radius: 9999px;
  font-size: 0.8125rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}
.ppm-hero h1 {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.025em;
  line-height: 1.25;
  margin: 0 0 0.75rem 0;
}
.ppm-hero p {
  max-width: 720px;
  margin: 0 auto;
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

/* Upload Card (Screen 1) */
.ppm-upload-card {
  background: var(--bg-surface);
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-lg);
  padding: 3.5rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  box-shadow: var(--shadow-sm);
  margin-bottom: 2.5rem;
}
.ppm-upload-card:hover,
.ppm-upload-card.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.ppm-upload-icon {
  width: 68px;
  height: 68px;
  margin: 0 auto 1.25rem;
  background: #e0e7ff;
  color: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
}
.ppm-upload-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}
.ppm-upload-subtitle {
  color: var(--text-muted);
  font-size: 0.9375rem;
  margin-bottom: 1.25rem;
}
.ppm-btn-browse {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: var(--primary);
  color: #ffffff;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9375rem;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
}
.ppm-btn-browse:hover {
  background: var(--primary-hover);
}
.ppm-privacy-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1.25rem;
  font-size: 0.8125rem;
  color: #15803d;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  padding: 0.3rem 0.85rem;
  border-radius: 9999px;
  font-weight: 600;
}

/* Editor Workspace (Screen 2) */
.ppm-workspace {
  display: grid;
  grid-template-columns: minmax(360px, 1.05fr) minmax(380px, 1.15fr);
  gap: 2rem;
  align-items: start;
}
@media (max-width: 960px) {
  .ppm-workspace {
    grid-template-columns: 1fr;
  }
}

/* Left Column: Photo Cropper Studio */
.ppm-cropper-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 1.5rem;
}
.ppm-cropper-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.ppm-card-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.ppm-btn-text {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}
.ppm-btn-text:hover {
  background: var(--primary-light);
}

/* Interactive Canvas Viewport */
.ppm-canvas-viewport {
  width: 100%;
  height: 420px;
  background: #0f172a;
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}
.ppm-canvas-viewport canvas {
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  cursor: grab;
  touch-action: none;
}
.ppm-canvas-viewport canvas.dragging {
  cursor: grabbing;
}

/* Biometric Head Alignment Overlay Guide */
.ppm-bio-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.ppm-bio-oval {
  width: 180px;
  height: 230px;
  border: 2px dashed rgba(255, 255, 255, 0.75);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  position: relative;
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.45);
}
.ppm-bio-eyeline {
  position: absolute;
  top: 42%;
  left: 0;
  width: 100%;
  height: 1px;
  border-top: 1px dotted rgba(59, 130, 246, 0.9);
}
.ppm-bio-centerline {
  position: absolute;
  left: 50%;
  top: 0;
  width: 1px;
  height: 100%;
  border-left: 1px dotted rgba(59, 130, 246, 0.9);
}
.ppm-bio-badge {
  position: absolute;
  bottom: 0.75rem;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(4px);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.3rem 0.75rem;
  border-radius: 9999px;
  pointer-events: none;
}

/* Alignment Tool Controls */
.ppm-adjust-controls {
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
}
.ppm-control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.ppm-control-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
}
.ppm-control-label span.val {
  color: var(--primary);
  font-weight: 700;
}
.ppm-slider {
  flex: 1;
  accent-color: var(--primary);
  cursor: pointer;
}
.ppm-btn-bar {
  display: flex;
  gap: 0.5rem;
}
.ppm-icon-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  padding: 0.45rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.15s;
}
.ppm-icon-btn:hover {
  background: #e2e8f0;
}

/* Right Column: Settings & Sheet Generation */
.ppm-options-col {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}
.ppm-section-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.ppm-step-header {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.ppm-step-num {
  width: 22px;
  height: 22px;
  background: var(--primary-light);
  color: var(--primary);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
}

/* Preset Cards Grid */
.ppm-presets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.5rem;
}
.ppm-preset-btn {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.5rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
  display: flex;
  flex-direction: column;
}
.ppm-preset-btn:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}
.ppm-preset-btn.active {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 0 0 1px var(--primary);
}
.ppm-preset-btn .p-flag {
  font-size: 1rem;
  margin-bottom: 0.2rem;
}
.ppm-preset-btn .p-title {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}
.ppm-preset-btn .p-size {
  font-size: 0.6875rem;
  color: var(--primary);
  font-weight: 600;
  margin-top: 0.2rem;
}

/* Background Color Swatches */
.ppm-bg-swatches {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.ppm-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid #ffffff;
  box-shadow: 0 0 0 1px var(--border-color);
  cursor: pointer;
  transition: transform 0.15s;
  position: relative;
}
.ppm-swatch:hover,
.ppm-swatch.active {
  transform: scale(1.15);
  box-shadow: 0 0 0 2px var(--primary);
}
.ppm-swatch-custom {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px dashed var(--border-color);
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.ppm-swatch-custom input[type="color"] {
  position: absolute;
  top: -10px;
  left: -10px;
  width: 60px;
  height: 60px;
  opacity: 0;
  cursor: pointer;
}

/* Sheet Layout Mode Switch */
.ppm-sheet-mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.ppm-mode-tab {
  padding: 0.65rem 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--text-muted);
}
.ppm-mode-tab:hover {
  color: var(--text-main);
}
.ppm-mode-tab.active {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

/* 4x6 Sheet Preview Container */
.ppm-sheet-preview-box {
  background: #f1f5f9;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: center;
  margin-bottom: 1rem;
}
.ppm-sheet-preview-box canvas {
  max-width: 100%;
  max-height: 220px;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.15);
  background: #ffffff;
}
.ppm-sheet-caption {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  font-weight: 500;
}

/* Export Buttons Box */
.ppm-export-card {
  background: linear-gradient(135deg, #f0fdf4 0%, #e0f2fe 100%);
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}
.ppm-btn-download-primary {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.95rem;
  background: #16a34a;
  color: #ffffff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
  transition: all 0.15s;
  margin-bottom: 0.5rem;
}
.ppm-btn-download-primary:hover {
  background: #15803d;
  transform: translateY(-1px);
}
.ppm-btn-download-secondary {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem;
  background: #ffffff;
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.ppm-btn-download-secondary:hover {
  background: #f8fafc;
}

/* Print CSS for 4x6 / A4 Direct Print */
@media print {
  body {
    background: #ffffff !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  header, nav, .ppm-hero, .ppm-upload-card, .ppm-cropper-card, .ppm-options-col, [data-global-header], [data-global-footer], .ppm-seo-section {
    display: none !important;
  }
  .ppm-print-target {
    display: block !important;
    width: 100% !important;
    margin: 0 auto !important;
  }
}

/* SEO Educational Section */
.ppm-seo-section {
  max-width: 960px;
  margin: 4.5rem auto 0;
  border-top: 1px solid var(--border-color);
  padding-top: 3rem;
}
.ppm-seo-section h2 {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 1rem;
}
.ppm-seo-section h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 1.75rem 0 0.75rem;
}
.ppm-seo-section p, .ppm-seo-section li {
  color: #475569;
  font-size: 1rem;
  line-height: 1.7;
}

/* Standards Table */
.ppm-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.ppm-table th, .ppm-table td {
  padding: 0.85rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9375rem;
}
.ppm-table th {
  background: var(--bg-subtle);
  font-weight: 700;
}
.ppm-table tr:last-child td {
  border-bottom: none;
}
.ppm-tag {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8125rem;
  font-weight: 700;
  background: var(--primary-light);
  color: var(--primary);
}

/* FAQ Accordion */
.ppm-faq-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.5rem;
}
.ppm-faq-item {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  overflow: hidden;
}
.ppm-faq-question {
  width: 100%;
  padding: 1rem 1.25rem;
  text-align: left;
  background: none;
  border: none;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.ppm-faq-question .arrow {
  transition: transform 0.2s;
}
.ppm-faq-item.open .ppm-faq-question .arrow {
  transform: rotate(180deg);
}
.ppm-faq-answer {
  padding: 0 1.25rem 1rem;
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.6;
  display: none;
}
.ppm-faq-item.open .ppm-faq-answer {
  display: block;
}
