/* ==========================================================================
   PRINT HUB — Stitch Design System Toolkit for Browser Tools
   Pixel-perfect parity with reference designs (AI Passport & Smart ID Studio)
   ========================================================================== */

:root {
  --stitch-bg: #f8f9ff;
  --stitch-surface: #f8f9ff;
  --stitch-surface-white: #ffffff;
  --stitch-surface-lowest: #ffffff;
  --stitch-surface-low: #eff4ff;
  --stitch-surface-container: #e5eeff;
  --stitch-surface-high: #dce9ff;
  --stitch-surface-highest: #d3e4fe;
  --stitch-primary: #4F46E5;
  --stitch-primary-dark: #3525cd;
  --stitch-primary-container: #4f46e5;
  --stitch-primary-hover: #4338CA;
  --stitch-primary-fixed: #e2dfff;
  --stitch-text-primary: #0F172A;
  --stitch-text-secondary: #334155;
  --stitch-text-muted: #64748B;
  --stitch-border-subtle: #E2E8F0;
  --stitch-border-focus: #C7D2FE;
  --stitch-success-bg: #ECFDF5;
  --stitch-success-text: #065F46;
  --stitch-pending-bg: #FEF3C7;
  --stitch-pending-text: #92400E;
  --stitch-whatsapp: #25D366;
}

[data-theme="dark"] {
  --stitch-bg: #0B1120;
  --stitch-surface: #0F172A;
  --stitch-surface-white: #1E293B;
  --stitch-surface-lowest: #0F172A;
  --stitch-surface-low: #162237;
  --stitch-surface-container: #1E293B;
  --stitch-surface-high: #27354E;
  --stitch-surface-highest: #334566;
  --stitch-text-primary: #F8FAFC;
  --stitch-text-secondary: #CBD5E1;
  --stitch-text-muted: #94A3B8;
  --stitch-border-subtle: #334155;
}

.stitch-tool-wrapper {
  background-color: var(--stitch-bg);
  min-height: calc(100vh - 70px);
  padding-bottom: 60px;
}

/* Context Ribbon */
.stitch-context-bar {
  background: var(--stitch-surface-low);
  padding: 10px 24px;
  border-bottom: 1px solid var(--stitch-border-subtle);
}

.stitch-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Card surfaces */
.stitch-card {
  background: var(--stitch-surface-white);
  border-radius: 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
  border: 1px solid var(--stitch-border-subtle);
  padding: 20px;
}

/* Sliders */
.stitch-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--stitch-surface-container);
  border-radius: 999px;
  outline: none;
}
.stitch-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--stitch-primary);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.4);
  transition: transform 0.15s ease;
}
.stitch-range::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

/* D-Pad controls */
.stitch-dpad-btn {
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--stitch-surface-white);
  border: 1px solid var(--stitch-border-subtle);
  border-radius: 8px;
  color: var(--stitch-text-primary);
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  transition: all 0.12s ease;
}
.stitch-dpad-btn:hover {
  background: var(--stitch-surface-high);
}
.stitch-dpad-btn:active {
  transform: scale(0.95);
}
.stitch-dpad-btn.center-btn {
  background: var(--stitch-primary);
  color: #ffffff;
  border-color: var(--stitch-primary);
}
.stitch-dpad-btn.center-btn:hover {
  background: var(--stitch-primary-hover);
}

/* Preset buttons */
.stitch-preset-btn {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--stitch-surface-low);
  border: 1px solid var(--stitch-border-subtle);
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
}
.stitch-preset-btn:hover {
  background: var(--stitch-surface-container);
  border-color: var(--stitch-border-focus);
}
.stitch-preset-btn.active {
  background: var(--stitch-primary);
  color: #ffffff !important;
  border-color: var(--stitch-primary);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}
.stitch-preset-btn.active * {
  color: #ffffff !important;
}

/* Pills & Chips */
.stitch-pill-btn {
  padding: 6px 14px;
  border-radius: 8px;
  background: var(--stitch-surface-low);
  border: 1px solid var(--stitch-border-subtle);
  color: var(--stitch-text-primary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}
.stitch-pill-btn:hover {
  background: var(--stitch-surface-container);
}
.stitch-pill-btn.active {
  background: var(--stitch-primary);
  color: #ffffff;
  border-color: var(--stitch-primary);
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.25);
}

/* Primary actions */
.stitch-btn-primary {
  width: 100%;
  height: 48px;
  border-radius: 10px;
  background: var(--stitch-primary);
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 700;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.25);
  transition: all 0.2s ease;
}
.stitch-btn-primary:hover {
  background: var(--stitch-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(79, 70, 229, 0.35);
}
.stitch-btn-primary:active {
  transform: translateY(0);
}

.stitch-btn-secondary {
  height: 42px;
  border-radius: 8px;
  background: var(--stitch-surface-container);
  color: var(--stitch-primary);
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--stitch-border-subtle);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.stitch-btn-secondary:hover {
  background: var(--stitch-surface-high);
  color: var(--stitch-primary-dark);
}

/* Modals */
.stitch-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(6px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.stitch-modal-box {
  background: var(--stitch-surface-white);
  border-radius: 16px;
  max-width: 800px;
  width: 100%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
  border: 1px solid var(--stitch-border-subtle);
  overflow: hidden;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

/* Guideline specs tables */
.stitch-specs-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
}
.stitch-specs-table th {
  background: var(--stitch-surface-low);
  padding: 12px 16px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--stitch-text-muted);
  border-bottom: 1px solid var(--stitch-border-subtle);
}
.stitch-specs-table td {
  padding: 12px 16px;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--stitch-border-subtle);
  color: var(--stitch-text-primary);
}
.stitch-specs-table tr:hover td {
  background: var(--stitch-surface-low);
}

