/* ===================================================
   HyPriv QR Generator - Enterprise UI Design System
   Compact layout, maximum information density, minimal whitespace
   Font sizes: 11px labels, 12px body/buttons, 14px section titles
   Inputs: 32-34px, Buttons: 32-34px, Max border-radius: 6px
   =================================================== */

:root {
  --bg-app: #f4f8fc;
  --bg-panel: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-hover: #e2e8f0;
  
  --bg-card-blue: #f0f7fe;
  --border-card-blue: #cfe2f4;
  
  --border-light: #dbe7f4;
  --border-focus: #2563eb;
  --border-subtle: #c7dbf0;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-faint: #64748b;
  --text-inverse: #ffffff;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-subtle: #eff6ff;
  
  --success: #16a34a;
  --danger: #dc2626;
  --whatsapp: #25D366;
  --whatsapp-hover: #20BA5C;

  --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius-sm: 4px;
  --radius-md: 6px;
  --shadow-subtle: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-popup: 0 10px 25px -5px rgba(15, 23, 42, 0.2), 0 8px 10px -6px rgba(15, 23, 42, 0.1);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-stack);
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-main);
  background-color: var(--bg-app);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 26px; /* Reserve space for docked bottom footer bar */
}

/* ===================================================
   TOP NAVBAR
   =================================================== */
.app-header {
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border-light);
  height: 42px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-subtle);
}

.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-logo {
  display: block;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

.brand-text {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.brand-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.2px;
}

.brand-sub {
  font-size: 11px;
  color: var(--text-faint);
  font-weight: 500;
}

.header-actions {
  display: flex;
  align-items: center;
}

.btn-reset {
  height: 30px;
  padding: 0 10px;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--bg-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-reset:hover {
  background: #ffffff;
  color: var(--text-main);
  border-color: var(--border-subtle);
  box-shadow: var(--shadow-subtle);
}

/* ===================================================
   MAIN WORKSPACE GRID
   =================================================== */
.app-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 8px 12px 14px;
  flex: 1 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 10px;
  align-items: stretch;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  box-shadow: 0 1px 3px rgba(37, 99, 235, 0.05);
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.section-title {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-main);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.section-hint {
  font-size: 10.5px;
  color: var(--text-faint);
}

/* ===================================================
   PRESET SELECTOR BUTTONS
   =================================================== */
.preset-selector {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(95px, 1fr));
  gap: 5px;
  margin-bottom: 10px;
}

.preset-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  user-select: none;
}

.preset-pill:hover {
  background: var(--bg-hover);
  border-color: var(--border-subtle);
  color: var(--text-main);
}

.preset-pill.active {
  background: var(--primary-subtle);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}

.pill-icon {
  width: 15px;
  height: 15px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 2px;
}

.custom-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 2px;
  background: var(--primary);
  color: #ffffff;
  font-weight: 700;
  font-size: 11px;
  line-height: 1;
}

/* ===================================================
   FORM INPUTS & CONTROLS
   =================================================== */
.form-container {
  margin-bottom: 10px;
}

.form-row {
  margin-bottom: 8px;
}

.form-cols-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.field-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 3px;
}

.field-label .req {
  color: var(--danger);
}

.field-help {
  display: block;
  font-size: 10.5px;
  color: var(--text-faint);
  margin-top: 3px;
}

.form-cols-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 5px;
}

.form-cols-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 5px;
}

.form-row-compact {
  margin-bottom: 5px;
}

.form-row-compact .field-label {
  font-size: 9.5px;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 3px;
}

.input-icon-group {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.input-icon-prefix {
  position: absolute;
  left: 7px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  pointer-events: none;
  z-index: 1;
}

.input-with-icon {
  padding-left: 23px !important;
  height: 28px !important;
  font-size: 11px !important;
  border-radius: var(--radius-sm);
}

.input-with-icon:focus {
  border-color: var(--border-focus);
}

.input-field {
  width: 100%;
  height: 33px;
  padding: 0 8px;
  font-family: inherit;
  font-size: 12px;
  color: var(--text-main);
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input-field:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 1px var(--border-focus);
}

.input-with-affix {
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.input-with-affix:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 1px var(--border-focus);
}

.input-prefix {
  padding: 0 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-faint);
  background: var(--bg-subtle);
  border-right: 1px solid var(--border-light);
  height: 33px;
  display: flex;
  align-items: center;
}

