/* ============================================
   RANKUP - ID Card Page
   ============================================ */
.idcard-result { display: flex; flex-direction: column; align-items: center; gap: 20px; }
.idcard-result.hidden,
.photo-manage.hidden,
.idcard-actions.hidden,
.crop-modal.hidden { display: none !important; }

/* ID Card preview (canvas render). The canvas is scaled to fit any
   screen width while keeping its 900x600 ratio, so it never overflows
   and always matches the downloaded/printed card. */
.id-card-canvas {
  display: block;
  width: 100%;
  max-width: 520px;
  height: auto;
  aspect-ratio: 900 / 600;
  border-radius: 16px;
  background: var(--white);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.22);
  border: 1px solid var(--border);
}

/* Photo manage */
.photo-manage { max-width: 640px; margin: 28px auto 0; }
.photo-manage-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px 24px;
  text-align: center;
}
.photo-manage-card h3 { font-size: 1.05rem; margin-bottom: 6px; }
.photo-manage-card p { font-size: 0.85rem; color: var(--text-light); margin-bottom: 14px; }
.photo-manage-row { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; }
.photo-status { font-size: 0.85rem; font-weight: 600; }
.photo-status.ok { color: var(--success); }
.photo-status.err { color: var(--error); }

.idcard-actions { display: flex; justify-content: center; gap: 14px; margin-top: 28px; flex-wrap: wrap; }

/* Verification form layout - grid rows that collapse cleanly on mobile */
.idc-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.idc-field { min-width: 0; display: flex; flex-direction: column; }
.idc-field .verify-input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.idc-btn-row { margin-top: 16px; display: flex; }
.idc-btn-row .btn { flex: 1; width: 100%; justify-content: center; white-space: normal; }

/* Crop modal */
.crop-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.crop-modal-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: 24px;
  width: 100%;
  max-width: 460px;
}
.crop-modal-card h3 { font-size: 1.15rem; margin-bottom: 4px; }
.crop-hint { font-size: 0.82rem; color: var(--text-light); margin-bottom: 14px; }
.crop-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--background);
  border-radius: var(--radius);
  padding: 16px;
  min-height: 240px;
}
.crop-viewport {
  width: 280px;
  height: 280px;
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background: var(--charcoal);
  touch-action: none;
}
.crop-viewport img {
  position: absolute;
  top: 0; left: 0;
  max-width: none;
  user-select: none;
  -webkit-user-drag: none;
  will-change: transform;
}
.crop-mask {
  position: absolute;
  inset: 0;
  box-shadow: 0 0 0 1000px rgba(0, 0, 0, 0.55);
  border: 2px solid var(--accent);
  border-radius: 12px;
  pointer-events: none;
}
.crop-zoom-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
}
.crop-zoom-row input { flex: 1; accent-color: var(--accent); }
.crop-zoom-row span { color: var(--text-light); font-weight: 700; }
.crop-actions { display: flex; gap: 12px; justify-content: flex-end; }

/* Print styles */
.print-area { display: none; }
@media print {
  body * { visibility: hidden !important; }
  #print-area, #print-area * { visibility: visible !important; }
  #print-area {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 24px;
    box-sizing: border-box;
  }
  .print-id-card {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
  }
}

@media (max-width: 640px) {
  .idc-form-row { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .crop-viewport { width: 240px; height: 240px; }
  .idcard-actions,
  .photo-manage-row { flex-direction: column; align-items: stretch; }
  .idcard-actions .btn,
  .photo-manage-row .btn { width: 100%; justify-content: center; }
  .photo-status { margin-top: 2px; }
}
