/* -------------------------------------------------------------
   Force system local Nudi font load in Chrome
------------------------------------------------------------- */
@font-face {
  font-family: 'Nudi 01 e';
  src: local('Nudi 01 e'), 
       local('Nudi 01e'), 
       local('Nudi01e'), 
       local('Nudi 01'), 
       local('Nudi01'), 
       local('Nudi 01 Direct'), 
       local('Nudi 01-e'), 
       local('Nudi01e Regular'), 
       local('Nudi01e-Regular'), 
       local('NUDI01E'), 
       local('NUDI 01 E'), 
       local('Nudi 02 e'), 
       local('Nudi02e'),
       local('Baraha'), 
       local('BarahaOne'),
       local('Nudi 05 e');
}

/* -------------------------------------------------------------
   FRUITS FID Card Generator - Core Design System & Stylesheet
   Designed for Visual Excellence, Rich Aesthetics, and 100% Print Accuracy
------------------------------------------------------------- */

/* Define CSS Variables for harmonious, premium colors */
:root {
  /* Default is Colorful theme */
  --bg-gradient: linear-gradient(135deg, #07170c 0%, #0e2716 35%, #152642 70%, #3a190b 100%);
  --panel-bg: rgba(10, 26, 16, 0.55);
  --panel-border: rgba(76, 175, 80, 0.25);
  --panel-shadow: 0 8px 32px 0 rgba(0, 20, 5, 0.5);
  --section-bg: rgba(255, 255, 255, 0.02);
  --section-border: rgba(255, 255, 255, 0.04);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --input-bg: rgba(15, 23, 42, 0.6);
  --input-border: rgba(76, 175, 80, 0.3);
  --input-text: #ffffff;
  --header-bg: rgba(8, 20, 12, 0.7);
  --preview-bg: radial-gradient(circle at center, #15381f 0%, #06110a 100%);
  --header-border: rgba(76, 175, 80, 0.15);
  --btn-secondary-bg: rgba(255, 255, 255, 0.05);
  --btn-secondary-text: #cbd5e1;

  --primary-color: #1b5e20;        /* Forest green primary */
  --primary-light: #4caf50;        /* Brighter grass green secondary */
  --primary-glow: rgba(76, 175, 80, 0.2);
  --accent-color: #ffd54f;         /* Elegant gold accent */
  --accent-dark: #f57f17;          /* Rich gold-orange */
  --danger-color: #ef5350;         /* Soft red error */
  --text-dark: #1e293b;            /* Sleek slate text */
  --card-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.5);
  --card-border-radius: 16px;
  
  /* Precision standard card size (CR-80 Standard) */
  --card-w: 85.6mm;
  --card-h: 53.98mm;
  --card-radius: 3mm;

  /* Global branding dynamic variables */
  --label-font-size: 2.75mm;
  --value-font-size: 2.75mm;
  --label-color: #000000;
  --value-color: #000000;
  --header-kannada-color: #1b5e20;
  --header-english-color: #d32f2f;
  --card-border-color: #1b5e20;
  --logo-size: 8.8mm;
  --kannada-header-font-size: 3.35mm;
  --english-header-font-size: 2.25mm;
  --header-gap: 0.30mm;
  --header-y-offset: 2mm;
}

/* Light Theme Variables */
body.theme-light {
  --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 50%, #e2e8f0 100%);
  --panel-bg: #ffffff;
  --panel-border: rgba(15, 23, 42, 0.08);
  --panel-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
  --section-bg: #f8fafc;
  --section-border: rgba(15, 23, 42, 0.05);
  --text-main: #0f172a;
  --text-muted: #64748b;
  --input-bg: #ffffff;
  --input-border: rgba(15, 23, 42, 0.15);
  --input-text: #0f172a;
  --header-bg: #ffffff;
  --preview-bg: radial-gradient(circle at center, #f8fafc 0%, #e2e8f0 100%);
  --header-border: rgba(15, 23, 42, 0.06);
  --btn-secondary-bg: #e2e8f0;
  --btn-secondary-text: #475569;
}

/* Dark Theme Variables */
body.theme-dark {
  --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
  --panel-bg: rgba(30, 41, 59, 0.45);
  --panel-border: rgba(255, 255, 255, 0.08);
  --panel-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --section-bg: rgba(255, 255, 255, 0.02);
  --section-border: rgba(255, 255, 255, 0.04);
  --text-main: #f8fafc;
  --text-muted: #64748b;
  --input-bg: rgba(15, 23, 42, 0.6);
  --input-border: rgba(255, 255, 255, 0.1);
  --input-text: #ffffff;
  --header-bg: rgba(15, 23, 42, 0.6);
  --preview-bg: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
  --header-border: rgba(255, 255, 255, 0.08);
  --btn-secondary-bg: rgba(255, 255, 255, 0.05);
  --btn-secondary-text: #cbd5e1;
}

/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Inter', sans-serif;
  color: var(--text-main);
  background: var(--bg-gradient);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* -------------------------------------------------------------
   Header Styling (Premium blur & floating style with Karnataka flag ribbon)
   ------------------------------------------------------------- */
.app-header {
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 4px solid;
  border-image: linear-gradient(to right, #ffd54f 50%, #d32f2f 50%) 1; /* Official Yellow & Red Karnataka flag ribbon */
  border-bottom: 1px solid var(--header-border);
  padding: 12px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 25px rgba(0, 0, 0, 0.3);
}

body:not(.theme-colorful) .app-header {
  border-top: none;
}

.header-logo-section {
  display: flex;
  align-items: center;
  gap: 15px;
}

.app-icon {
  font-size: 32px;
  animation: bounce 3s infinite alternate;
}

.app-titles h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 22px;
  font-weight: 700;
  background: linear-gradient(45deg, #ffd54f, #66bb6a);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: 0.5px;
}

.app-titles p {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
}

.header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

/* -------------------------------------------------------------
   Button Styling (Interactive and Micro-animated)
------------------------------------------------------------- */
.btn {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 13px;
  padding: 10px 18px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.btn:active {
  transform: scale(0.95);
}

.btn-primary {
  background: linear-gradient(135deg, #4caf50 0%, #1b5e20 100%);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #66bb6a 0%, #2e7d32 100%);
  box-shadow: 0 0 20px rgba(76, 175, 80, 0.6);
  transform: translateY(-2px);
}

.btn-accent {
  background: linear-gradient(135deg, #ffb300 0%, #e65100 100%);
  color: white;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 15px rgba(255, 179, 0, 0.3);
}

.btn-accent:hover {
  background: linear-gradient(135deg, #ffca28 0%, #f57c00 100%);
  box-shadow: 0 0 20px rgba(255, 179, 0, 0.6);
  transform: translateY(-2px);
}

#btn-download-jpg {
  background: linear-gradient(135deg, #0288d1 0%, #004d40 100%);
  color: white;
  border: 1px solid rgba(3, 169, 244, 0.2);
  box-shadow: 0 4px 15px rgba(2, 136, 209, 0.25);
}

#btn-download-jpg:hover {
  background: linear-gradient(135deg, #29b6f6 0%, #00695c 100%);
  box-shadow: 0 0 20px rgba(3, 169, 244, 0.5);
  transform: translateY(-2px);
}

#btn-download-pdf {
  background: linear-gradient(135deg, #e53935 0%, #7f0000 100%);
  color: white;
  border: 1px solid rgba(229, 57, 53, 0.2);
  box-shadow: 0 4px 15px rgba(229, 57, 53, 0.25);
}

#btn-download-pdf:hover {
  background: linear-gradient(135deg, #ef5350 0%, #b71c1c 100%);
  box-shadow: 0 0 20px rgba(229, 57, 53, 0.5);
  transform: translateY(-2px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: #cbd5e1;
}

.btn-secondary:hover {
  background: var(--glass-focus);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.15);
}

#toggle-phonetic-mode.active {
  background: linear-gradient(135deg, rgba(46, 125, 50, 0.2) 0%, rgba(27, 94, 32, 0.4) 100%) !important;
  border-color: rgba(76, 175, 80, 0.4) !important;
  box-shadow: 0 0 10px rgba(76, 175, 80, 0.2);
}
#toggle-phonetic-mode.active:hover {
  background: linear-gradient(135deg, rgba(46, 125, 50, 0.3) 0%, rgba(27, 94, 32, 0.5) 100%) !important;
  box-shadow: 0 0 15px rgba(76, 175, 80, 0.4);
  transform: translateY(-2px);
}

/* -------------------------------------------------------------
   Main Grid Layout
------------------------------------------------------------- */
.app-workspace {
  flex: 1;
  display: grid;
  grid-template-columns: 460px 1fr; /* Fixed control panel, flexible preview area */
  gap: 20px;
  padding: 20px;
  height: calc(100vh - 120px);
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
}

/* -------------------------------------------------------------
   Left Pane: Control Panel (Glassmorphism design)
------------------------------------------------------------- */
.control-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--panel-border);
  border-radius: var(--card-border-radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow-y: auto;
  box-shadow: var(--panel-shadow);
  transition: all 0.3s ease;
}

/* Custom scrollbar for control panel */
.control-panel::-webkit-scrollbar {
  width: 6px;
}
.control-panel::-webkit-scrollbar-track {
  background: var(--input-bg);
  border-radius: 3px;
}
.control-panel::-webkit-scrollbar-thumb {
  background: linear-gradient(to bottom, var(--primary-light), var(--accent-color));
  border-radius: 3px;
}

.panel-section {
  background: var(--section-bg);
  border: 1px solid var(--section-border);
  border-radius: 12px;
  padding: 15px;
  transition: all 0.3s ease;
}

.card-quantity-card h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  margin-bottom: 12px;
}

/* Radio Tab Group for quantity selector */
.card-quantity-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.qty-option {
  cursor: pointer;
}

.qty-option input[type="radio"] {
  display: none;
}

.qty-btn-box {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 8px;
  padding: 8px 4px;
  text-align: center;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.qty-option:hover .qty-btn-box {
  background: var(--btn-secondary-bg);
  border-color: var(--input-border);
}

.qty-option input[type="radio"]:checked + .qty-btn-box {
  background: linear-gradient(135deg, #4caf50 0%, #1b5e20 100%);
  border-color: #ffd54f;
  box-shadow: 0 0 12px rgba(76, 175, 80, 0.5);
}

.qty-num {
  font-family: 'Outfit', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
}

.qty-option input[type="radio"]:checked + .qty-btn-box .qty-num {
  color: white;
}

.qty-label {
  font-size: 9px;
  color: var(--text-muted);
  margin-top: 2px;
}

.qty-option input[type="radio"]:checked + .qty-btn-box .qty-label {
  color: #d1fae5;
}

/* Tabs for Forms selection */
.form-tabs-container {
  display: flex;
  background: var(--section-bg);
  padding: 4px;
  border-radius: 10px;
  gap: 4px;
  border: 1px solid var(--section-border);
}

.tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 12px;
  padding: 8px 6px;
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
}

.tab-btn:hover {
  color: var(--text-main);
}

.tab-btn.active {
  background: linear-gradient(135deg, #4caf50 0%, #1b5e20 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
.tab-btn:hover:not(.inactive):not(.active) {
  background: var(--btn-secondary-bg);
  color: var(--text-main);
}

.tab-btn.inactive {
  opacity: 0.5;
  cursor: not-allowed;
}

.tab-btn .badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: var(--danger-color);
  color: white;
  font-size: 8px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.tab-btn.active .badge {
  display: none;
}

/* Card Forms Stack style */
.cards-forms-stack {
  flex: 1;
  position: relative;
}

.card-form-wrapper {
  display: none;
  flex-direction: column;
  gap: 15px;
  animation: fadeIn 0.35s ease;
}

.card-form-wrapper.active {
  display: flex;
}

.form-section-title {
  font-family: 'Outfit', sans-serif;
  font-size: 16px;
  font-weight: 700;
  background: linear-gradient(45deg, #ffd54f, #4caf50);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  border-left: 3px solid #4caf50;
  padding-left: 8px;
  margin-bottom: 5px;
  display: inline-block;
}

.form-grid {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

/* Beautiful Group Boxes inside Forms */
.form-group-box {
  background: var(--section-bg);
  border: 1px solid var(--section-border);
  border-radius: 10px;
  padding: 15px;
}

.form-group-box h4 {
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  color: #388e3c;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.input-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.input-field label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.input-field input {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 6px;
  padding: 8px 12px;
  color: var(--input-text);
  font-size: 12px;
  transition: all 0.2s ease;
}

.input-field input:focus {
  outline: none;
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px var(--primary-glow);
  background: var(--input-bg);
}

/* -------------------------------------------------------------
   Drag & Drop Photo Uploader
------------------------------------------------------------- */
.photo-upload-container {
  margin-top: 10px;
  background: var(--section-bg);
  border-radius: 10px;
  padding: 10px;
  border: 1px solid var(--section-border);
}

.photo-upload-container label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  display: block;
  margin-bottom: 6px;
}

.upload-dropzone {
  border: 1.5px dashed var(--input-border);
  background: var(--input-bg);
  border-radius: 8px;
  padding: 15px;
  text-align: center;
  position: relative;
  cursor: pointer;
  transition: all 0.25s ease;
  overflow: hidden;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.upload-dropzone:hover {
  border-color: var(--primary-light);
  background: var(--btn-secondary-bg);
}

.file-input-hidden {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.dropzone-prompt {
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}

.upload-icon {
  font-size: 18px;
  margin-bottom: 4px;
}

.upload-text {
  font-size: 10.5px;
  color: var(--text-main);
}

.upload-text strong {
  color: var(--accent-dark);
}

.upload-limit {
  font-size: 8px;
  color: var(--text-muted);
  margin-top: 2px;
}

.dropzone-preview {
  width: 100%;
  height: 100%;
  position: absolute;
  left: 0;
  top: 0;
  background: #0f172a;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
}

.dropzone-preview img {
  height: 100%;
  width: auto;
  object-fit: contain;
}

.remove-photo-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  background: rgba(239, 83, 80, 0.9);
  color: white;
  border: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 700;
  line-height: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  transition: all 0.15s ease;
}

.remove-photo-btn:hover {
  background: #f44336;
  transform: scale(1.1);
}

/* -------------------------------------------------------------
   Image Adjustment Controls (Sleek Golden widgets)
------------------------------------------------------------- */
.image-adjust-panel {
  margin-top: 15px;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 12px;
  animation: fadeIn 0.3s ease;
}

.image-adjust-panel.hidden {
  display: none !important;
}

.image-adjust-panel h5 {
  font-family: 'Outfit', sans-serif;
  font-size: 11.5px;
  color: #ffd54f;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.slider-field {
  margin-bottom: 10px;
}

.slider-field:last-child {
  margin-bottom: 0;
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: #94a3b8;
  margin-bottom: 4px;
  font-weight: 500;
}

.slider-labels .val-lbl {
  color: #ffd54f;
  font-weight: 700;
}

/* Custom premium styling for range sliders */
.slider-field input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  transition: background 0.15s ease;
}

.slider-field input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-color);
  cursor: pointer;
  box-shadow: 0 0 4px rgba(255, 213, 79, 0.5);
  transition: transform 0.1s ease, background 0.15s ease;
}

.slider-field input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  background: white;
}

/* -------------------------------------------------------------
   Right Pane: Live Preview Panel
------------------------------------------------------------- */
.preview-panel {
  display: flex;
  flex-direction: column;
  background: rgba(15, 23, 42, 0.3);
  border: 1px solid var(--glass-border);
  border-radius: var(--card-border-radius);
  box-shadow: inset 0 2px 10px rgba(0,0,0,0.3);
  overflow: hidden;
  height: calc(100vh - 120px);
}

.preview-header {
  padding: 15px 20px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(15, 23, 42, 0.4);
}

.preview-header h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.a4-dimensions-badge {
  font-family: 'Outfit', sans-serif;
  font-size: 10px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 4px 10px;
  border-radius: 20px;
  color: #ffd54f;
  letter-spacing: 0.5px;
}

/* Virtual A4 sheet scroll container */
.virtual-a4-scroll-area {
  flex: 1;
  overflow: auto;
  padding: 20px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  background: radial-gradient(circle at center, #15381f 0%, #06110a 100%);
}

/* -------------------------------------------------------------
   The Real-size Virtual A4 Sheet
------------------------------------------------------------- */
.a4-sheet {
  width: 210mm;
  min-height: 297mm;
  background: #ffffff;
  border-radius: 4px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.05);
  padding: 12mm 15mm;
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease;
  transform-origin: top center;
}

/* Interactive print boundary guidelines */
.print-guidelines-overlay {
  position: absolute;
  left: 15mm;
  right: 15mm;
  top: 12mm;
  bottom: 12mm;
  border: 1px dashed rgba(46, 125, 50, 0.15);
  pointer-events: none;
  z-index: 50;
}

.guide-label {
  position: absolute;
  font-size: 8px;
  color: #2e7d32;
  font-weight: 700;
  opacity: 0.35;
}

.vertical-guide-left {
  top: -12px;
  left: calc(var(--card-w) / 2 - 15px);
}

.vertical-guide-right {
  top: -12px;
  right: calc(var(--card-w) / 2 - 15px);
}

/* Cards Stack */
.a4-cards-stack {
  display: flex;
  flex-direction: column;
  gap: 6mm; /* Exact padding gap between printed pairs */
  position: relative;
  z-index: 10;
}

/* A Card Pair Row (Front side on left, Back side on right) */
.card-row {
  display: flex;
  justify-content: center;
  gap: 5mm; /* Distance between front and back card when printing */
  animation: slideUp 0.3s ease-out;
  page-break-inside: avoid;
}

.card-row.hidden {
  display: none !important;
}

/* -------------------------------------------------------------
   ID Card Precision CSS Design (CR-80 Standard)
------------------------------------------------------------- */
.id-card {
  width: var(--card-w);
  height: var(--card-h);
  background: #ffffff;
  border: 0.4mm solid var(--card-border-color); /* Dynamic card border */
  border-radius: var(--card-radius);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
  position: relative;
  padding: 2.2mm 2.2mm 2.2mm 2.2mm; /* Increased top padding from 1.8mm to 2.2mm to prevent top logos from clipping at rounded corners */
  display: flex;
  flex-direction: column;
  overflow: hidden;
  user-select: none;
  color: #000000;
}

/* Kannada Nudi support and Unicode */
.id-card * {
  font-family: 'Nudi 01 e', 'Nudi 01', 'Nudi 01 Direct', 'Baraha', 'Noto Sans Kannada', 'Inter', sans-serif;
  letter-spacing: -0.05mm;
  position: relative;
  z-index: 3;
}

/* Card Header Section */
.id-card .card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: none; /* Removed border bottom for exact matching */
  padding-bottom: 1.2mm;
  margin-bottom: 1.2mm;
  height: 9.5mm;
}

.id-card .header-logo {
  width: var(--logo-size);
  height: var(--logo-size);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0; /* CRITICAL: Prevent flexbox from shrinking logos when text is long */
}

.id-card .header-logo svg {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.id-card .govt-seal-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.id-card .header-text {
  flex: 1;
  text-align: center;
  padding: 0 1mm;
  display: flex;
  flex-direction: column;
  justify-content: center;
  transform: translateY(var(--header-y-offset));
}

.id-card .kannada-header-title {
  font-size: var(--kannada-header-font-size);
  font-weight: 700;
  color: var(--header-kannada-color);
  line-height: 1.45; /* Increased to allow Noto Sans Kannada glyphs space to render top vowel markers */
  white-space: nowrap;
}

.id-card .english-header-title {
  font-family: 'Outfit', 'Inter', sans-serif !important;
  font-size: var(--english-header-font-size);
  font-weight: 900 !important;
  color: var(--header-english-color);
  line-height: 1.2;
  margin-top: var(--header-gap);
  text-transform: uppercase;
  letter-spacing: -0.01mm;
}

/* Card Body Section */
.id-card .card-body {
  display: flex;
  flex: 1;
  position: relative;
  z-index: 5;
}

/* Data Column Layout */
.id-card .card-fields {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: calc(var(--label-font-size) * 0.28); /* Dynamic gap proportional to font size to avoid squishing */
  justify-content: center;
}

.id-card .back-fields {
  gap: calc(var(--label-font-size) * 0.32); /* Proportional gap for back fields */
}

.id-card .card-field-row {
  display: grid;
  grid-template-columns: 28mm 1.2mm 1fr; /* Aligned colons closer to labels */
  align-items: center;
  line-height: 1.35; /* Increased to prevent Kannada text vertical overlap and clipping */
}

.id-card .card-field-row .label {
  font-size: var(--label-font-size);
  font-weight: 600;
  color: var(--label-color);
  white-space: nowrap;
  /* Removed overflow: hidden to prevent top vowel markers (ascenders) from being clipped */
}

.id-card .card-field-row .colon {
  font-size: var(--label-font-size);
  font-weight: 700;
  color: var(--label-color);
}

.id-card .card-field-row .value {
  flex: 1;
  font-size: var(--value-font-size);
  font-weight: 700; /* Standard bold weight for details */
  color: var(--value-color);
  padding-left: 0.4mm;
  white-space: nowrap;
  text-transform: uppercase;
}

.id-card .card-field-row .value.font-bold {
  font-weight: 900 !important; /* Extra bold weight for FID / Reg No */
  color: var(--value-color);
}

/* Farmer Photo Container */
.id-card .card-photo-container {
  width: 17mm;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
}

.id-card .card-photo-box {
  width: 15.5mm;
  height: 19.5mm;
  border: 0.25mm solid #388e3c; /* Official green photo frame */
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1), inset 0 0 2px rgba(0,0,0,0.05);
  position: relative;
  z-index: 10;
}

/* Support for crop/zoom/pan CSS variables */
.id-card .card-photo-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  transform: scale(var(--photo-zoom, 1)) translate(var(--photo-x, 0%), var(--photo-y, 0%));
  transform-origin: center center;
  transition: transform 0.05s ease-out;
  z-index: 5;
}

.id-card .photo-placeholder {
  font-size: 8mm;
  opacity: 0.25;
  color: #64748b;
}

/* Bottom landscape vector background graphic */
.id-card .card-landscape-bg {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 13.5mm; /* Increased from 11mm to 13.5mm for perfect scaling */
  width: 100%;
  z-index: 2;
  border-bottom-left-radius: calc(var(--card-radius) - 0.4mm);
  border-bottom-right-radius: calc(var(--card-radius) - 0.4mm);
  overflow: hidden;
}

.id-card .card-landscape-bg * {
  z-index: 2; /* Ensure bottom vectors stay on top */
}

.id-card .landscape-svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* -------------------------------------------------------------
   Toggle Font Classes
------------------------------------------------------------- */
/* Class applied dynamically when we toggle font mode */
.kannada-unicode-mode .id-card * {
  font-family: 'Noto Sans Kannada', 'Baloo Tamma 2', 'Inter', sans-serif !important;
}

/* -------------------------------------------------------------
   Global Branding & Style Controls Card Styling
------------------------------------------------------------- */
.global-branding-card {
  border: 1px solid rgba(255, 213, 79, 0.3) !important;
  background: rgba(255, 213, 79, 0.04) !important;
  box-shadow: 0 4px 20px rgba(255, 213, 79, 0.15);
  transition: all 0.3s ease;
}

.global-branding-card h3 {
  color: #ffd54f !important;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

.global-branding-card h3 .arrow-indicator {
  transition: transform 0.3s ease;
  font-size: 12px;
  color: #ffd54f;
  transform: rotate(0deg);
}

.global-branding-card.open h3 .arrow-indicator {
  transform: rotate(90deg);
}

.global-branding-card .accordion-content {
  margin-top: 15px;
  display: none; /* Closed by default */
  flex-direction: column;
  gap: 15px;
  animation: fadeIn 0.3s ease;
}

.global-branding-card.open .accordion-content {
  display: flex; /* Open state */
}

.branding-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.brand-upload-box {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}

.brand-upload-box.full-width {
  grid-column: 1 / span 2;
}

.brand-upload-box label {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.flex-actions {
  display: flex;
  gap: 8px;
}

.flex-actions .btn {
  flex: 1;
  font-size: 11px;
  padding: 6px 10px;
  justify-content: center;
}

.bg-mode-selector {
  display: flex;
  gap: 15px;
  font-size: 11px;
  margin-top: 5px;
  color: var(--text-muted);
}

.bg-mode-selector label {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

.sliders-group h4, .colors-group h4 {
  font-family: 'Outfit', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: #66bb6a;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.color-pickers-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  background: var(--input-bg);
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--input-border);
}

.color-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-field input[type="color"] {
  -webkit-appearance: none;
  border: none;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  cursor: pointer;
  background: none;
}

.color-field input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-field input[type="color"]::-webkit-color-swatch {
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
}

.color-field label {
  font-size: 11px;
  color: #cbd5e1;
}

/* -------------------------------------------------------------
   Footer Layout
------------------------------------------------------------- */
.app-footer-bar {
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--glass-border);
  padding: 10px 30px;
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
}

/* -------------------------------------------------------------
   Animations
------------------------------------------------------------- */
@keyframes bounce {
  0% { transform: translateY(0); }
  100% { transform: translateY(-4px); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12mm); }
  to { opacity: 1; transform: translateY(0); }
}

/* -------------------------------------------------------------
   PRINT PERFECT MEDIA STYLES (@media print)
   This styling makes Chrome print exactly the cards and hide all UI!
------------------------------------------------------------- */

/* -------------------------------------------------------------
   Glassmorphic Instruction Modal
------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
  display: none !important;
  opacity: 0;
}

.modal-card {
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid var(--glass-border);
  box-shadow: var(--card-shadow), 0 0 30px rgba(255, 213, 79, 0.1);
  border-radius: 16px;
  width: 500px;
  max-width: 90%;
  padding: 24px;
  animation: modalSlideIn 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
  color: #f8fafc;
}

@keyframes modalSlideIn {
  from { transform: translateY(30px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 12px;
}

.modal-header h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: #ffd54f;
  display: flex;
  align-items: center;
  gap: 8px;
}

.close-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 24px;
  cursor: pointer;
  transition: color 0.2s;
  line-height: 1;
}

.close-btn:hover {
  color: white;
}

.modal-desc {
  font-size: 13px;
  color: #cbd5e1;
  line-height: 1.5;
  margin-bottom: 16px;
}

.guidelines-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.guide-item {
  display: flex;
  gap: 12px;
  background: rgba(15, 23, 42, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.04);
  padding: 12px;
  border-radius: 8px;
  align-items: center;
}

.guide-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-light) 0%, var(--primary-color) 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.guide-text {
  font-size: 12.5px;
  color: #cbd5e1;
  line-height: 1.4;
}

.guide-text strong {
  color: white;
}

.guide-text span {
  color: #ffd54f;
  font-weight: 600;
  background: rgba(255, 213, 79, 0.1);
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid rgba(255, 213, 79, 0.15);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 16px;
}

/* -------------------------------------------------------------
   Storage Warning Banner
------------------------------------------------------------- */
.storage-warning-banner {
  background: rgba(239, 83, 80, 0.1);
  border: 1px solid rgba(239, 83, 80, 0.2);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 10px;
  animation: fadeIn 0.3s ease;
}

.storage-warning-banner .icon {
  font-size: 16px;
  flex-shrink: 0;
}

.storage-warning-banner .banner-content {
  font-size: 11px;
  color: #ef5350;
  line-height: 1.4;
}

.storage-warning-banner .banner-content a {
  color: #ffd54f;
  text-decoration: underline;
}

.storage-warning-banner .banner-content code {
  background: rgba(255, 255, 255, 0.1);
  padding: 1px 4px;
  border-radius: 4px;
  color: #f8fafc;
}

/* -------------------------------------------------------------
   Dynamic Land Records Sidebar Widget
   ------------------------------------------------------------- */
.land-records-container {
  background: rgba(15, 23, 42, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 12px;
}

.land-record-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr 34px;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.land-record-row input {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 6px 8px;
  color: white;
  font-size: 11px;
  width: 100%;
}

.land-record-row input:focus {
  outline: none;
  border-color: var(--primary-light);
  background: rgba(15, 23, 42, 0.8);
}

.btn-delete-record {
  background: rgba(239, 83, 80, 0.15);
  border: 1px solid rgba(239, 83, 80, 0.3);
  color: #ef5350;
  border-radius: 6px;
  height: 29px;
  width: 100%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.2s ease;
}

.btn-delete-record:hover {
  background: #ef5350;
  color: white;
  transform: scale(1.05);
}

/* -------------------------------------------------------------
   Premium Land Records Table (Card Back Side)
   ------------------------------------------------------------- */
.land-records-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.6mm;
  font-size: var(--value-font-size);
  table-layout: fixed;
}

.land-records-table th, 
.land-records-table td {
  border: 0.18mm solid var(--card-border-color);
  padding: 0.35mm 0.6mm;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.land-records-table th {
  background-color: rgba(27, 94, 32, 0.06);
  font-weight: 700;
  color: var(--header-kannada-color);
}

.land-records-table td {
  font-weight: 700; /* Standard bold weight for land record values */
  color: var(--value-color);
}

/* Bulk Import & History Panels */
.card-quantity-card {
  border: 1px solid rgba(76, 175, 80, 0.3) !important;
  background: rgba(76, 175, 80, 0.04) !important;
  box-shadow: 0 4px 20px rgba(76, 175, 80, 0.15);
}
.card-quantity-card h3 {
  color: #81c784 !important;
}

.bulk-import-card {
  border: 1px solid rgba(56, 189, 248, 0.3) !important;
  background: rgba(56, 189, 248, 0.04) !important;
  box-shadow: 0 4px 20px rgba(56, 189, 248, 0.15);
}
.bulk-import-card h3 {
  color: #38bdf8 !important;
}

.saved-history-card {
  border: 1px solid rgba(168, 85, 247, 0.3) !important;
  background: rgba(168, 85, 247, 0.04) !important;
  box-shadow: 0 4px 20px rgba(168, 85, 247, 0.15);
  transition: all 0.3s ease;
}
.saved-history-card h3 {
  color: #a855f7 !important;
}
.saved-history-card h3 .arrow-indicator {
  color: #a855f7 !important;
  transition: transform 0.3s ease;
}
.saved-history-card.open h3 .arrow-indicator {
  transform: rotate(90deg);
}
.saved-history-card.open .accordion-content {
  display: flex !important;
}

/* History List Items */
.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 6px;
  padding: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.history-item:hover {
  background: rgba(168, 85, 247, 0.15);
  border-color: rgba(168, 85, 247, 0.4);
}
body:not(.theme-colorful) .history-item:hover {
  background: var(--btn-secondary-bg);
  border-color: var(--primary-light);
}
.history-item-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.history-item-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-item-fid {
  font-size: 10px;
  color: var(--text-muted);
  font-family: monospace;
}
.delete-history-btn {
  background: transparent;
  border: none;
  color: #ef4444;
  font-size: 12px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: background 0.2s ease;
}
.delete-history-btn:hover {
  background: rgba(239, 68, 68, 0.15);
}

/* Scrollbar inside history list */
.history-list::-webkit-scrollbar {
  width: 4px;
}
.history-list::-webkit-scrollbar-track {
  background: var(--input-bg);
}
.history-list::-webkit-scrollbar-thumb {
  background: rgba(168, 85, 247, 0.5);
  border-radius: 2px;
}
body:not(.theme-colorful) .history-list::-webkit-scrollbar-thumb {
  background: var(--primary-light);
}

.preview-qrcode-box {
  width: 18mm !important;
  height: 18mm !important;
  min-width: 18mm !important;
  max-width: 18mm !important;
  min-height: 18mm !important;
  max-height: 18mm !important;
  flex: 0 0 18mm !important;
  background: #ffffff !important;
  border: 0.3mm solid #1b5e20 !important; /* Forest green theme border */
  border-radius: 1mm !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0.5mm !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
  transition: transform 0.2s ease;
}
.preview-qrcode-box:hover {
  transform: scale(1.05);
}

/* Style for input elements when they fail validation */
.input-field input.validation-error {
  border-color: var(--danger-color) !important;
  box-shadow: 0 0 0 3px rgba(239, 83, 80, 0.25) !important;
}

/* Validation error text helper */
.validation-error-msg {
  color: #ef5350;
  font-size: 10px;
  font-weight: 500;
  margin-top: 4px;
  display: block;
  animation: fadeIn 0.2s ease;
}

/* Duplicate warning banner styling */
.duplicate-warning-banner {
  background: rgba(245, 127, 23, 0.15);
  border: 1px solid rgba(245, 127, 23, 0.4);
  color: #ffb300;
  padding: 12px;
  border-radius: 8px;
  font-size: 11.5px;
  line-height: 1.4;
  margin-bottom: 15px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  animation: fadeIn 0.3s ease;
  border-left: 4px solid #f57f17;
}

.duplicate-warning-banner strong {
  color: #ffd54f;
  font-size: 12.5px;
}
/* History search input field styled globally */
#history-search {
  width: 100%;
  padding: 8px;
  border-radius: 6px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--input-text);
  font-size: 12px;
  transition: all 0.2s ease;
}
#history-search:focus {
  outline: none;
  border-color: var(--primary-light);
}