.input-with-affix .input-field {
  border: none;
  box-shadow: none;
}

.textarea-field {
  height: 52px;
  padding: 6px 8px;
  resize: vertical;
}

.select-field {
  height: 33px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath fill='%2364748b' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 22px;
  appearance: none;
  -webkit-appearance: none;
}

/* ===================================================
   LOGO CACHING & UPLOADER BOX
   =================================================== */
.logo-cache-box {
  background: var(--bg-card-blue);
  border: 1px solid var(--border-card-blue);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  margin-top: 6px;
}

.cache-box-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.cache-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  background: #ffffff;
  border: 1px solid var(--border-light);
  color: var(--text-faint);
}

.cache-badge.cached {
  background: #f0fdf4;
  color: var(--success);
  border-color: #bbf7d0;
}

.logo-uploader-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-preview-thumb {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.logo-preview-thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.thumb-empty {
  font-size: 10px;
  color: var(--text-faint);
}

.logo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.vcard-embed-toggle {
  margin-top: 6px;
  padding-top: 4px;
  border-top: 1px dashed var(--border-card-blue);
}

.toggle-checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.toggle-checkbox-label input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* ===================================================
   SETTINGS SECTION (ALWAYS VISIBLE & GROUPED)
   =================================================== */
.settings-section {
  border-top: 1px solid var(--border-card-blue);
  padding-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.settings-group {
  background: var(--bg-card-blue);
  border: 1px solid var(--border-card-blue);
  border-radius: var(--radius-sm);
  padding: 5px 7px;
}

.group-header {
  margin-bottom: 4px;
  padding-bottom: 2px;
  border-bottom: 1px dashed #bdd8f0;
}

.group-title {
  font-size: 9.5px;
  font-weight: 700;
  color: #1e40af;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* ROW 1: 3 COLORS (QR Color, QR Background, Border Color) */
/* Natural compact widths - not forced to match row 2! */
.settings-row-colors {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 5px;
}

.settings-row-colors .setting-item {
  width: 122px;
  flex: 0 0 auto;
}

/* ROW 2: 4 CONTROLS IN ONE ROW (Pattern, Corner, Resolution, Error) */
.settings-row-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}

/* CENTER LOGO ROW: ALL 5 ITEMS IN ONE CLEAN ROW */
.settings-row-logo-all {
  display: grid;
  grid-template-columns: 118px 118px 1.25fr 1fr 1fr;
  gap: 5px;
}

.setting-item {
  display: flex;
  flex-direction: column;
}

.setting-label {
  font-size: 9.5px;
  font-weight: 600;
  color: #334e68;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.color-picker-wrap {
  display: flex;
  align-items: center;
  border: 1px solid #c5def4;
  border-radius: var(--radius-sm);
  background: #ffffff;
  height: 26px;
  padding: 0 3px;
  gap: 3px;
}

.input-color {
  -webkit-appearance: none;
  border: none;
  width: 18px;
  height: 18px;
  border-radius: 2px;
  cursor: pointer;
  background: none;
  padding: 0;
  flex-shrink: 0;
}

.input-color::-webkit-color-swatch-wrapper {
  padding: 0;
}

.input-color::-webkit-color-swatch {
  border: 1px solid #c5def4;
  border-radius: 2px;
}

.input-hex {
  border: none;
  width: 50px;
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-main);
  outline: none;
}

.settings-group .select-field {
  height: 26px;
  font-size: 10.5px;
  padding: 0 4px;
  border: 1px solid #c5def4;
  background: #ffffff;
  border-radius: var(--radius-sm);
}

/* ===================================================
   RIGHT PANEL: LIVE PREVIEW & TIGHT STAGE
   =================================================== */
.panel-preview {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.preview-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 6px;
}

.preview-title-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.preview-type-line {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-size: 11px;
}

.preview-type-label {
  font-weight: 600;
  color: var(--text-faint);
}

.preview-type-value {
  font-weight: 700;
  color: var(--primary);
}

.preview-name-line {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
}

.preview-name-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-faint);
  white-space: nowrap;
}

