/* ============================================================
   Aadhaar Card Printer v3 — Stylesheet
   ============================================================ */

/* ── Layout wrapper ── */
.acp-wrap {
  display: flex;
  gap: 20px;
  font-family: 'Segoe UI', Arial, sans-serif;
  font-size: 14px;
  color: #2c2c2c;
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
  box-sizing: border-box;
}

/* ══════════════════════════════════════
   LEFT PANEL
══════════════════════════════════════ */
.acp-left {
  flex: 0 0 300px;
  min-width: 260px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.acp-panel-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #1a73e8;
  border-bottom: 2px solid #e8f0fe;
  padding-bottom: 6px;
}

/* Drop zone */
.acp-drop-zone {
  border: 2px dashed #1a73e8;
  border-radius: 10px;
  padding: 22px 16px;
  text-align: center;
  cursor: pointer;
  background: #f0f6ff;
  transition: background 0.2s, border-color 0.2s;
  user-select: none;
}
.acp-drop-zone:hover,
.acp-drop-zone.drag-over { background: #d6e8ff; border-color: #0b5ed7; }
.acp-drop-icon { font-size: 30px; margin-bottom: 6px; }
.acp-drop-text { margin: 0; line-height: 1.5; color: #444; }
.acp-drop-text small { color: #888; font-size: 12px; }

/* Crop control */
.acp-crop-control {
  background: #fffbe6;
  border: 1px solid #ffe58f;
  border-radius: 8px;
  padding: 10px 12px;
}
.acp-crop-control label { display: block; font-size: 12px; color: #5a3e00; margin-bottom: 4px; }
.acp-crop-control input[type=range] { width: 100%; accent-color: #fa8c16; cursor: pointer; }
.acp-crop-hints {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #aaa;
  margin-top: 2px;
  margin-bottom: 6px;
}
.acp-crop-control small { font-size: 11px; color: #999; display: block; margin-top: 4px; }

/* Size info */
.acp-size-info {
  background: #f0fff4;
  border: 1px solid #b7eb8f;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  color: #276c2b;
  line-height: 1.7;
}
.acp-size-info strong { color: #135e1a; }

/* List header */
.acp-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 13px;
}

/* PDF list */
.acp-pdf-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  background: #fafafa;
}
.acp-pdf-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 12px;
}
.acp-pdf-list li:last-child { border-bottom: none; }
.acp-pdf-list li:hover { background: #f0f6ff; }
.acp-pdf-list .acp-empty-list {
  color: #bbb; text-align: center; padding: 18px; font-style: italic; font-size: 12px;
}
.acp-pdf-list .acp-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.acp-pdf-list .acp-thumb {
  width: 44px;
  height: 28px;
  object-fit: cover;
  border-radius: 3px;
  border: 1px solid #ddd;
  flex-shrink: 0;
}

/* Buttons */
.acp-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: 7px;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: opacity 0.15s, transform 0.1s;
}
.acp-btn:active { transform: scale(0.97); }
.acp-btn-primary   { background: #1a73e8; color: #fff; }
.acp-btn-primary:hover   { background: #0b5ed7; }
.acp-btn-secondary { background: #34a853; color: #fff; }
.acp-btn-secondary:hover { background: #1e8e3e; }
.acp-btn-danger    { background: #fff; color: #d93025; border: 1px solid #d93025; padding: 4px 10px; font-size: 12px; }
.acp-btn-danger:hover { background: #fce8e6; }
.acp-btn-crop-toggle { background: #fff; color: #fa8c16; border: 1px solid #fa8c16; padding: 6px 14px; font-size: 12px; width: 100%; justify-content: center; }
.acp-btn-crop-toggle:hover { background: #fff7e6; }
.acp-btn-small     { background: transparent; color: #d93025; border: none; padding: 0 4px; font-size: 16px; cursor: pointer; line-height: 1; flex-shrink: 0; }

/* Progress */
.acp-progress { display: flex; flex-direction: column; gap: 4px; }
.acp-progress-bar { height: 5px; background: #e0e0e0; border-radius: 10px; overflow: hidden; }
.acp-progress-fill { height: 100%; background: #1a73e8; width: 0%; transition: width 0.3s; }
#acp-progress-text { font-size: 11px; color: #888; }

/* ══════════════════════════════════════
   RIGHT PANEL
══════════════════════════════════════ */
.acp-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.acp-right-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.acp-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* A4 outer scroll area */
.acp-a4-outer {
  overflow: auto;
  background: #b8b8b8;
  border-radius: 8px;
  padding: 16px;
  min-height: 400px;
  display: flex;
  justify-content: center;
}

/* A4 sheet — 794px wide = 210mm at 96dpi; usable = 794 - 76 = 718px */
.acp-a4-sheet {
  background: #fff;
  box-shadow: 0 4px 24px rgba(0,0,0,0.28);
  width: 794px;
  min-height: 1123px;
  padding: 38px;          /* ≈ 10mm each side */
  box-sizing: border-box;
  flex-shrink: 0;
}

/* ── CARDS CONTAINER ── */
.acp-cards-container {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.acp-preview-empty {
  color: #bbb;
  text-align: center;
  padding: 80px 20px;
  font-size: 15px;
  line-height: 1.8;
  width: 100%;
}

/*
 * CARD ROW — एक row में एक पूरा Aadhaar (front+back combined)
 * 100% of usable A4 width
 */
.acp-card-row {
  width: 100%;
  border-bottom: 1.5px dashed #ccc;
  padding-bottom: 10px;
  page-break-inside: avoid;
  break-inside: avoid;
  position: relative;
}

/* Image fills full width; height auto maintains correct aspect ratio */
.acp-card-img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: fill;
  border: 1px solid #ddd;
}

/* Blue fold guide at centre of card strip */
.acp-card-row::after {
  content: '← fold →';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  height: calc(100% - 18px);
  border-left: 1.5px dashed #1a73e8;
  font-size: 9px;
  color: #1a73e8;
  padding-left: 3px;
  opacity: 0.6;
  pointer-events: none;
  display: flex;
  align-items: center;
}

.acp-a4-note {
  font-size: 11px;
  color: #888;
  margin: 0;
  line-height: 1.6;
}

/* ══════════════════════════════════════
   PRINT STYLES
══════════════════════════════════════ */
@media print {
  body * { visibility: hidden !important; }
  .acp-a4-sheet,
  .acp-a4-sheet * { visibility: visible !important; }

  .acp-a4-sheet {
    position: fixed !important;
    top: 0 !important; left: 0 !important;
    width: 210mm !important;
    min-height: 297mm !important;
    padding: 10mm !important;
    box-shadow: none !important;
    margin: 0 !important;
  }

  /* One card per row: front+back = 171.2mm × 54mm */
  .acp-card-row  { width: 171.2mm !important; }
  .acp-card-img  { width: 171.2mm !important; height: 54mm !important; }
  /* hide fold text, keep line */
  .acp-card-row::after { font-size: 0 !important; }

  @page { size: A4 portrait; margin: 0; }
}

/* ── Responsive ── */
@media (max-width: 900px) {
  .acp-wrap { flex-direction: column; }
  .acp-left { flex: none; width: 100%; }
  .acp-a4-sheet { width: 100%; min-height: unset; padding: 16px; }
  .acp-card-row, .acp-card-img { width: 100% !important; height: auto !important; }
}
