/* ===================================================================
   HOA HUY GREEN ENERGY - CATALOG STUDIO DESIGN SYSTEM
   Color Scheme: Hoa Huy Vibrant Orange (#FF6000 / #EC7D31) & Green Energy (#00A859)
   =================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&family=Space+Grotesk:wght@500;700&display=swap');

:root {
  /* Brand Palette - Hoa Huy Official Signature Orange & Energy Green */
  --primary: #f25c05;
  --primary-hover: #d94e00;
  --primary-light: #fff2e8;
  --primary-glow: rgba(242, 92, 5, 0.25);
  
  --brand-orange: #ff6000;
  --brand-orange-header: #ec7d31;
  --brand-orange-peach: #f7cbac;
  --brand-orange-subtle: #fdf6f0;

  --accent-green: #00a859;
  --accent-green-hover: #008f4c;
  --accent-green-light: #e6f7ef;

  /* Surfaces & Neutrals matching PDF */
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-subtle: #f4f5f0;
  --border-color: #e2e8f0;
  --border-focus: #f25c05;

  /* Text colors */
  --text-main: #231f20;
  --text-muted: #595657;
  --text-light: #94a3b8;
  --text-inverse: #ffffff;

  /* Dark Elements / Hero */
  --dark-surface: #231f20;
  --dark-card: #1f2937;
  --dark-border: #374151;

  /* Status Colors */
  --success: #00a859;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #0284c7;

  /* Typography */
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Space Grotesk', var(--font-sans);

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.05);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.05);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.06);

  /* Dimensions */
  --header-height: 72px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* ===================================================================
   TOP NAVIGATION BAR
   =================================================================== */
.top-navbar {
  height: var(--header-height);
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  cursor: pointer;
}

.brand-logo-img {
  height: 48px;
  width: auto;
  object-fit: contain;
  transition: transform 0.2s ease;
}

.brand-logo-img:hover {
  transform: scale(1.04);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 800;
  color: #231f20;
  letter-spacing: -0.01em;
}