.input-qr-name {
  height: 22px;
  font-size: 10.5px;
  padding: 0 5px;
  border: 1px solid var(--border-card-blue);
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: var(--text-main);
  font-weight: 600;
  width: 135px;
}

.input-qr-name:focus {
  border-color: var(--primary);
  outline: none;
}

.preview-meta {
  font-size: 11px;
  color: var(--text-faint);
}

.qr-stage {
  background: var(--bg-card-blue);
  border: 1px solid var(--border-card-blue);
  border-radius: var(--radius-sm);
  padding: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex: 1;
  min-height: 290px;
}

.qr-canvas-wrapper {
  background: #ffffff;
  padding: 2px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

#qrCanvas {
  display: block;
  max-width: 100%;
  height: auto;
  image-rendering: pixelated;
}

.qr-loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.encoded-data-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #eaf4fd;
  border: 1px solid var(--border-card-blue);
  border-radius: var(--radius-sm);
  padding: 3px 8px;
  margin: 6px 0 6px;
  min-height: 26px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow: hidden;
}

.data-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-faint);
  text-transform: uppercase;
  flex-shrink: 0;
}

.data-value {
  font-size: 11px;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1 1 0%;
  min-width: 0;
  max-width: 100%;
  display: block;
}

.btn-icon-only {
  background: none;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  padding: 2px;
  border-radius: 2px;
}

.btn-icon-only:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

/* ===================================================
   BUTTON STYLES (STRICT 32-34px HEIGHT, MAX 4px RADIUS)
   =================================================== */
.btn-compact {
  height: 33px;
  padding: 0 10px;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  transition: all 0.15s ease;
  user-select: none;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn-dark {
  background: var(--text-main);
  color: #ffffff;
  border-color: var(--text-main);
}

.btn-dark:hover {
  background: #1e293b;
  border-color: #1e293b;
}

.btn-outline {
  background: #ffffff;
  color: var(--text-main);
  border-color: var(--border-subtle);
}

.btn-outline:hover {
  background: var(--bg-hover);
  border-color: var(--border-focus);
  color: var(--border-focus);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-main);
}

.btn-danger {
  color: var(--danger);
}

.btn-danger:hover {
  background: #fef2f2;
  color: var(--danger);
}

/* WhatsApp Button */
.btn-whatsapp {
  background: var(--whatsapp);
  color: #ffffff;
  border-color: var(--whatsapp);
  font-weight: 700;
}

.btn-whatsapp:hover {
  background: var(--whatsapp-hover);
  border-color: var(--whatsapp-hover);
  color: #ffffff;
}

.wa-btn-icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
}

.action-toolbar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: auto;
  padding-top: 4px;
}

.action-toolbar .btn-compact {
  width: 100%;
}

/* ===================================================
   CROP MODAL (GOOGLE PROFILE PHOTO STYLE)
   Square box with inner circular aperture guide
   =================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-dialog {
  background: #ffffff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-popup);
  width: 100%;
  max-width: 360px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-light);
  background: #fafbfc;
}

.modal-title-wrap {
  display: flex;
  flex-direction: column;
}

.modal-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.modal-sub {
  font-size: 10.5px;
  color: var(--text-faint);
}

.modal-body {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.crop-viewport-container {
  width: 280px;
  height: 280px;
  background: #0f172a;
  border-radius: var(--radius-sm);
  position: relative;
  overflow: hidden;
  cursor: grab;
  user-select: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.crop-viewport-container:active {
  cursor: grabbing;
}

#cropCanvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.crop-helper-badge {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.75);
  color: #ffffff;
  font-size: 9.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: none;
  white-space: nowrap;
}

.guide-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
}

.square-dot {
  border: 1px solid #ffffff;
}

.circle-dot {
  border: 1px solid #60a5fa;
  border-radius: 50%;
}

.crop-toolbar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
}

.crop-zoom-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.zoom-label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.crop-slider {
  width: 100%;
  height: 4px;
  accent-color: var(--primary);
  cursor: pointer;
}

.btn-rotate {
  height: 28px;
  padding: 0 8px;
  font-size: 10.5px;
}

.crop-previews-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  width: 100%;
  padding: 4px 0 2px;
}

.preview-chip-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.chip-box {
  width: 40px;
  height: 40px;
  background: #ffffff;
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.chip-square {
  border-radius: 4px;
}

.chip-circle {
  border-radius: 50%;
}

.chip-box canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.chip-title {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-faint);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 8px 12px;
  border-top: 1px solid var(--border-light);
  background: #fafbfc;
}

/* ===================================================
   TOAST NOTIFICATION
   =================================================== */
