/* =========================================
   PARCEL & DISPATCH ADDRESS SLIP STYLES
   ========================================= */

.label-app-body {
  background-color: #f1f5f9;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.label-main-container {
  flex: 1;
  padding: 1.5rem 0 3rem 0;
}

.label-layout-grid {
  display: grid;
  grid-template-columns: 460px 1fr;
  gap: 1.75rem;
  align-items: start;
  width: 100%;
}

/* Left Sidebar Controls Panel */
.label-sidebar-panel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.panel-header {
  background: #ffffff;
  padding: 1.25rem;
  border-radius: 16px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.03);
}

.panel-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.panel-icon-box {
  font-size: 1.8rem;
  background: #eff6ff;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.panel-header h2 {
  font-size: 1.15rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0;
  font-family: var(--font-heading);
}

.panel-header p {
  font-size: 0.78rem;
  color: #64748b;
  margin: 2px 0 0 0;
}

/* Control Cards */
.control-card {
  background: #ffffff;
  padding: 1.25rem;
  border-radius: 16px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.03);
}

.control-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  font-size: 0.88rem;
  color: #1e293b;
  margin-bottom: 0.75rem;
  font-family: var(--font-heading);
}

.card-title-row {
  margin-bottom: 0.85rem;
}

.badge-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.8px;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
}

.tag-to {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.tag-from {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

/* Layout Switch Grid (1-Click Side Switcher) */
.layout-switch-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.btn-layout-mode {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  transition: all 0.2s ease;
}

.btn-layout-mode:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.btn-layout-mode.active {
  background: #eff6ff;
  border-color: #2563eb;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.12);
}

.layout-icon {
  font-size: 1.15rem;
  background: #ffffff;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  color: #1e3a8a;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  flex-shrink: 0;
}

.btn-layout-mode.active .layout-icon {
  background: #2563eb;
  color: #ffffff;
}

.layout-info {
  display: flex;
  flex-direction: column;
}

.layout-info strong {
  font-size: 0.8rem;
  color: #0f172a;
  line-height: 1.2;
}

.layout-info span {
  font-size: 0.68rem;
  color: #64748b;
  margin-top: 2px;
}

/* Segment Button Group */
.segment-btn-group {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: #f1f5f9;
  padding: 4px;
  border-radius: 10px;
  gap: 4px;
}

.segment-btn {
  border: none;
  background: transparent;
  padding: 7px 6px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #475569;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  line-height: 1.2;
}

.segment-btn.active {
  background: #ffffff;
  color: #1e3a8a;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* Form Inputs */
.form-row {
  margin-bottom: 0.75rem;
}

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

.form-row label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 4px;
}

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

.form-control {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.88rem;
  color: #0f172a;
  font-family: inherit;
  outline: none;
  background: #f8fafc;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.form-control:focus {
  border-color: #2563eb;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.bold-input {
  font-weight: 700;
  color: #0f172a;
}

/* Watermark & Sample Controls */
.watermark-options {
  display: flex;
  gap: 8px;
}

.btn-wm {
  padding: 0.55rem 1rem;
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-wm:hover {
  background: #dbeafe;
}

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

.wm-sample-text {
  font-size: 0.72rem;
  color: #64748b;
  margin-top: 4px;
}

.quick-actions-row {
  display: flex;
  gap: 8px;
}

.btn-secondary-action {
  flex: 1;
  padding: 0.65rem;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #475569;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-secondary-action:hover {
  background: #f1f5f9;
  color: #0f172a;
}

/* =========================================
   RIGHT PREVIEW PANEL & SLIP CANVAS
   ========================================= */
/* Right Column: Live High-Resolution A4/A5 Preview (100% Sticky Freeze) */
.label-preview-panel {
  position: -webkit-sticky;
  position: sticky;
  top: 75px;
  align-self: flex-start;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  max-width: 100%;
  z-index: 40;
}

.preview-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #ffffff;
  padding: 0.85rem 1.25rem;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.03);
  flex-wrap: wrap;
  gap: 10px;
}

.preview-title {
  font-size: 0.92rem;
  font-weight: 800;
  color: #0f172a;
  font-family: var(--font-heading);
}

.preview-actions {
  display: flex;
  gap: 8px;
}

.btn-print {
  background: linear-gradient(135deg, #1e3a8a, #2563eb);
  color: #ffffff;
  padding: 0.6rem 1.3rem;
  border-radius: 8px;
  font-weight: 800;
  font-size: 0.86rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
  transition: all 0.2s ease;
}

.btn-print:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

.btn-download-pdf {
  background: linear-gradient(135deg, #059669, #10b981);
  color: #ffffff;
  padding: 0.6rem 1.3rem;
  border-radius: 8px;
  font-weight: 800;
  font-size: 0.86rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
  transition: all 0.2s ease;
}

.btn-download-pdf:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.35);
}

/* Sheet Viewport Wrapper (Clean Fit & Fixed Aspect) */
.sheet-viewport-wrapper {
  background: #cbd5e1;
  padding: 1rem 0.75rem;
  border-radius: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.1);
  width: 100%;
  box-sizing: border-box;
}

