/* ==========================================================================
   ID Studio Pro — Premium ID Card Generator Styling
   ========================================================================== */

:root {
  /* Color Tokens - Modern Dark Studio Theme */
  --bg-app: #0d1117;
  --bg-surface: #161b22;
  --bg-surface-elevated: #21262d;
  --bg-surface-glass: rgba(22, 27, 34, 0.85);
  
  --border-subtle: rgba(240, 246, 252, 0.1);
  --border-focus: #3b82f6;
  --border-active: #60a5fa;

  --accent-primary: #2563eb;
  --accent-gradient: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  --accent-gradient-hover: linear-gradient(135deg, #60a5fa 0%, #2563eb 100%);
  --accent-glow: rgba(59, 130, 246, 0.35);

  --text-primary: #f0f6fc;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  --text-inverse: #0d1117;

  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;

  /* Card Canvas Specific Variables - Calibrated to exact template aspect ratio */
  --card-width: 320px;
  --card-height: 633px; /* Exact 1:1.978 ratio matching 1029x2037 template */
  --card-radius: 20px;
  --card-font: 'Montserrat', sans-serif;
  --card-text-color: #1a202c;
  --card-base-size: 13.5px;

  /* Transitions & Shadows */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 16px 36px rgba(0, 0, 0, 0.6);
  --shadow-card: 0 18px 40px -10px rgba(0, 0, 0, 0.5), 0 0 1px 1px rgba(255, 255, 255, 0.15);
}

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

html, body {
  height: 100%;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ==========================================================================
   Top Navigation Header
   ========================================================================== */
.app-header {
  height: 64px;
  background: var(--bg-surface-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-badge {
  width: 38px;
  height: 38px;
  background: var(--accent-gradient);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 0 15px var(--accent-glow);
}

.logo-badge i {
  width: 22px;
  height: 22px;
}

.brand-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.2;
}

.brand-title .accent-text {
  color: #38bdf8;
  background: linear-gradient(135deg, #38bdf8, #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: var(--transition-fast);
  border: 1px solid transparent;
  font-family: inherit;
}

.btn i {
  width: 16px;
  height: 16px;
}

.btn-save {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.35);
}

.btn-save:hover {
  background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.45);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-surface-elevated);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

.btn-secondary:hover {
  background: #2d333b;
  border-color: rgba(240, 246, 252, 0.2);
}

.btn-outline {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-subtle);
}

.btn-outline:hover {
  color: var(--text-primary);
  background: var(--bg-surface-elevated);
}

.btn-primary-gradient {
  background: var(--accent-gradient);
  color: #ffffff;
  box-shadow: 0 4px 14px var(--accent-glow);
}

.btn-primary-gradient:hover {
  background: var(--accent-gradient-hover);
  box-shadow: 0 6px 20px var(--accent-glow);
  transform: translateY(-1px);
}

.btn-export {
  background: #1f2937;
  color: #f3f4f6;
  border: 1px solid #374151;
}

.btn-export:hover {
  background: #374151;
  border-color: #4b5563;
  color: #fff;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.75rem;
}

.btn-micro {
  padding: 3px 8px;
  font-size: 0.7rem;
  background: var(--bg-surface-elevated);
  color: #93c5fd;
  border: 1px solid var(--border-subtle);
  border-radius: 5px;
  cursor: pointer;
  margin-top: 6px;
  transition: var(--transition-fast);
}

.btn-micro:hover {
  background: #1e293b;
  color: #60a5fa;
}

.btn-link {
  background: none;
  border: none;
  color: #60a5fa;
  font-size: 0.75rem;
  cursor: pointer;
  text-decoration: underline;
}

/* ==========================================================================
   Main Application Layout (Split 2-Column)
   ========================================================================== */
.app-container {
  display: grid;
  grid-template-columns: 460px 1fr;
  height: calc(100vh - 64px);
  overflow: hidden;
}

/* ==========================================================================
   Left Column: Editor Sidebar & Tabs
   ========================================================================== */
.editor-sidebar {
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.tabs-nav {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
  background: #12161c;
  padding: 6px 8px 0;
  gap: 4px;
}

.tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: var(--transition-fast);
}

.tab-btn i {
  width: 15px;
  height: 15px;
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  color: #60a5fa;
  border-bottom-color: #3b82f6;
  background: rgba(59, 130, 246, 0.08);
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
}

.editor-form {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Custom Scrollbar for sidebar */
.editor-form::-webkit-scrollbar {
  width: 6px;
}
.editor-form::-webkit-scrollbar-track {
  background: transparent;
}
.editor-form::-webkit-scrollbar-thumb {
  background: #30363d;
  border-radius: 3px;
}

.tab-pane {
  display: none;
  flex-direction: column;
  gap: 20px;
  animation: fadeIn 0.2s ease;
}

.tab-pane.active {
  display: flex;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.form-section {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 16px;
}

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

.section-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.section-title i {
  width: 16px;
  height: 16px;
  color: #60a5fa;
}

.section-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

/* Form Controls */
.form-group {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.form-row:last-child {
  margin-bottom: 0;
}

label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.req {
  color: #f87171;
}

input[type="text"],
input[type="tel"],
input[type="date"],
textarea,
select {
  width: 100%;
  padding: 9px 12px;
  font-size: 0.82rem;
  background: #0d1117;
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  outline: none;
  font-family: inherit;
  transition: var(--transition-fast);
}

input[type="text"]:focus,
input[type="tel"]:focus,
input[type="date"]:focus,
textarea:focus,
select:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

textarea {
  resize: vertical;
}

/* Dropzones & Uploads */
.upload-dropzone {
  position: relative;
  border: 2px dashed var(--border-subtle);
  background: rgba(13, 17, 23, 0.6);
  border-radius: 10px;
  padding: 18px 12px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition-fast);
}

.upload-dropzone:hover {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.05);
}

.mini-dropzone {
  padding: 10px 8px;
}

.file-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.dropzone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  pointer-events: none;
}

.upload-icon {
  width: 28px;
  height: 28px;
  color: #60a5fa;
}

.upload-icon-sm {
  width: 20px;
  height: 20px;
  color: #60a5fa;
}

.dropzone-text {
  font-size: 0.78rem;
  color: var(--text-primary);
}

.dropzone-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.dropzone-hint-sm {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

/* Sliders & Value Badges */
.fine-tuning-group {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.slider-row span:first-child {
  width: 100px;
}

input[type="range"] {
  flex: 1;
  accent-color: #3b82f6;
  cursor: pointer;
}

.val-badge {
  min-width: 44px;
  text-align: right;
  font-family: monospace;
  font-size: 0.75rem;
  color: #93c5fd;
}

/* Color Picker */
.color-picker-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #0d1117;
  padding: 6px 10px;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
}

input[type="color"] {
  -webkit-appearance: none;
  border: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  cursor: pointer;
  background: none;
}

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

input[type="color"]::-webkit-color-swatch {
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
}

/* Toggle Switches */
.toggle-row {
  margin-top: 10px;
}

.switch-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.switch-label input {
  display: none;
}

.toggle-slider {
  width: 34px;
  height: 18px;
  background: #30363d;
  border-radius: 10px;
  position: relative;
  transition: var(--transition-fast);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  top: 2px;
  left: 2px;
  transition: var(--transition-fast);
}

.switch-label input:checked + .toggle-slider {
  background: #2563eb;
}

.switch-label input:checked + .toggle-slider::before {
  transform: translateX(16px);
}

/* Template Upload Cards */
.highlight-section {
  background: linear-gradient(145deg, rgba(37, 99, 235, 0.1) 0%, rgba(22, 27, 34, 0.95) 100%);
  border: 1px solid rgba(59, 130, 246, 0.35);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.input-with-btn {
  display: flex;
  gap: 6px;
  align-items: center;
}

.preset-action-grid {
  margin-top: 10px;
}

.btn-full {
  width: 100%;
}

.config-io-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.config-io-row button,
.config-io-row label {
  flex: 1;
  text-align: center;
}

.template-upload-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #0d1117;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 10px;
}

.template-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.template-info strong {
  font-size: 0.8rem;
  color: var(--text-primary);
}

.badge-status {
  font-size: 0.7rem;
  color: #34d399;
}

.template-actions {
  display: flex;
  gap: 6px;
}

/* ==========================================================================
   Right Column: Preview Viewport & Canvas Stage
   ========================================================================== */
.preview-viewport {
  background: radial-gradient(circle at top right, #1f293d 0%, #0d1117 80%);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  position: relative;
}

/* Toolbar */
.preview-toolbar {
  height: 52px;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(13, 17, 23, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 10;
}

.view-mode-tabs {
  display: flex;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}

.view-tab-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.view-tab-btn i {
  width: 14px;
  height: 14px;
}

.view-tab-btn:hover {
  color: var(--text-primary);
}

.view-tab-btn.active {
  background: #2563eb;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.4);
}

.preview-zoom-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 4px 8px;
}

.zoom-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  transition: var(--transition-fast);
}

.zoom-btn:hover {
  background: #30363d;
  color: var(--text-primary);
}

.zoom-btn i {
  width: 14px;
  height: 14px;
}

#zoomLevelText {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 36px;
  text-align: center;
  font-family: monospace;
}

/* Canvas Display Stage */
.cards-stage {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
  position: relative;
}

/* Custom Scrollbar for stage */
.cards-stage::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
.cards-stage::-webkit-scrollbar-track {
  background: transparent;
}
.cards-stage::-webkit-scrollbar-thumb {
  background: #30363d;
  border-radius: 4px;
}

.cards-display-container {
  display: flex;
  gap: 40px;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s cubic-bezier(0.2, 0, 0, 1);
  transform-origin: center center;
}

/* View Mode Toggles for Container */
.cards-display-container.view-front #backCardWrapper {
  display: none !important;
}
.cards-display-container.view-back #frontCardWrapper {
  display: none !important;
}