.toast {
  position: fixed;
  bottom: 16px;
  right: 16px;
  background: var(--text-main);
  color: #ffffff;
  padding: 8px 12px;
  font-size: 11.5px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-popup);
  z-index: 3000;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.hidden {
  display: none !important;
}



/* ===================================================
   LIGHT YELLOW ENTERPRISE VCARD CARD (80% / 20% SPLIT)
   Dotted line separation, passport-style photo box
   =================================================== */
#pane-vcard {
  background: #fffdf0;
  border: 1px solid #fde68a;
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin-top: 2px;
}

.vcard-form-split {
  display: grid;
  grid-template-columns: minmax(0, 80%) minmax(0, 20%);
  align-items: center;
}

.vcard-inputs-col {
  display: flex;
  flex-direction: column;
  padding-right: 12px;
  width: 100%;
  min-width: 0;
}

.vcard-inputs-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  width: 100%;
}

.vcard-input-full {
  grid-column: 1 / -1;
}

.vcard-photo-col {
  border-left: 1.5px dotted #cbd5e1;
  padding-left: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.vcard-photo-header {
  font-size: 9px;
  font-weight: 700;
  color: #78350f;
  margin-bottom: 3px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.vcard-photo-box {
  position: relative;
  width: 74px;
  height: 74px;
  border: 1.5px dashed #d97706;
  border-radius: var(--radius-sm);
  background: #ffffff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.vcard-photo-box.has-photo {
  border-style: solid;
  border-color: #f59e0b;
}

.vcard-photo-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.vcard-photo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: #b45309;
  pointer-events: none;
}

.vcard-photo-placeholder span {
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Red Circular Corner 'X' Remove Button */
.btn-photo-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ef4444;
  color: #ffffff;
  border: 1px solid #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s ease, background 0.15s ease;
  z-index: 5;
}

.btn-photo-remove:hover {
  background: #dc2626;
  transform: scale(1.1);
}

.vcard-photo-buttons {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 74px;
  margin-top: 4px;
}

.vcard-photo-buttons .btn-compact {
  height: 22px;
  font-size: 9.5px;
  padding: 0;
  width: 100%;
  justify-content: center;
}

.vcard-toggles-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 5px;
  padding-top: 4px;
  border-top: 1px dashed #fef08a;
}

.vcard-toggle-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 500;
  color: #78350f;
  cursor: pointer;
  user-select: none;
}

.vcard-toggle-item input[type="checkbox"] {
  cursor: pointer;
  accent-color: var(--primary);
  width: 13px;
  height: 13px;
}

/* ===================================================
   ULTRA-COMPACT ENTERPRISE FOOTER (DOCKED BOTTOM BAR)
   =================================================== */
.app-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 24px;
  border-top: 1px solid var(--border-light);
  background: #ffffff;
  padding: 0 12px;
  font-size: 10px;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  z-index: 100;
  box-shadow: 0 -1px 3px rgba(0, 0, 0, 0.04);
}

.footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.footer-copy {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-muted);
}

.footer-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 10px;
  font-weight: 500;
}

.footer-link:hover,
.footer-link.active {
  color: var(--primary);
  text-decoration: underline;
}

.footer-sep {
  color: var(--border-light);
  font-size: 8px;
}

/* Android WebView & Mobile optimizations */
html, body {
  -webkit-tap-highlight-color: transparent;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

input, button, select, textarea {
  touch-action: manipulation;
}

/* ===================================================
   RESPONSIVE DESIGN: TABLET & MOBILE (AT BOTTOM FOR PRECEDENCE)
   =================================================== */
@media (max-width: 960px) {
  .workspace-grid {
    grid-template-columns: 1fr;
    align-items: start;
    width: 100%;
    min-width: 0;
  }
  .panel-preview {
    order: -1;
    height: auto;
    width: 100%;
    min-width: 0;
    margin-bottom: 8px;
  }
  .panel-config {
    width: 100%;
    min-width: 0;
  }
  .qr-stage {
    flex: initial;
    min-height: auto;
    padding: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
  }
  .qr-canvas-wrapper {
    max-width: 240px;
    width: 100%;
    margin: 0 auto;
  }
  #qrCanvas {
    max-width: 240px !important;
    width: 100% !important;
    height: auto !important;
  }
  .action-toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 6px;
    width: 100%;
  }
}