/* Physical Sheet Container (Exact Scaled Ratio) */
.sheet-container {
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: all 0.2s ease;
  margin: 0 auto;
  width: 100%;
  max-width: 580px;
}

/* A5 Landscape: Aspect Ratio 210:148 */
.sheet-a5-landscape {
  aspect-ratio: 210 / 148;
  padding: 12px;
}

/* A4 Landscape: Aspect Ratio 297:210 */
.sheet-a4-landscape {
  aspect-ratio: 297 / 210;
  padding: 14px;
}

/* A4 Double: 2 Slips Vertical */
.sheet-a4-double {
  aspect-ratio: 210 / 297;
  padding: 10px;
  gap: 10px;
}

/* Parcel Slip Box */
.parcel-slip-box {
  background: #ffffff;
  flex: 1;
  box-sizing: border-box;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px 20px;
  overflow: hidden;
  font-family: 'Outfit', 'Inter', sans-serif;
  color: #000000;
  width: 100%;
  height: 100%;
}

/* 3-column form grid for styling options */
.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

@media (max-width: 768px) {
  .form-grid-3 {
    grid-template-columns: 1fr;
  }
}

/* Borders Types (Full MS Word Collection) */
.border-solid-double {
  border: 4px double #000000;
  outline: 1px solid #000000;
  outline-offset: 3px;
}

.border-solid-triple {
  border: 6px double #000000;
  outline: 2px solid #000000;
  outline-offset: 4px;
}

.border-solid-bold {
  border: 4px solid #000000;
}

.border-solid-thin {
  border: 1.5px solid #000000;
}

.border-dashed {
  border: 2.5px dashed #000000;
}

.border-dotted {
  border: 3px dotted #000000;
}

.border-groove {
  border: 5px groove #1e293b;
}

.border-ridge {
  border: 5px ridge #1e293b;
}

.border-inset {
  border: 4px inset #334155;
}

.border-outset {
  border: 4px outset #334155;
}

.border-corner-bracket {
  border: 2px solid #000000;
  position: relative;
}

.border-corner-bracket::before {
  content: '';
  position: absolute;
  top: 4px; left: 4px; right: 4px; bottom: 4px;
  border: 1px solid #000000;
  pointer-events: none;
}

.border-none {
  border: 1px solid #cbd5e1;
}

/* Font Weight / Boldness Variations */
.weight-semi-bold .slip-recipient-name,
.weight-semi-bold .slip-sender-name,
.weight-semi-bold .slip-label-heading,
.weight-semi-bold .slip-state-highlight {
  font-weight: 700 !important;
}

.weight-semi-bold .slip-address-line,
.weight-semi-bold .slip-mobile-row {
  font-weight: 500 !important;
}

.weight-normal-regular .slip-recipient-name,
.weight-normal-regular .slip-sender-name,
.weight-normal-regular .slip-label-heading,
.weight-normal-regular .slip-state-highlight,
.weight-normal-regular .slip-address-line,
.weight-normal-regular .slip-mobile-row {
  font-weight: 400 !important;
}

.weight-headers-only .slip-recipient-name,
.weight-headers-only .slip-sender-name,
.weight-headers-only .slip-label-heading {
  font-weight: 800 !important;
}

.weight-headers-only .slip-address-line,
.weight-headers-only .slip-state-highlight,
.weight-headers-only .slip-mobile-row {
  font-weight: 400 !important;
}