.card-item-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.card-label-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #93c5fd;
  background: rgba(37, 99, 235, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 4px 12px;
  border-radius: 20px;
}

.card-label-tag i {
  width: 12px;
  height: 12px;
}

/* ==========================================================================
   THE EXACT ID CARD CANVAS (Captured by html2canvas)
   ========================================================================== */
.id-card-canvas {
  width: var(--card-width);
  height: var(--card-height);
  position: relative;
  border-radius: var(--card-radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  background-color: #ffffff;
  font-family: var(--card-font);
  user-select: none;
  transform: translateZ(0); /* Hardware acceleration */
}

/* Background Image Layer */
.card-bg-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  z-index: 1;
}

/* Interactive Overlay Layer */
.card-overlay-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  font-family: inherit;
}

/* Draggable handle aesthetic */
.draggable {
  cursor: grab;
}
.draggable:active {
  cursor: grabbing;
}

/* ==========================================================================
   FRONT CARD PRECISE POSITIONING
   ========================================================================== */

/* Circular Employee Photo Container */
.emp-photo-container {
  position: absolute;
  top: 48.0%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 148px;
  height: 148px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  transition: box-shadow var(--transition-fast);
}

.emp-photo-container:hover {
  outline: 2px dashed rgba(59, 130, 246, 0.6);
  outline-offset: 4px;
  border-radius: 50%;
}