.brand-subtitle {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-green);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-btn {
  padding: 0.6rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.nav-btn:hover {
  background: #f1f5f9;
  color: var(--text-main);
}

.nav-btn.active {
  background: var(--primary-light);
  color: var(--primary);
  border-color: rgba(242, 92, 5, 0.2);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

body:not(.is-admin) .admin-only {
  display: none !important;
}

.auth-modal {
  max-width: 460px;
}

.auth-description {
  margin: 0 0 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* ===================================================================
   BUTTONS & BADGES
   =================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.8125rem;
}

.btn-lg {
  padding: 0.85rem 1.75rem;
  font-size: 1rem;
}

.btn-primary {
  background: linear-gradient(135deg, #f25c05 0%, #ff7700 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(242, 92, 5, 0.28);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #d94e00 0%, #f25c05 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(242, 92, 5, 0.38);
}

.btn-green {
  background: linear-gradient(135deg, #00a859 0%, #10b981 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(0, 168, 89, 0.25);
}

.btn-green:hover {
  background: linear-gradient(135deg, #008f4c 0%, #00a859 100%);
  transform: translateY(-1px);
}

.btn-secondary {
  background: white;
  border-color: var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.btn-dark {
  background: #0f172a;
  color: white;
}

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

.btn-danger {
  background: #fee2e2;
  border-color: #fecaca;
  color: #dc2626;
}

.btn-danger:hover {
  background: #fecaca;
  color: #b91c1c;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-green {
  background: #d1fae5;
  color: #065f46;
}

.badge-blue {
  background: #e0f2fe;
  color: #0369a1;
}

.badge-amber {
  background: #fef3c7;
  color: #92400e;
}

.badge-slate {
  background: #f1f5f9;
  color: #475569;
}

/* ===================================================================
   MAIN LAYOUT CONTAINER
   =================================================================== */
.main-container {
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem;
  flex: 1;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.section-title-wrap h1 {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: -0.02em;
}

.section-title-wrap p {
  color: var(--text-muted);
  font-size: 0.9375rem;
  margin-top: 0.25rem;
}

.dashboard-source-catalogs {
  margin-top: 2rem;
}

.dashboard-source-catalogs > .section-header {
  margin-bottom: 1.25rem;
}

.source-catalog-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(210px, 280px);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.source-category-filter {
  min-height: 46px;
}

.source-catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1rem;
}

.source-catalog-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  min-width: 0;
  padding: 1.25rem;
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.source-catalog-icon {
  flex: 0 0 56px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-md);
  font-size: 0.78rem;
  font-weight: 800;
  color: #fff;
  background: #dc2626;
}

.source-catalog-icon.pptx {
  background: #c2410c;
}

.source-catalog-content {
  flex: 1;
  min-width: 0;
}

.source-catalog-content h2 {
  margin-top: 0.65rem;
  font-family: var(--font-heading);
  font-size: 1rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.source-catalog-filename,
.source-catalog-meta {
  margin-top: 0.35rem;
  color: var(--text-muted);
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.source-catalog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.source-catalog-empty {
  grid-column: 1 / -1;
  padding: 3rem 1rem;
  text-align: center;
  background: #fff;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-lg);
}

.source-catalog-empty p {
  margin-top: 0.35rem;
  color: var(--text-muted);
}

.source-document-viewer {
  background: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.source-document-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.source-document-toolbar strong {
  flex: 1;
  overflow-wrap: anywhere;
}

.source-document-viewer iframe {
  display: block;
  width: 100%;
  height: min(78vh, 1000px);
  border: 0;
  background: #334155;
}

@media (max-width: 760px) {
  .top-navbar {
    height: auto;
    min-height: var(--header-height);
    padding: 0.75rem 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .nav-links {
    order: 3;
    width: 100%;
    overflow-x: auto;
  }

  .nav-actions {
    margin-left: auto;
    gap: 0.4rem;
  }

  #syncStatusBadge {
    display: none;
  }

  .nav-actions .btn {
    padding: 0.45rem 0.65rem;
    font-size: 0.75rem;
  }

  .connector-editor-grid {
    grid-template-columns: 1fr;
  }

  .connector-option-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .connector-editor-upload {
    flex-wrap: wrap;
  }

  .source-catalog-toolbar {
    grid-template-columns: 1fr;
  }

  .source-catalog-grid {
    grid-template-columns: 1fr;
  }

  .source-document-toolbar {
    flex-wrap: wrap;
  }

  .source-document-toolbar strong {
    flex-basis: 100%;
    order: 1;
  }

  .master-products-grid {
    grid-template-columns: 1fr;
  }

  .master-product-detail {
    grid-template-columns: 1fr;
  }

  .master-product-detail-image {
    max-height: 240px;
  }

  .master-product-a4-preview {
    padding: 0.5rem;
  }
}

/* ===================================================================
   STATS ROW
   =================================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.stat-icon.green {
  background: #ecfdf5;
  color: #059669;
}

.stat-icon.blue {
  background: #f0f9ff;
  color: #0284c7;
}

.stat-icon.gold {
  background: #fffbeb;
  color: #d97706;
}

.stat-icon.slate {
  background: #f8fafc;
  color: #475569;
}

.stat-details {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  font-family: var(--font-heading);
  color: var(--text-main);
  margin-top: 0.15rem;
}

/* ===================================================================
   FILTER & SEARCH TOOLBAR
   =================================================================== */
.toolbar-wrap {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
}

.search-input-wrap {
  position: relative;
  flex: 1;
  min-width: 260px;
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  font-size: 1rem;
}

.search-input {
  width: 100%;
  padding: 0.65rem 1rem 0.65rem 2.6rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.filter-pills {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.filter-pill {
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-color);
  background: transparent;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
}

.filter-pill:hover {
  background: #f1f5f9;
  color: var(--text-main);
}

.filter-pill.active {
  background: #0f172a;
  color: #ffffff;
  border-color: #0f172a;
}

/* ===================================================================
   CATALOG CARDS GRID
   =================================================================== */
.catalogs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 1.75rem;
}

.catalog-card {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.catalog-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-xl);
  border-color: #cbd5e1;
}

.card-cover-wrap {
  height: 220px;
  background: linear-gradient(135deg, #064e3b 0%, #065f46 100%);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.catalog-card:hover .card-cover-img {
  transform: scale(1.03);
}

.card-cover-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.85);
  padding: 1.5rem;
  text-align: center;
}

.card-cover-placeholder .icon {
  font-size: 3rem;
  margin-bottom: 0.5rem;
  color: #34d399;
}

.card-cover-badge {
  position: absolute;
  top: 1rem;
  left: 1rem;
  z-index: 2;
}

.card-version-badge {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 2;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  color: white;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
}

.card-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.35;
  margin-bottom: 0.4rem;
}

.card-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-top: 1px solid var(--border-color);
  margin-top: auto;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.card-meta-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.card-actions-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.card-actions-dropdown-btn {
  grid-column: span 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.master-products-grid {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.master-product-card .card-cover-wrap {
  height: 180px;
}

.master-product-card .card-cover-img {
  object-fit: cover;
}

.master-product-card .card-body {
  padding: 1.25rem;
}

.master-product-card .card-title {
  margin-bottom: 0.35rem;
}

.master-product-card .card-subtitle {
  margin-bottom: 0.85rem;
}

.master-product-spec-summary {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
  color: #475569;
  font-size: 0.8125rem;
}

.master-product-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--border-color);
  margin-top: auto;
}

.master-product-actions [data-product-action="view"] {
  grid-column: 1 / -1;
}

.master-product-detail {
  display: grid;
  grid-template-columns: minmax(220px, 0.85fr) 1.15fr;
  gap: 1.5rem;
  align-items: start;
}

.master-product-detail-image {
  width: 100%;
  max-height: 320px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: #f8fafc;
  object-fit: contain;
}

.master-product-detail-content h2 {
  margin: 0.75rem 0;
  color: var(--text-main);
}

.master-product-detail-section {
  margin-top: 1.5rem;
}

.master-product-detail-section h4 {
  margin-bottom: 0.75rem;
  color: var(--text-main);
}

.master-product-detail-specs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.5rem;
}

.master-product-detail-spec {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
}

.master-product-detail-spec span {
  color: var(--text-muted);
}

.master-product-detail-section ul {
  padding-left: 1.25rem;
  color: var(--text-main);
}

.master-product-a4-preview {
  width: 100%;
  margin: 0 auto;
  background: #e2e8f0;
  padding: 1rem;
  overflow: auto;
}

.master-product-a4-preview .a4-page {
  box-sizing: border-box;
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  aspect-ratio: 210 / 297;
  margin: 0 auto !important;
  box-shadow: var(--shadow-md);
}

/* ===================================================================
   EDITOR VIEW
   =================================================================== */
.editor-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.editor-header {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: calc(var(--header-height) + 10px);
  z-index: 40;
}

.editor-header-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.editor-tabs {
  display: flex;
  background: #f1f5f9;
  padding: 0.3rem;
  border-radius: var(--radius-md);
  gap: 0.25rem;
}

.editor-tab-btn {
  padding: 0.55rem 1rem;
  border: none;
  background: transparent;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.editor-tab-btn.active {
  background: white;
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
}

.editor-pane {
  display: none;
}
.editor-pane.active {
  display: block;
}

.editor-card {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.5rem;
}

.editor-card-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.editor-card-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

/* Form Styles */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group.span-full {
  grid-column: 1 / -1;
}

.form-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #334155;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  color: var(--text-main);
  background: white;
  outline: none;
  transition: all 0.2s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-textarea {
  min-height: 90px;
  resize: vertical;
}

/* Product list inside editor */
.editor-products-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.products-reorder-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.product-row-item {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  transition: all 0.2s;
}

.product-row-item:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-sm);
}

.product-row-left {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex: 1;
}

.product-row-thumb {
  width: 70px;
  height: 55px;
  border-radius: var(--radius-sm);
  background: #f1f5f9;
  object-fit: cover;
  border: 1px solid var(--border-color);
}

.product-row-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.product-row-model {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.05rem;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.product-row-specs-summary {
  font-size: 0.8125rem;
  color: var(--text-muted);
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
}

.product-row-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* ===================================================================
   MODAL DIALOGS
   =================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.modal-overlay.active {
  display: flex;
}

.modal-container {
  background: white;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 860px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  animation: modalEnter 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-container.large {
  max-width: 1100px;
}

@keyframes modalEnter {
  from {
    opacity: 0;
    transform: scale(0.97) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

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

.modal-header h3 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.modal-close-btn {
  background: transparent;
  border: none;
  font-size: 1.35rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
}

.modal-close-btn:hover {
  color: #dc2626;
  background: #fee2e2;
}

.modal-body {
  padding: 1.75rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 1rem 1.75rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  background: #f8fafc;
}

/* Copy from Library Grid in Modal */
.product-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  max-height: 480px;
  overflow-y: auto;
  padding: 0.25rem;
}

.picker-product-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: all 0.2s;
  cursor: pointer;
}

.picker-product-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.12);
  transform: translateY(-2px);
}

.picker-product-thumb {
  height: 120px;
  width: 100%;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: #f1f5f9;
}

.picker-product-model {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-main);
}

.picker-product-specs {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

/* ===================================================================
   ONLINE VIEWER (DIGITAL BROCHURE)
   =================================================================== */
.viewer-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #0f172a;
  min-height: calc(100vh - var(--header-height));
  padding: 1.5rem;
  gap: 1.25rem;
}

.viewer-toolbar {
  background: rgba(30, 41, 59, 0.85);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  gap: 1rem;
  color: white;
  z-index: 50;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
}

.viewer-page-indicator {
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 0 0.5rem;
}

.viewer-content-area {
  width: 100%;
  max-width: 950px;
  display: flex;
  justify-content: center;
}

/* ===================================================================
   PRINT & PDF LAYOUT (PIXEL-PERFECT A4 210mm x 297mm)
   =================================================================== */

.print-preview-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
  padding: 2rem 0;
  background: #334155;
  min-height: 100vh;
}

.print-control-bar {
  position: sticky;
  top: 1rem;
  z-index: 100;
  background: #0f172a;
  color: white;
  border: 1px solid #475569;
  border-radius: var(--radius-full);
  padding: 0.75rem 1.75rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  box-shadow: 0 10px 30px rgba(0,0,0,0.6);
}

.print-tip {
  font-size: 0.8125rem;
  color: #94a3b8;
}

/* EXACT A4 PAGE SPECIFICATION */
.a4-page {
  width: 210mm;
  min-height: 297mm;
  height: 297mm;
  background: #ffffff;
  box-shadow: 0 15px 35px rgba(0,0,0,0.4);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  page-break-after: always;
  break-after: page;
  box-sizing: border-box;
}

/* A4 COVER PAGE DESIGN */
.a4-cover-page {
  page: a4-cover;
  container-type: inline-size;
  width: 297mm;
  min-height: 210mm;
  height: 210mm;
  padding: 9mm 12mm 8mm;
  background: #ffffff;
  color: #242424;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
}

.a4-cover-header {
  min-height: 66mm;
  display: grid;
  grid-template-columns: 1fr 1fr;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
}

.a4-cover-brand img {
  display: block;
  width: 30mm;
  height: 25mm;
  object-fit: contain;
  object-position: left top;
  margin-bottom: 1.5mm;
}

.a4-cover-brand strong {
  display: block;
  max-width: 82mm;
  color: #0876b9;
  font-size: 12pt;
  line-height: 1.3;
  text-transform: uppercase;
}

.a4-cover-heading {
  padding-top: 16mm;
  color: #ed6b24;
  text-align: center;
  text-transform: uppercase;
}

.a4-cover-heading span,
.a4-cover-heading h1 {
  font-family: var(--font-heading);
  font-size: 16pt;
  font-weight: 800;
  line-height: 1.35;
}

.a4-cover-heading h1 {
  margin-top: 1mm;
}

.a4-cover-footer {
  min-height: 0;
  flex: 1;
  display: grid;
  grid-template-columns: 37% 63%;
  align-items: end;
  gap: 4mm;
}

.a4-cover-contact {
  display: flex;
  flex-direction: column;
  gap: 3mm;
  align-self: start;
  margin-top: 22mm;
  color: #333333;
  font-size: 9pt;
  line-height: 1.45;
}

.a4-cover-contact strong {
  margin-bottom: 1mm;
  font-size: 12pt;
}

.a4-cover-qr {
  display: block;
  width: 96mm;
  max-width: 100%;
  height: auto;
  margin-top: 2mm;
}

.a4-cover-factory {
  display: block;
  width: 100%;
  height: 78mm;
  align-self: end;
}

@media screen {
  .a4-cover-page {
    width: min(100%, 297mm);
    height: auto;
    min-height: 0;
    aspect-ratio: 297 / 210;
    padding: 3.03cqw 4.04cqw 2.69cqw;
  }

  .a4-cover-header {
    min-height: 24.2cqw;
  }

  .a4-cover-brand img {
    width: 11cqw;
    height: 9.2cqw;
    margin-bottom: 0.5cqw;
  }

  .a4-cover-heading {
    padding-top: 5.86cqw;
  }

  .a4-cover-footer {
    gap: 1.47cqw;
  }

  .a4-cover-contact {
    gap: 1.1cqw;
    margin-top: 8.06cqw;
  }

  .a4-cover-qr {
    width: 34cqw;
    margin-top: 0.7cqw;
  }

  .a4-cover-factory {
    height: 28.6cqw;
  }
}

/* A4 INTRO & PROFILE PAGE */
.a4-intro-page {
  padding: 3rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.a4-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid #059669;
  padding-bottom: 0.75rem;
  margin-bottom: 1.75rem;
}

.a4-page-header .brand-title-small {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 800;
  color: #059669;
  letter-spacing: 0.05em;
}

.a4-page-header .catalog-title-small {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.a4-profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.a4-profile-box {
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
}

.a4-profile-box h4 {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: #059669;
  margin-bottom: 0.65rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.a4-profile-box p {
  font-size: 0.85rem;
  color: #334155;
  line-height: 1.6;
}

.a4-stats-cards-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 1.5rem 0;
}

.a4-stats-mini-card {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: center;
}

.a4-stats-mini-val {
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 800;
  color: #065f46;
}

.a4-stats-mini-lbl {
  font-size: 0.75rem;
  color: #047857;
  font-weight: 600;
  margin-top: 0.2rem;
}

/* A4 PRODUCT SPEC PAGE */
.a4-product-page {
  padding: 1.5rem 1.75rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.a4-product-page.is-compact {
  padding: 1.1rem 1.25rem;
}

.a4-product-page .a4-page-header {
  margin-bottom: 0.75rem;
}

.a4-product-hero {
  display: grid;
  grid-template-columns: 1.2fr 1.8fr;
  gap: 1.5rem;
  margin-bottom: 0.75rem;
  align-items: center;
}

.a4-product-hero.has-connectors {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.8fr);
  gap: 0.8rem;
}

.a4-product-media-column {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  align-self: center;
}

.a4-product-photo-box {
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 155px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.a4-product-page.has-drawing-image .a4-product-photo-box {
  height: 140px;
}

.a4-product-page.is-charger .a4-product-photo-box {
  height: 190px;
  padding: 0.5rem;
}

.a4-product-page.is-charger .a4-product-photo {
  width: 100%;
  height: 100%;
}

.a4-product-photo {
  width: 110%;
  height: 110%;
  max-width: none;
  max-height: none;
  object-fit: contain;
  flex: none;
}

.a4-product-head-info {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.a4-model-code-title {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.02em;
}

.a4-model-subname {
  font-size: 1rem;
  color: #059669;
  font-weight: 700;
}

.a4-pill-specs-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.4rem;
}

.a4-spec-pill {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  color: #1e293b;
}

/* SPECIFICATION TABLE IN A4 MATCHING REFERENCE PDF */
.a4-specs-table-wrap {
  margin-bottom: 0.5rem;
}

.a4-product-page .a4-table-header-title {
  margin-bottom: 0.35rem;
}

.a4-table-header-title {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 800;
  color: #c04400;
  text-transform: uppercase;
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.a4-spec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
  border: 1.5px solid #f7cbac;
}

.a4-spec-table th, .a4-spec-table td {
  padding: 0.28rem 0.6rem;
  border: 1px solid #f7cbac;
  text-align: left;
  line-height: 1.25;
}

.a4-product-page.has-drawing-image .a4-spec-table th,
.a4-product-page.has-drawing-image .a4-spec-table td {
  padding-top: 0.2rem;
  padding-bottom: 0.2rem;
}

.a4-spec-table th {
  background: #fdf5ef;
  font-weight: 700;
  color: #c04400;
  width: 44%;
}

.a4-spec-table td {
  color: #231f20;
  font-weight: 600;
}

.a4-spec-table tr:nth-child(even) td {
  background: #fffcf9;
}

.a4-connector-section {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem;
}

.a4-connector-section.has-one-connector {
  grid-template-columns: minmax(0, 0.5fr);
  justify-content: center;
}

.a4-connector-card {
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid #fed7aa;
  border-radius: var(--radius-sm);
  padding: 0.2rem 0.25rem;
  background: #fffdfa;
  text-align: center;
}

.a4-connector-title {
  color: #c04400;
  font-size: 0.58rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 0.15rem;
}

.a4-connector-card img {
  display: block;
  width: 100%;
  min-height: 0;
  height: 48px;
  object-fit: contain;
}

.a4-product-page.is-charger .a4-connector-card img {
  height: 68px;
}

/* A4 TECHNICAL DRAWING SECTION AT BOTTOM OF PRODUCT */
.a4-drawing-section {
  margin-top: 0.5rem;
  background: #ffffff;
  border: 1.5px solid #ec7d31;
  border-radius: var(--radius-md);
  padding: 0.5rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  box-shadow: var(--shadow-sm);
}

.a4-product-page .a4-drawing-header {
  font-size: 0.75rem;
}

.a4-drawing-header {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 800;
  color: #c04400;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #fed7aa;
  padding-bottom: 0.25rem;
}

.a4-drawing-box {
  width: 100%;
  height: 125px;
  background: #fafaf9;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px dashed #cbd5e1;
}

.a4-product-page.has-drawing-image .a4-drawing-box {
  height: 245px;
}

.a4-drawing-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.a4-product-page.is-compact .a4-product-hero {
  gap: 0.8rem;
  margin-bottom: 0.75rem;
}

.a4-product-page.is-compact .a4-product-hero.has-connectors {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.8fr);
  gap: 0.65rem;
}

.a4-product-page.is-compact .a4-product-photo-box,
.a4-product-page.is-compact.has-drawing-image .a4-product-photo-box,
.a4-product-page.is-compact.is-charger .a4-product-photo-box {
  height: 115px;
}

.a4-product-page.is-compact .a4-spec-table th,
.a4-product-page.is-compact .a4-spec-table td {
  padding: 0.22rem 0.4rem;
  font-size: 0.75rem;
  line-height: 1.2;
}

.a4-product-page.is-compact .a4-specs-table-wrap {
  margin-bottom: 0.85rem;
}

.a4-product-page.is-compact .a4-connector-section {
  gap: 0.3rem;
}

.a4-product-page.is-compact .a4-connector-card {
  padding: 0.18rem 0.22rem;
}

.a4-product-page.is-compact .a4-connector-card img {
  height: 42px;
}

.a4-product-page.is-compact.is-charger .a4-connector-card img {
  height: 68px;
}

.a4-product-page.is-compact .a4-features-box {
  padding: 0.5rem 0.65rem;
  margin-top: 0.5rem;
}

.a4-product-page.is-compact .a4-drawing-section {
  margin-top: 0.65rem;
  padding: 0.5rem 0.65rem;
  gap: 0.35rem;
}

.a4-product-page.is-compact .a4-drawing-box {
  height: 180px;
}

.a4-product-page.is-compact.has-drawing-image .a4-drawing-box {
  height: 150px;
}

/* SPECIFICATION EDITOR TABLE IN MODAL */
.spec-editor-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.spec-editor-table th {
  background: #fdf6f0;
  color: #c04400;
  font-size: 0.8rem;
  font-weight: 700;
  text-align: left;
  padding: 0.6rem 0.85rem;
  border-bottom: 2px solid #f7cbac;
}

.spec-editor-table td {
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid #f1f5f9;
}

.connector-editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.connector-editor-card {
  min-width: 0;
  padding: 1rem;
  border: 1.5px solid #fed7aa;
  border-radius: var(--radius-md);
  background: #fdfaf6;
}

.connector-editor-card > .form-input {
  margin-top: 0.35rem;
}

.connector-option-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.35rem;
  margin: 0.45rem 0 0.65rem;
}

.connector-option {
  min-width: 0;
  min-height: 82px;
  padding: 0.3rem;
  border: 1px solid #d5dbe3;
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: #334155;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  font: inherit;
}

.connector-option:hover {
  border-color: #059669;
  background: #f0fdf4;
}

.connector-option.selected {
  border: 2px solid #059669;
  background: #ecfdf5;
  color: #047857;
  box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.12);
}

