/* Reset & Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Custom Font Declarations */
@font-face {
  font-family: 'DIN Alternate';
  src: url('assets/fonts/DINAlternate.ttf') format('truetype');
  font-weight: 100 900;
  font-style: normal;
  font-display: block;
}

@font-face {
  font-family: 'DIN Next Bold';
  src: url('assets/fonts/DINNextBold.ttf') format('truetype');
  font-weight: 100 900;
  font-style: normal;
  font-display: block;
}

@font-face {
  font-family: 'OCR-B';
  src: url('assets/fonts/OCR-B.ttf') format('truetype');
  font-weight: 100 900;
  font-style: normal;
  font-display: block;
}

:root {
  --bg-dark: #0f1117;
  --bg-card: #181b24;
  --bg-card-hover: #1f2330;
  --border-color: #2a2e3d;
  --text-primary: #f0f2f8;
  --text-secondary: #9da5b4;
  --text-muted: #6b7280;
  --accent-pink: #ec4899;
  --accent-pink-hover: #db2777;
  --accent-pink-light: rgba(236, 72, 153, 0.15);
  --accent-purple: #8b5cf6;
  --success: #10b981;
  --font-din: 'DIN Alternate', 'DIN Next Bold', sans-serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-title: 'Outfit', sans-serif;
  --font-mono: 'OCR-B', 'Courier Prime', 'Space Mono', monospace;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.3);
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-dark);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

/* App Container */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Header */
.app-header {
  height: 64px;
  background: rgba(24, 27, 36, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
}

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

.brand-icon {
  font-size: 28px;
  background: var(--accent-pink-light);
  padding: 6px;
  border-radius: var(--radius-md);
}

.brand-text h1 {
  font-family: var(--font-title);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, #f472b6, #c084fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-text p {
  font-size: 11px;
  color: var(--text-muted);
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  outline: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-pink), var(--accent-purple));
  color: #fff;
  box-shadow: 0 4px 14px rgba(236, 72, 153, 0.35);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(236, 72, 153, 0.5);
}

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

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.btn-secondary {
  background: #2a2e3d;
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: #363b4e;
}

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

.btn-ghost:hover {
  color: #ef4444;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

/* Workspace */
.workspace {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 440px;
  background: var(--bg-card);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  padding: 20px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}

.card-header h2 {
  font-size: 16px;
  font-weight: 700;
}

.card-section {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card-section h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.section-title-with-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Collapsible MRZ Accordion */
.mrz-collapsible {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0;
  overflow: hidden;
  transition: all 0.2s ease;
}

.mrz-collapsible summary {
  list-style: none;
  padding: 12px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: rgba(24, 27, 36, 0.5);
  transition: background 0.15s ease;
}

.mrz-collapsible summary::-webkit-details-marker {
  display: none;
}

.mrz-collapsible summary:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.mrz-summary-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mrz-badge {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: normal;
  display: flex;
  align-items: center;
  gap: 4px;
}

.mrz-collapsible[open] summary {
  border-bottom: 1px solid var(--border-color);
}

.mrz-collapsible[open] summary .mrz-arrow {
  transform: rotate(90deg);
}

.mrz-arrow {
  transition: transform 0.2s ease;
  font-size: 10px;
}

.mrz-content {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.input-with-button {
  display: flex;
  gap: 8px;
}

.input-with-button input {
  flex: 1;
}

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

label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

input[type="text"], select {
  background: rgba(15, 17, 23, 0.7);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s ease;
}

input[type="text"]:focus, select:focus {
  border-color: var(--accent-pink);
  box-shadow: 0 0 0 2px var(--accent-pink-light);
}

.font-mono {
  font-family: var(--font-mono) !important;
  letter-spacing: 0.5px;
}

.font-arial {
  font-family: Arial, sans-serif !important;
  font-weight: normal !important;
}

/* Color Picker Styling */
.color-picker-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

input[type="color"] {
  -webkit-appearance: none;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  width: 40px;
  height: 36px;
  cursor: pointer;
  background: transparent;
  padding: 2px;
}

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

input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 4px;
}

.color-presets {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.color-preset-btn {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.color-preset-btn:hover {
  transform: scale(1.2);
  border-color: #fff;
}

/* Custom Background Template Section */
.bg-template-section {
  border-top: 1px solid var(--border-color);
  padding-top: 14px;
  margin-top: 14px;
}

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

.section-help-text {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 10px;
}

.section-help-text code {
  color: var(--accent-pink);
  background: rgba(236, 72, 153, 0.1);
  padding: 1px 4px;
  border-radius: 3px;
  font-family: monospace;
}

.bg-custom-controls {
  display: flex;
  gap: 12px;
  align-items: center;
}

.bg-thumb-container {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-color);
  overflow: hidden;
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.5);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

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

.bg-thumb-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(15, 17, 23, 0.85);
  font-size: 8.5px;
  color: var(--text-secondary);
  text-align: center;
  padding: 2px 0;
  font-family: var(--font-mono);
}

.bg-button-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Photo Upload Box */
.photo-upload-container {
  display: flex;
  gap: 14px;
  align-items: center;
}

.photo-preview-box {
  width: 100px;
  height: 125px;
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  position: relative;
}

.photo-preview-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-placeholder {
  padding: 8px;
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
}

.photo-controls {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.file-input-hidden {
  display: none;
}

/* Sliders */
.slider-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
}

.slider-header span:last-child {
  font-weight: 600;
  color: var(--accent-pink);
}

input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--border-color);
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-pink);
  cursor: pointer;
  transition: transform 0.10s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* Checkboxes & Switches */