.photo-circle-mask {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid #0284c7;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.photo-circle-mask img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform-origin: center center;
}

/* Front Form Field Slots - Directly calibrated to template rows */
.front-details-block {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 6;
  pointer-events: none;
}

.front-field-row {
  position: absolute;
  left: 48.0%; /* Positioned right after the colon ':' */
  right: 6%;
  height: 26px;
  display: flex;
  align-items: center;
  pointer-events: auto;
}

/* Row 1: Name (Template colon at 67.5%) */
#rowName {
  top: 67.4%;
}

/* Row 2: Employee ID (Template colon at 72.9%) */
#rowId {
  top: 72.8%;
}

/* Row 3: Designation (Template colon at 78.3%) */
#rowDesignation {
  top: 78.2%;
}

/* Row 4: Mobile No (Template colon at 83.7%) */
#rowMobile {
  top: 83.6%;
}

.field-value-cell {
  font-size: var(--card-base-size);
  font-weight: 700;
  color: var(--card-text-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.name-value {
  font-size: calc(var(--card-base-size) + 1.5px);
  font-weight: 800;
  color: #0f172a;
}

.id-value {
  font-weight: 700;
  color: #1e293b;
}

.desig-value {
  font-size: calc(var(--card-base-size) - 0.5px);
  font-weight: 600;
  color: #334155;
}

.mobile-value {
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #1e293b;
}

.front-tagline-block {
  display: none;
}

/* ==========================================================================
   BACK CARD PRECISE POSITIONING
   ========================================================================== */

.back-details-block {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 6;
  pointer-events: none;
}

/* 1. Address Slot (Beside Location Pin Icon) */
.address-slot {
  position: absolute;
  top: 35.8%;
  left: 20.8%;
  right: 7%;
  pointer-events: auto;
}

.address-value {
  font-size: 11.5px;
  font-weight: 600;
  color: #1e293b;
  line-height: 1.35;
  word-break: break-word;
}

/* 2. Emergency Contact Slot (Below 'EMERGENCY CONTACT' blue label) */
.emergency-slot {
  position: absolute;
  top: 48.0%;
  left: 20.8%;
  right: 7%;
  height: 24px;
  display: flex;
  align-items: center;
  pointer-events: auto;
}

.emergency-value {
  font-size: 12.5px;
  font-weight: 700;
  color: #1e293b;
  line-height: 1.2;
}

/* 3. Joining Date Slot (In white box below 'JOINING DATE' blue label) */
.joindate-slot {
  position: absolute;
  top: 57.4%;
  left: 20.8%;
  right: 7%;
  height: 24px;
  display: flex;
  align-items: center;
  pointer-events: auto;
}

.joindate-value {
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
  letter-spacing: 0.02em;
}

/* 4. Signatures Area (Inside White Boxes) */
.back-signatures-slot {
  position: absolute;
  top: 62.0%;
  left: 0;
  width: 100%;
  height: 6.8%;
  padding: 0 10%;
  display: flex;
  justify-content: space-between;
  pointer-events: auto;
}

.sig-box-wrapper {
  width: 44%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: outline var(--transition-fast);
}

.sig-box-wrapper:hover {
  outline: 1px dashed rgba(59, 130, 246, 0.5);
  border-radius: 4px;
}

.sig-image-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sig-img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
}

.sig-text-cursive {
  font-family: 'Alex Brush', cursive;
  font-size: 21px;
  color: #1e3a8a;
  white-space: nowrap;
}

/* 5. Back Footer Box (Company Name in Bottom Box) */
.back-footer-block {
  position: absolute;
  top: 87.6%;
  left: 0;
  width: 100%;
  text-align: center;
  z-index: 6;
  pointer-events: auto;
  display: flex;
  justify-content: center;
  align-items: center;
}

.return-company-name {
  font-size: 13.5px;
  font-weight: 800;
  color: #facc15; /* Golden Yellow */
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background-color: #094696; /* Matches blue box background to mask template text */
  padding: 1px 8px;
  border-radius: 4px;
  display: inline-block;
  line-height: 1.25;
  box-shadow: 0 0 1px 1px #094696;
}

.back-tagline-text {
  display: none;
}

/* Custom Logo Overlay */
.custom-logo-container {
  position: absolute;
  top: 40px;
  left: 50%;
  transform: translateX(-50%);
  width: 130px;
  height: 70px;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.hidden {
  display: none !important;
}

/* ==========================================================================
   3D Flip Card Scene
   ========================================================================== */
.flip-card-3d-scene {
  perspective: 1200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.flip-card-3d-object {
  width: var(--card-width);
  height: var(--card-height);
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.7s cubic-bezier(0.4, 0.2, 0.2, 1);
  cursor: pointer;
}

.flip-card-3d-object.flipped {
  transform: rotateY(180deg);
}

.flip-card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: var(--card-radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.flip-face-front {
  transform: rotateY(0deg);
}

.flip-face-back {
  transform: rotateY(180deg);
}

.flip-instruction {
  font-size: 0.8rem;
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.25);
  padding: 6px 16px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ==========================================================================
   Export Footer Bar & Brand Attribution
   ========================================================================== */
.export-footer-bar {
  background: var(--bg-surface-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border-subtle);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 10;
}

.export-left-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.export-desc {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.powered-by-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  color: #94a3b8;
  letter-spacing: 0.02em;
}

.powered-by-tag i {
  width: 14px;
  height: 14px;
  color: #38bdf8;
}

.powered-by-tag strong {
  color: #38bdf8;
  font-weight: 700;
  background: linear-gradient(135deg, #38bdf8, #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-brand-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--border-subtle);
  background: rgba(13, 17, 23, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.74rem;
  color: #94a3b8;
}

.sidebar-brand-footer i {
  width: 13px;
  height: 13px;
  color: #38bdf8;
}

.sidebar-brand-footer strong {
  color: #38bdf8;
  background: linear-gradient(135deg, #38bdf8, #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.success-icon {
  width: 16px;
  height: 16px;
  color: var(--success-color);
}

.export-btn-group {
  display: flex;
  gap: 12px;
}

/* ==========================================================================
   Toast Notification
   ========================================================================== */
.toast-notification {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1e293b;
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #f8fafc;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  transform: translateY(100px);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28), opacity 0.3s ease;
  z-index: 9999;
}

.toast-notification.show {
  transform: translateY(0);
  opacity: 1;
}

.toast-icon {
  width: 18px;
  height: 18px;
  color: #34d399;
}

/* ==========================================================================
   Loading Overlay
   ========================================================================== */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(13, 17, 23, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
}

.loading-spinner-box {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  padding: 30px 40px;
  border-radius: 16px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(59, 130, 246, 0.2);
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-spinner-box h3 {
  font-size: 1.1rem;
  color: var(--text-primary);
}

.loading-spinner-box p {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 1024px) {
  .app-container {
    grid-template-columns: 1fr;
    height: auto;
    overflow-y: auto;
  }

  .editor-sidebar {
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }

  .preview-viewport {
    height: auto;
    min-height: 800px;
  }

  .cards-display-container {
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .app-header {
    padding: 0 16px;
  }

  .header-actions {
    display: none;
  }

  .export-footer-bar {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }

  .export-btn-group {
    flex-direction: column;
  }

  .cards-stage {
    padding: 16px 8px;
  }
}