.connector-option img {
  width: 100%;
  height: 48px;
  object-fit: contain;
}

.connector-option span {
  width: 100%;
  font-size: 0.62rem;
  line-height: 1.15;
  text-align: center;
}

.connector-editor-upload {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.connector-editor-upload .btn {
  flex: none;
  cursor: pointer;
  white-space: nowrap;
}

.connector-editor-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 110px;
  margin-top: 0.5rem;
  overflow: hidden;
  border: 1px dashed #f7cbac;
  border-radius: var(--radius-sm);
  background: #ffffff;
  color: #94a3b8;
  font-size: 0.75rem;
}

.connector-editor-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

[hidden] {
  display: none !important;
}

.spec-row-actions {
  text-align: center;
  white-space: nowrap;
}

.spec-row-actions button + button {
  margin-left: 0.25rem;
}

.spec-row-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.spec-editor-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-family: var(--font-sans);
  color: var(--text-main);
  background: #ffffff;
}

.spec-editor-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
  outline: none;
}

/* Features checklist */
.a4-features-box {
  background: #fdf6f0;
  border: 1.5px solid #f7cbac;
  border-radius: var(--radius-md);
  padding: 0.55rem 0.8rem;
  margin-top: 0.5rem;
}

.a4-features-title {
  font-family: var(--font-heading);
  font-size: 0.875rem;
  font-weight: 700;
  color: #166534;
  margin-bottom: 0.3rem;
  text-transform: uppercase;
}