/* Strip colorful styling from panels and branding widgets when not in colorful theme */
body:not(.theme-colorful) .global-branding-card,
body:not(.theme-colorful) .bulk-import-card,
body:not(.theme-colorful) .saved-history-card {
  border: 1px solid var(--section-border) !important;
  background: var(--section-bg) !important;
  box-shadow: none !important;
}

body:not(.theme-colorful) .global-branding-card h3,
body:not(.theme-colorful) .bulk-import-card h3,
body:not(.theme-colorful) .saved-history-card h3 {
  color: var(--text-main) !important;
}

body:not(.theme-colorful) .global-branding-card h3 .arrow-indicator,
body:not(.theme-colorful) .saved-history-card h3 .arrow-indicator {
  color: var(--text-main) !important;
}

body:not(.theme-colorful) .duplicate-warning-banner {
  background: rgba(239, 83, 80, 0.1);
  border: 1px solid rgba(239, 83, 80, 0.3);
  color: var(--danger-color);
  border-left: 4px solid var(--danger-color);
}
body:not(.theme-colorful) .duplicate-warning-banner strong {
  color: var(--danger-color);
}

/* Specific text alignment and contrast for light theme app header titles */
body.theme-light .app-titles h1 {
  background: linear-gradient(45deg, #1b5e20, #2e7d32);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}


/* Mobile Preview Targets CSS */
.mobile-preview-target {
  display: none; /* Hidden on desktop */
  flex-direction: column;
  align-items: center;
  gap: 15px;
  margin-top: 15px;
  padding: 15px;
  background: rgba(255, 255, 255, 0.03);
  border: 1.5px dashed rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  width: 100%;
  box-sizing: border-box;
  overflow-x: auto;
}

.mobile-preview-title {
  font-family: 'Outfit', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: #ffd54f;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}

@media screen and (max-width: 992px) {
  body {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    height: auto !important;
  }

  .app-workspace {
    grid-template-columns: 100% !important;
    padding: 10px !important;
    gap: 15px !important;
    height: auto !important; /* Allow workspace to expand naturally */
  }

  .control-panel {
    height: auto !important;
    overflow: visible !important;
  }

  .app-header {
    flex-direction: column !important;
    align-items: stretch !important;
    padding: 10px 15px !important;
    gap: 12px !important;
    text-align: center !important;
  }

  .header-logo-section {
    justify-content: center !important;
  }

  .header-actions {
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 8px !important;
    width: 100% !important;
  }

  .header-actions .btn {
    font-size: 11px !important;
    padding: 6px 12px !important;
    flex: 1 1 auto !important; /* Allow buttons to wrap and occupy space evenly */
    justify-content: center !important;
    min-width: 90px !important;
  }
  
  .preview-panel {
    display: none !important;
  }
  
  .mobile-preview-target {
    display: flex;
  }
  
  .mobile-preview-target .id-card {
    margin: 0 auto !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3) !important;
  }
}

body.theme-light .mobile-preview-target {
  background: rgba(0, 0, 0, 0.02);
  border-color: rgba(0, 0, 0, 0.1);
}
body.theme-light .mobile-preview-title {
  color: #1b5e20;
}


/* Mobile Landscape Orientation Mode Adjustments */
@media screen and (max-width: 992px) and (orientation: landscape) {
  .app-workspace {
    grid-template-columns: 1.2fr 1fr !important;
    gap: 12px !important;
    height: calc(100vh - 120px) !important; /* Account for wrapped header height */
    overflow: hidden !important;
    padding: 10px !important;
  }
  
  .control-panel {
    height: 100% !important;
    overflow-y: auto !important;
    padding: 10px !important;
  }
  
  .preview-panel {
    display: flex !important;
    height: 100% !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 10px !important;
    background: var(--bg-card) !important;
    border-left: 1px solid var(--border-color) !important;
    align-items: flex-start !important;
    justify-content: center !important;
  }
  
  .mobile-preview-target {
    display: none !important;
  }
  
  .a4-sheet {
    display: block !important;
    transform: scale(calc((100vh - 150px) / 1122)) !important; /* Scale dynamically based on remaining height */
    transform-origin: top center !important;
    margin: 0 auto !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4) !important;
  }
}



.id-card .header-fid-badge {
  font-family: 'Outfit', 'Inter', sans-serif !important;
  font-size: calc(var(--english-header-font-size) * 1.75);
  font-weight: 700;
  color: #000000 !important;
  margin-top: calc(var(--header-gap) * 1.5);
  text-transform: uppercase;
  letter-spacing: 0.15mm;
  background: rgba(0, 0, 0, 0.05);
  border: 0.3px solid rgba(0, 0, 0, 0.1);
  padding: 0.3mm 2mm;
  border-radius: 4px;
  align-self: center;
  display: inline-block;
  text-align: center;
  white-space: nowrap !important;
}

.id-card .header-fid-badge span {
  font-weight: 900 !important;
  color: #000000 !important;
  display: inline !important;
  vertical-align: baseline !important;
}

.id-card-front {
  padding-top: 4.8mm !important;
}

.customer-header-title {
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: #1e293b;
  background: rgba(15, 23, 42, 0.05);
  padding: 6px 16px;
  border-radius: 99px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 auto;
}
body.theme-dark .customer-header-title {
  color: #f1f5f9;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* --- LOGIN SCREEN STYLES --- */
.login-screen-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: radial-gradient(circle at center, #f8fafc 0%, #e2e8f0 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
}
body.theme-dark .login-screen-overlay {
  background: radial-gradient(circle at center, #0f172a 0%, #020617 100%);
}

.login-card {
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  padding: 40px;
  border-radius: 20px;
  width: 400px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
  text-align: center;
  animation: loginFadeIn 0.5s ease-out;
}
body.theme-dark .login-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

@keyframes loginFadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.login-logo {
  font-size: 48px;
  margin-bottom: 15px;
}
.login-card h2 {
  font-family: 'Baloo Tamma 2', 'Outfit', sans-serif;
  margin-bottom: 5px;
  color: #0f172a;
}
body.theme-dark .login-card h2 {
  color: #f1f5f9;
}
.login-subtitle {
  color: #64748b;
  font-size: 14px;
  margin-bottom: 25px;
}
.login-error-msg {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
  padding: 10px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 20px;
  display: none;
  font-weight: 500;
}
.login-input-group {
  text-align: left;
  margin-bottom: 18px;
}
.login-input-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: #475569;
  margin-bottom: 6px;
}
body.theme-dark .login-input-group label {
  color: #94a3b8;
}
.login-input-group input {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid rgba(15, 23, 42, 0.15);
  background: #ffffff;
  color: #0f172a;
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  transition: all 0.2s;
}
body.theme-dark .login-input-group input {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #f1f5f9;
}
.login-input-group input:focus {
  outline: none;
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}
.login-btn {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  margin-top: 10px;
  border-radius: 8px;
}

/* --- ADMIN DASHBOARD STYLES --- */
.admin-dashboard-container {
  width: 100vw;
  height: 100vh;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 99998;
}
body.theme-dark .admin-dashboard-container {
  background: #020617;
}

.admin-header {
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  padding: 15px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
body.theme-dark .admin-header {
  background: #0f172a;
  border-bottom: 1px solid #1e293b;
}

.admin-logo-section {
  display: flex;
  align-items: center;
  gap: 12px;
}
.admin-logo-section h1 {
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
  font-family: 'Outfit', sans-serif;
}
body.theme-dark .admin-logo-section h1 {
  color: #f1f5f9;
}

.admin-grid {
  flex: 1;
  padding: 30px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: auto 1fr;
  gap: 25px;
  overflow-y: auto;
}

.admin-panel-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  gap: 15px;
}
body.theme-dark .admin-panel-card {
  background: #0f172a;
  border: 1px solid #1e293b;
}

.admin-span-2 {
  grid-column: span 2;
}

.admin-panel-card h3 {
  font-size: 16px;
  font-weight: 600;
  color: #0f172a;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 10px;
  margin-bottom: 5px;
}
body.theme-dark .admin-panel-card h3 {
  color: #f1f5f9;
  border-bottom: 1px solid #1e293b;
}

.admin-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.admin-form-group label {
  font-size: 12px;
  font-weight: 600;
  color: #475569;
}
body.theme-dark .admin-form-group label {
  color: #94a3b8;
}
.admin-form-group input {
  padding: 10px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #0f172a;
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
}
body.theme-dark .admin-form-group input {
  background: #1e293b;
  border: 1px solid #334155;
  color: #f1f5f9;
}

.admin-customer-table-wrapper {
  overflow-x: auto;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}
body.theme-dark .admin-customer-table-wrapper {
  border: 1px solid #1e293b;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}
.admin-table th, .admin-table td {
  padding: 12px 16px;
  border-bottom: 1px solid #e2e8f0;
}
body.theme-dark .admin-table th, body.theme-dark .admin-table td {
  border-bottom: 1px solid #1e293b;
  color: #cbd5e1;
}
.admin-table th {
  background: #f8fafc;
  font-weight: 600;
  color: #475569;
}
body.theme-dark .admin-table th {
  background: #1e293b;
  color: #94a3b8;
}

.admin-table td input {
  padding: 6px 10px;
  border-radius: 4px;
  border: 1px solid #cbd5e1;
  font-size: 12px;
  width: 150px;
}
body.theme-dark .admin-table td input {
  background: #1e293b;
  border: 1px solid #334155;
  color: #f1f5f9;
}

@media print {
  /* Set layout properties */
  @page {
    size: A4 portrait;
    margin: 0 !important; /* Set margin to zero so our margins are absolute */
  }

  /* Reset body and hide EVERYTHING except A4 Sheet */
  html, body {
    background: #ffffff !important;
    color: #000000 !important;
    width: 210mm !important;
    height: 297mm !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
  }

  /* Hide entire UI layout and dashboards */
  .app-header,
  .control-panel,
  .preview-panel .preview-header,
  .print-guidelines-overlay,
  .app-footer-bar {
    display: none !important;
  }

  /* Reset workspace and panel containers during printing so their child (.a4-sheet) renders perfectly */
  .app-workspace,
  .preview-panel,
  .virtual-a4-scroll-area {
    display: block !important;
    overflow: visible !important;
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    background: none !important;
    border: none !important;
    box-shadow: none !important;
  }

  .a4-sheet {
    display: block !important;
    position: absolute !important;
    left: 0 !important;
    top: 0 !important;
    width: 210mm !important;
    height: 297mm !important;
    padding: 12mm 15mm !important; /* Fixed print padding */
    margin: 0 !important;
    border: none !important;
    box-shadow: none !important;
    background: #ffffff !important;
    transform: none !important;
    box-shadow: none !important;
  }

  .a4-cards-stack {
    display: flex !important;
    flex-direction: column !important;
    gap: 6mm !important;
  }

  /* Force exact flex alignment of printed cards */
  .card-row {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center !important;
    gap: 5mm !important;
    width: 100% !important;
    visibility: visible !important;
  }

  /* Prevent browser from altering background vector and hills */
  .id-card {
    box-shadow: none !important;
    -webkit-print-color-adjust: exact !important; /* Critical to print landscape background and vector shield colors */
    print-color-adjust: exact !important;
    page-break-inside: avoid !important;
  }

  /* Hide modal overlay during printing */
  #pdf-modal {
    display: none !important;
  }
}