/* Watermark Center */
.slip-watermark {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 180px;
  height: 180px;
  pointer-events: none;
  opacity: 0.12;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.slip-watermark img, .slip-watermark svg {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* TO Section (Top Left) */
.slip-to-section {
  position: relative;
  z-index: 2;
  max-width: 72%;
  text-align: left;
}

.slip-label-heading {
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
  text-transform: uppercase;
  color: #000000;
}

.slip-recipient-name {
  font-size: 1.2rem;
  font-weight: 900;
  color: #000000;
  line-height: 1.25;
  margin-bottom: 3px;
  text-transform: uppercase;
}

.slip-address-line {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.35;
  color: #000000;
  text-transform: uppercase;
}

.slip-state-highlight {
  font-size: 1.05rem;
  font-weight: 900;
  color: #000000;
  margin-top: 2px;
  text-transform: uppercase;
}

.slip-mobile-row {
  margin-top: 4px;
  font-size: 1rem;
  font-weight: 800;
  display: flex;
  gap: 5px;
  color: #000000;
}

.mob-label {
  font-weight: 900;
}

/* FROM Section (Bottom Right) */
.slip-from-section {
  position: relative;
  z-index: 2;
  align-self: flex-end;
  max-width: 65%;
  text-align: left;
  margin-top: 1rem;
}

.slip-sender-name {
  font-size: 1.15rem;
  font-weight: 900;
  color: #000000;
  line-height: 1.25;
  margin-bottom: 2px;
  text-transform: uppercase;
}

.from-mob-highlight {
  border-bottom: 2px solid #000000;
  display: inline-flex;
  padding-bottom: 1px;
  margin-top: 4px;
}

.from-mob-highlight .mob-value {
  letter-spacing: 0.5px;
}

.slip-tips-box {
  background: #ffffff;
  padding: 0.85rem 1.25rem;
  border-radius: 12px;
  font-size: 0.82rem;
  color: #475569;
  border: 1px solid rgba(15, 23, 42, 0.08);
}

/* =========================================
   MOBILE RESPONSIVE
   ========================================= */
@media (max-width: 1024px) {
  .label-layout-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  /* Disable sticky freeze on mobile to prevent clipping */
  .label-preview-panel {
    position: static;
    top: auto;
    width: 100%;
    margin-top: 10px;
    z-index: 1;
  }

  .preview-header-bar {
    padding: 0.75rem 1rem;
  }

  .sheet-viewport-wrapper {
    padding: 0.75rem 0.4rem;
    border-radius: 12px;
  }

  .sheet-container {
    max-width: 100%;
  }

  .sheet-a5-landscape {
    padding: 8px;
  }

  .sheet-a4-landscape {
    padding: 10px;
  }

  .parcel-slip-box {
    padding: 12px 14px;
  }

  .slip-recipient-name {
    font-size: 0.95rem;
  }

  .slip-address-line {
    font-size: 0.78rem;
    line-height: 1.3;
  }

  .slip-sender-name {
    font-size: 0.9rem;
  }

  .slip-label-heading {
    font-size: 0.95rem;
  }

  .slip-mobile-row {
    font-size: 0.85rem;
  }

  .layout-switch-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .btn-layout-mode {
    padding: 10px 12px;
  }

  .control-card {
    padding: 1rem;
    border-radius: 14px;
  }

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

/* Print Optimization */
@media print {
  @page {
    margin: 0;
  }
  body {
    background: #ffffff !important;
  }
  body * {
    visibility: hidden;
  }
  .sheet-viewport-wrapper, .sheet-container, .sheet-container * {
    visibility: visible;
  }
  .sheet-viewport-wrapper {
    position: absolute;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background: transparent !important;
    padding: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .sheet-container {
    box-shadow: none !important;
    margin: 0 !important;
    max-width: none !important;
  }
  .sheet-a5-landscape {
    width: 210mm !important;
    height: 148mm !important;
  }
  .sheet-a4-landscape {
    width: 297mm !important;
    height: 210mm !important;
  }
  .sheet-a4-double {
    width: 210mm !important;
    height: 297mm !important;
  }
}

/* Mobile Bottom Navigation (Always Visible with Safe Padding) */
@media (max-width: 992px) {
  body {
    padding-bottom: 95px !important;
  }

  .mobile-bottom-nav {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    z-index: 999999 !important;
  }

  .mobile-bottom-nav-inner {
    display: flex !important;
    justify-content: flex-start !important;
    align-items: center !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scroll-behavior: smooth !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    padding: 3px 6px !important;
    gap: 4px !important;
  }

  .mobile-bottom-nav-inner::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
  }

  .mobile-bottom-item {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-decoration: none !important;
    color: #475569 !important;
    font-size: 0.66rem !important;
    font-weight: 700 !important;
    padding: 4px 6px !important;
    border-radius: 10px !important;
    min-width: 62px !important;
    flex-shrink: 0 !important;
    cursor: pointer !important;
    -webkit-tap-highlight-color: transparent !important;
    pointer-events: auto !important;
    white-space: nowrap !important;
  }
}

/* ==========================================================================
   PARCEL LABEL MAKER — UNIVERSAL PC SCREEN AUTO-FIT ENGINE
   ========================================================================== */
html, body {
  width: 100% !important;
  max-width: 100vw !important;
  overflow-x: clip !important;
}

.label-main-container,
.container {
  width: 100% !important;
  max-width: min(1440px, 95vw) !important;
  margin: 0 auto !important;
}

@media (min-width: 993px) {
  .label-layout-grid {
    display: grid !important;
    grid-template-columns: minmax(360px, 460px) 1fr !important;
    gap: 1.5rem !important;
    align-items: start !important;
  }
}

@media (max-width: 992px) {
  .label-main-container {
    padding: 0.75rem 0.5rem 6rem 0.5rem !important;
  }

  .label-layout-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 1.25rem !important;
    width: 100% !important;
  }

  .label-sidebar-panel,
  .label-preview-panel {
    width: 100% !important;
    max-width: 100% !important;
  }

  .label-preview-canvas-wrapper,
  .parcel-slip-preview {
    max-width: 100% !important;
    overflow-x: auto !important;
  }

  .label-actions-bar,
  .btn-action-group {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    gap: 8px !important;
  }

  .btn-print-slip,
  .btn-download-slip {
    width: 100% !important;
    justify-content: center !important;
    padding: 0.75rem 1rem !important;
  }
}