/* Toast Notifications (Top-Right SaaS notification style, never covers controls) */
.stitch-toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 9999999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
  max-width: 440px;
}
.stitch-toast {
  background: #0F172A;
  color: #FFFFFF;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  animation: stitchToastIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
.stitch-toast.success {
  background: #064E3B;
  border: 1px solid #10B981;
  color: #ECFDF5;
}
.stitch-toast.error {
  background: #7F1D1D;
  border: 1px solid #EF4444;
  color: #FEF2F2;
}
.stitch-toast.info {
  background: #1E293B;
  border: 1px solid #4F46E5;
  color: #F8FAFC;
}
@keyframes stitchToastIn {
  from { opacity: 0; transform: translateY(-14px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes stitchToastOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(-14px) scale(0.95); }
}

/* Crop & Eraser Handles */
.stitch-crop-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #ffffff;
  border: 2px solid #4F46E5;
  border-radius: 3px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  z-index: 20;
}
.stitch-crop-handle.tl { top: -6px; left: -6px; cursor: nwse-resize; }
.stitch-crop-handle.tr { top: -6px; right: -6px; cursor: nesw-resize; }
.stitch-crop-handle.bl { bottom: -6px; left: -6px; cursor: nesw-resize; }
.stitch-crop-handle.br { bottom: -6px; right: -6px; cursor: nwse-resize; }
.stitch-crop-handle.tc { top: -6px; left: calc(50% - 6px); cursor: ns-resize; }
.stitch-crop-handle.bc { bottom: -6px; left: calc(50% - 6px); cursor: ns-resize; }
.stitch-crop-handle.ml { top: calc(50% - 6px); left: -6px; cursor: ew-resize; }
.stitch-crop-handle.mr { top: calc(50% - 6px); right: -6px; cursor: ew-resize; }

/* Canvas Checkerboard Background for Transparencies */
.stitch-checkerboard {
  background-color: #ffffff;
  background-image: linear-gradient(45deg, #f1f5f9 25%, transparent 25%),
                    linear-gradient(-45deg, #f1f5f9 25%, transparent 25%),
                    linear-gradient(45deg, transparent 75%, #f1f5f9 75%),
                    linear-gradient(-45deg, transparent 75%, #f1f5f9 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
}


/* Material Symbols Outlined Font & Ligature Settings */
@font-face {
  font-family: 'Material Symbols Outlined';
  font-style: normal;
  font-weight: 100 700;
  font-display: block;
  src: url('/fonts/material-symbols-outlined.woff2') format('woff2'),
       url('https://fonts.gstatic.com/s/materialsymbolsoutlined/v377/kJEhBvYX7BgnkSrUwT8OhrdQw4oELdPIeeII9v6oFsI.woff2') format('woff2');
}

.material-symbols-outlined {
  font-family: 'Material Symbols Outlined' !important;
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  font-feature-settings: 'liga';
  -webkit-font-feature-settings: 'liga';
  -webkit-font-smoothing: antialiased;
  vertical-align: middle;
}

/* ================= Mobile & Responsive Refinements ================= */
@media (max-width: 768px) {
  .stitch-context-bar {
    padding: 8px 16px;
  }
  .stitch-container {
    padding: 0 14px;
  }
  .stitch-card {
    padding: 16px;
    border-radius: 12px;
  }
  #stitchToastContainer {
    right: 14px;
    left: 14px;
    bottom: 14px;
  }
  .stitch-toast {
    max-width: 100%;
    font-size: 0.85rem;
    padding: 10px 14px;
  }
}

@media (max-width: 480px) {
  .stitch-tool-wrapper {
    padding-bottom: 40px;
  }
  .stitch-context-bar {
    padding: 8px 10px;
    font-size: 0.78rem;
  }
  .stitch-container {
    padding: 0 10px;
  }
  .stitch-card {
    padding: 12px;
    border-radius: 10px;
  }
  .stitch-dpad-btn {
    height: 34px;
    font-size: 0.95rem;
  }
  .stitch-preset-btn {
    padding: 8px 10px;
    border-radius: 8px;
  }
  .stitch-pill-btn {
    padding: 5px 10px;
    font-size: 0.8rem;
  }
  .material-symbols-outlined {
    font-size: 20px;
  }
}

@media (max-width: 360px) {
  .stitch-container {
    padding: 0 8px;
  }
  .stitch-preset-btn {
    padding: 6px 8px;
  }
  .stitch-card {
    padding: 10px;
  }
}