.a4-features-list {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem 0.75rem;
}

.a4-features-list li {
  font-size: 0.7rem;
  color: #14532d;
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  line-height: 1.25;
}

.a4-features-list li::before {
  content: "✔";
  color: #059669;
  font-weight: bold;
}

/* A4 Page Footer */
.a4-page-footer {
  border-top: 1px solid var(--border-color);
  padding-top: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* A4 BACK COVER */
.a4-back-cover {
  background: #0f172a;
  color: white;
  padding: 4rem 3.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.a4-back-brand h2 {
  font-family: var(--font-heading);
  font-size: 1.75rem;
  font-weight: 800;
  color: #34d399;
  letter-spacing: 0.05em;
}

.a4-back-brand p {
  color: #94a3b8;
  font-size: 0.9375rem;
  margin-top: 0.5rem;
}

.a4-back-contact-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 2rem;
  margin: 3rem 0;
}

.a4-back-contact-info {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.a4-back-info-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.a4-back-info-item .icon {
  font-size: 1.25rem;
  color: #10b981;
}

.a4-back-qr-box {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.a4-qr-code-placeholder {
  width: 130px;
  height: 130px;
  background: white;
  border-radius: var(--radius-md);
  padding: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.75rem;
}

.a4-qr-code-placeholder svg {
  width: 100%;
  height: 100%;
}

.a4-back-copyright {
  border-top: 1px solid #334155;
  padding-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  font-size: 0.8125rem;
  color: #64748b;
}

/* ===================================================================
   PRINT MEDIA RULES (TRIGGERED BY window.print())
   =================================================================== */
@media print {
  @page {
    size: A4 portrait;
    margin: 0;
  }

  @page a4-cover {
    size: A4 landscape;
    margin: 0;
  }

  html, body {
    background: #ffffff !important;
    color: #000000 !important;
    width: 210mm !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Hide everything except print preview */
  .top-navbar,
  .main-container,
  .print-control-bar,
  .modal-overlay,
  .viewer-wrapper,
  .no-print {
    display: none !important;
  }

  .print-preview-container {
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    display: block !important;
  }

  .a4-page {
    width: 210mm !important;
    height: 297mm !important;
    max-height: 297mm !important;
    margin: 0 !important;
    box-shadow: none !important;
    border: none !important;
    page-break-after: always !important;
    break-after: page !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .a4-cover-page {
    width: 297mm !important;
    min-height: 210mm !important;
    height: 210mm !important;
  }
}

/* Notifications Toast */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}

.toast {
  background: #0f172a;
  color: white;
  padding: 0.85rem 1.4rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  pointer-events: auto;
  animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  border-left: 4px solid var(--primary);
}

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