.form-group-checkbox {
  display: flex;
  align-items: center;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  accent-color: var(--accent-pink);
  width: 15px;
  height: 15px;
}

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 18px;
  background-color: var(--border-color);
  border-radius: 9px;
  transition: 0.3s;
}

.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  border-radius: 50%;
  transition: 0.3s;
}

input:checked + .slider {
  background-color: var(--accent-pink);
}

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

.switch-label {
  font-size: 11px;
  color: var(--text-muted);
}

/* Preview Area */
.preview-area {
  flex: 1;
  background: #090b0e;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.preview-toolbar {
  height: 48px;
  background: rgba(15, 17, 23, 0.6);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.zoom-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.badge {
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.badge-success {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
}

/* Canvas Viewport */
.canvas-viewport {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 40px;
  background-image: 
    radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 20px 20px;
}

.canvas-wrapper {
  position: relative;
  box-shadow: var(--shadow-lg);
  border-radius: 12px;
  overflow: hidden;
  transition: transform 0.1s ease-out;
  transform-origin: center center;
}

canvas {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 12px;
}

/* ==========================================================================
   Authentication & Lock Screen Gatekeeper Styles
   ========================================================================== */
.app-container.app-locked {
  filter: blur(20px) grayscale(60%);
  pointer-events: none !important;
  user-select: none !important;
  opacity: 0.15;
  transition: filter 0.4s ease, opacity 0.4s ease;
}

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: radial-gradient(circle at center, rgba(24, 27, 36, 0.96) 0%, rgba(10, 12, 17, 0.98) 100%);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.auth-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.auth-modal {
  background: rgba(24, 27, 36, 0.95);
  border: 1px solid rgba(236, 72, 153, 0.35);
  border-radius: 16px;
  padding: 24px 22px;
  width: 100%;
  max-width: 360px;
  text-align: center;
  box-shadow: 
    0 25px 50px -12px rgba(0, 0, 0, 0.8),
    0 0 30px rgba(236, 72, 153, 0.2),
    inset 0 1px 1px rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
  animation: authModalPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-input-group input {
  width: 100%;
  height: 48px;
  background: rgba(15, 17, 23, 0.85);
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0 46px 0 16px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 15px;
  letter-spacing: 0.5px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.auth-input-group input:focus {
  border-color: var(--accent-pink);
  box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.25);
}

.btn-toggle-pwd {
  position: absolute;
  right: 12px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  opacity: 0.65;
  transition: opacity 0.2s;
  padding: 4px;
}

.btn-toggle-pwd:hover {
  opacity: 1;
}

.auth-options {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.auth-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
}

.auth-remember input {
  accent-color: var(--accent-pink);
  cursor: pointer;
}

.auth-error-msg {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 500;
  animation: authShake 0.4s ease;
}

.btn-auth-submit {
  height: 48px;
  background: linear-gradient(135deg, #ec4899, #db2777);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 15px rgba(236, 72, 153, 0.35);
  transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
}

.btn-auth-submit:hover {
  filter: brightness(1.08);
  box-shadow: 0 6px 20px rgba(236, 72, 153, 0.5);
  transform: translateY(-1px);
}

.btn-auth-submit:active {
  transform: translateY(0);
}

.auth-footer {
  margin-top: 22px;
  font-size: 11px;
  color: var(--text-muted);
}

.btn-lock {
  border-color: rgba(236, 72, 153, 0.35);
  color: #f472b6;
}

.btn-lock:hover {
  background: var(--accent-pink-light);
  border-color: var(--accent-pink);
}

/* Animations */
@keyframes authModalPop {
  0% { transform: scale(0.92); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes authIconPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 20px rgba(236, 72, 153, 0.25); }
  50% { transform: scale(1.05); box-shadow: 0 0 30px rgba(236, 72, 153, 0.45); }
}

@keyframes authShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

