/* style.css */

:root {
  /* Exact CR80 Credit Card Dimensions */
  --card-width: 85.6mm;
  --card-height: 53.98mm;
  --saffron: #FF9933;
  --green: #138808;
  --aadhaar-red: #ff0000;
  /* Security Guilloche Pattern */
  --bg-pattern: repeating-linear-gradient(45deg, rgba(0,0,0,0.03) 0px, rgba(0,0,0,0.03) 2px, transparent 2px, transparent 4px);
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Roboto', sans-serif;
  background: #333; /* Dark background to see the white card clearly */
}

.app-container {
  display: flex;
  gap: 30px;
  padding: 30px;
  min-height: 100vh;
  justify-content: center;
  align-items: flex-start;
  flex-wrap: wrap;
}

/* --- EDITOR FORM (Sidebar) --- */
.editor-panel {
  width: 300px;
  background: white;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-size: 11px; font-weight: bold; margin-bottom: 4px; color: #555; text-transform: uppercase; }
.form-group input, .form-group textarea {
  width: 100%;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  box-sizing: border-box; /* Fixes padding issues */
  font-size: 13px;
}

.photo-controls {
  background: #f1f1f1;
  padding: 10px;
  border-radius: 5px;
  border: 1px solid #ddd;
}

.btn-download {
  width: 100%;
  padding: 12px;
  background: #28a745;
  color: white;
  border: none;
  border-radius: 5px;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  margin-top: 15px;
}
.btn-download:hover { background: #218838; }

/* --- CARD PREVIEW AREA --- */
.preview-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
}

/* THE CARD CONTAINER - STRICT SIZE ENFORCEMENT */
.id-card {
  width: var(--card-width);
  height: var(--card-height);
  /* Prevent it from stretching or shrinking */
  min-width: var(--card-width);
  min-height: var(--card-height);
  max-width: var(--card-width);
  max-height: var(--card-height);
  
  background-color: #fff;
  background-image: var(--bg-pattern);
  border-radius: 3.18mm;
  position: relative;
  overflow: hidden; /* Cuts off anything sticking out */
  box-shadow: 0 0 20px rgba(0,0,0,0.5);
  font-family: 'Noto Sans Devanagari', 'Roboto', sans-serif;
  color: #000;
  box-sizing: border-box;
}

/* HEADER SECTION */
.header {
  display: grid;
  /* Left (Emblem), Center (Gov Text), Right (Aadhaar Logo) */
  grid-template-columns: 18mm 1fr 18mm;
  align-items: center;
  height: 12mm;
  padding-top: 2mm;
}

/* 1. Emblem (Fixed Size) */
.emblem-container {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-left: 2mm; /* Aligns with photo below */
}
/* CRITICAL FIX: Limit image size so it doesn't cover window */
.emblem-container img {
  width: 7mm; 
  height: auto;
  display: block;
}
.emblem-container p {
  font-size: 4px;
  margin: 1px 0 0 0;
  font-weight: bold;
}

/* 2. Center Text */
.header-center {
  text-align: center;
  position: relative;
}
.header-center h3 {
  margin: 0; font-size: 9px; color: #000; font-weight: 700;
  line-height: 1;
}
.header-center h4 {
  margin: 2px 0 0 0; font-size: 8px; color: #000; font-weight: 500;
  position: relative; z-index: 2;
  line-height: 1;
}

/* Tricolor Strip behind English Text */
.tricolor-strip {
  position: absolute;
  left: 5mm; right: 5mm; top: 3.5mm; bottom: -1mm;
  z-index: 0;
  opacity: 0.25;
  display: flex;
  flex-direction: column;
}
.strip { flex: 1; }
.saffron { background: var(--saffron); }
.white { background: white; }
.green { background: var(--green); }

/* 3. Aadhaar Logo (Right) */
.aadhaar-logo {
  text-align: center;
  padding-right: 2mm;
}
.aadhaar-logo img {
  width: 10mm;
  height: auto;
}

/* CONTENT BODY */
.content-body {
  display: flex;
  padding: 1mm 3mm;
  height: 29mm; /* Fixed height for middle section */
  box-sizing: border-box;
}

/* Left: Photo */
.photo-section {
  width: 25mm;
  display: flex;
  align-items: flex-end; /* Pushes text to bottom */
  position: relative;
}

.vertical-text {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 5px;
  font-weight: bold;
  color: #000;
  margin-right: 2px;
  white-space: nowrap;
  height: 100%;
  text-align: right;
}

.photo-box {
  width: 21mm;
  height: 25mm;
  border: 0.5px solid #999;
  background: #e6e6e6;
  overflow: hidden;
  position: relative;
  cursor: grab;
}
.photo-box img {
  position: absolute;
  /* No max-width here so we can zoom/pan freely */
}

/* Right: Details */
.details-section {
  flex: 1;
  padding-left: 3mm;
  display: flex;
  flex-direction: column;
  justify-content: center;
  font-size: 9px;
  line-height: 1.3;
}
.details-section .name {
  font-size: 10px;
  font-weight: bold;
  margin-bottom: 2px;
}

/* FOOTER */
.footer {
  text-align: center;
  position: absolute;
  bottom: 0;
  width: 100%;
  padding-bottom: 2mm;
}
.aadhaar-number {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 1px;
}
.vid-number {
  font-size: 7px;
  color: #444;
  margin-bottom: 2px;
}
.red-divider {
  border-top: 1px solid var(--aadhaar-red);
  width: 100%;
  margin-bottom: 2px;
}
.slogan {
  font-size: 8px;
  color: var(--aadhaar-red);
  font-weight: bold;
}

/* BACK SIDE ADJUSTMENTS */
.address-grid {
  display: flex;
  gap: 2mm;
  font-size: 8px;
  height: 100%;
}
.address-text {
  flex: 1;
  font-size: 7.5px;
  line-height: 1.2;
}
.qr-placeholder {
  width: 18mm;
  height: 18mm;
  background: white;
  border: 1px solid #ddd;
  background-image: url('https://upload.wikimedia.org/wikipedia/commons/d/d0/QR_code_for_mobile_English_Wikipedia.svg');
  background-size: cover;
  flex-shrink: 0;
}
.contact-bar {
  display: flex;
  justify-content: center;
  gap: 8px;
  font-size: 6px;
  margin-top: 1px;
  align-items: center;
}