@media (max-width: 640px) {
  .app-header {
    height: 38px;
  }
  .header-inner {
    padding: 0 8px;
  }
  .brand-title {
    font-size: 13px;
  }
  .brand-sub {
    display: none;
  }
  .section-hint {
    display: none !important; /* Hide long description on mobile view */
  }
  .app-container {
    padding: 6px 8px 36px;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }
  .preset-selector {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    width: 100%;
  }
  .preset-pill {
    height: 32px;
    padding: 0 6px;
    font-size: 11px;
    min-width: 0;
  }
  .preset-pill span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .form-cols-2,
  .form-cols-3 {
    grid-template-columns: 1fr;
    gap: 4px;
    width: 100%;
  }
  .settings-row-colors {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 4px !important;
    width: 100% !important;
  }
  .settings-row-colors .setting-item {
    width: 100% !important;
    min-width: 0 !important;
  }
  .settings-row-options {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 4px !important;
    width: 100% !important;
  }
  .settings-row-options .setting-item {
    width: 100% !important;
    min-width: 0 !important;
  }
  .settings-row-logo-all {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 4px !important;
    width: 100% !important;
  }
  .settings-row-logo-all .setting-item {
    width: 100% !important;
    min-width: 0 !important;
  }
  .setting-label {
    font-size: 8.5px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }
  .select-field {
    font-size: 9.5px !important;
    height: 28px !important;
    padding-right: 14px !important;
    padding-left: 3px !important;
    min-width: 0 !important;
  }
  .color-picker-wrap {
    height: 28px !important;
    padding: 0 2px !important;
    min-width: 0 !important;
    gap: 2px !important;
  }
  .input-color {
    width: 16px !important;
    height: 20px !important;
    flex-shrink: 0 !important;
  }
  .input-hex {
    font-size: 9.5px !important;
    width: 100% !important;
    min-width: 0 !important;
  }
  .qr-stage {
    padding: 6px;
  }
  .qr-canvas-wrapper {
    max-width: 210px;
    width: 100%;
  }
  #qrCanvas {
    max-width: 210px !important;
  }
  .crop-viewport-container {
    width: 240px;
    height: 240px;
  }

  /* vCard Form Mobile Layout (Photo upload centered on top, 2-column inputs below) */
  .vcard-form-split {
    display: flex !important;
    flex-direction: column !important;
    gap: 8px !important;
    width: 100% !important;
  }
  .vcard-photo-col {
    order: -1 !important; /* Placed at the top */
    border-left: none !important;
    border-bottom: 1.5px dotted #cbd5e1 !important;
    padding-left: 0 !important;
    padding-bottom: 10px !important;
    margin-bottom: 2px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
  }
  .vcard-photo-box {
    width: 74px !important;
    height: 74px !important;
    margin: 0 auto 6px auto !important;
  }
  .vcard-photo-buttons {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center !important;
    gap: 8px !important;
    width: auto !important;
    margin-top: 0 !important;
  }
  .vcard-photo-buttons .btn-compact {
    height: 26px !important;
    padding: 0 12px !important;
    font-size: 11px !important;
    width: auto !important;
  }
  .vcard-inputs-col {
    padding-right: 0 !important;
    width: 100% !important;
  }
  .vcard-inputs-grid {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 4px !important;
    width: 100% !important;
  }
  .vcard-inputs-col .field-label {
    font-size: 9px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    margin-bottom: 2px !important;
  }
  .vcard-inputs-col .input-with-icon {
    height: 28px !important;
    font-size: 10px !important;
    padding-left: 20px !important;
    padding-right: 4px !important;
  }
  .vcard-inputs-col .input-icon-prefix {
    left: 5px !important;
  }
  .vcard-inputs-col .input-icon-prefix svg {
    width: 10px !important;
    height: 10px !important;
  }
  .vcard-toggles-row {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 6px !important;
    margin-top: 6px !important;
  }
}

