/* Custom styles for Amex Email & Image Tool Suite */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --primary-blue: #006FCF;
  --primary-blue-dark: #004b91;
  --accent-blue: #002663;
  --bg-slate: #f8fafc;
  --border-color: #e2e8f0;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: #0f172a;
  color: #f1f5f9;
  min-height: 100vh;
}

code, pre, .font-mono {
  font-family: 'JetBrains Mono', monospace;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: #1e293b;
}
::-webkit-scrollbar-thumb {
  background: #475569;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

/* Dropzone Styles */
.dropzone {
  border: 2px dashed #475569;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  background: rgba(30, 41, 59, 0.5);
  backdrop-filter: blur(8px);
}
.dropzone:hover, .dropzone.dragover {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.08);
  transform: scale(1.005);
}

/* Tab Animation */
.tab-btn {
  position: relative;
  transition: all 0.2s ease;
}
.tab-btn.active {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  border-color: #38bdf8;
}
.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 15%;
  right: 15%;
  height: 2px;
  background: #38bdf8;
  border-radius: 2px;
  box-shadow: 0 0 10px #38bdf8;
}

/* Checkerboard background for transparent image preview */
.checkerboard-bg {
  background-color: #1e293b;
  background-image: 
    linear-gradient(45deg, #334155 25%, transparent 25%), 
    linear-gradient(-45deg, #334155 25%, transparent 25%), 
    linear-gradient(45deg, transparent 75%, #334155 75%), 
    linear-gradient(-45deg, transparent 75%, #334155 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
}

.checkerboard-light {
  background-color: #f1f5f9;
  background-image: 
    linear-gradient(45deg, #cbd5e1 25%, transparent 25%), 
    linear-gradient(-45deg, #cbd5e1 25%, transparent 25%), 
    linear-gradient(45deg, transparent 75%, #cbd5e1 75%), 
    linear-gradient(-45deg, transparent 75%, #cbd5e1 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
}

/* Card Glow Effect */
.card-glow {
  background: #1e293b;
  border: 1px solid #334155;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.5);
  transition: all 0.2s ease;
}
.card-glow:hover {
  border-color: #475569;
}

/* Cropper Canvas Container */
.cropper-workspace {
  position: relative;
  overflow: auto;
  user-select: none;
  background: #090d16;
  max-height: 550px;
  border-radius: 8px;
  border: 1px solid #334155;
}

.crop-box-overlay {
  position: absolute;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.65);
  border: 2px solid #38bdf8;
  cursor: move;
  box-sizing: border-box;
}

.crop-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  background: #38bdf8;
  border: 2px solid #0f172a;
  border-radius: 2px;
  box-shadow: 0 0 6px rgba(56, 189, 248, 0.8);
}
.crop-handle.nw { top: -6px; left: -6px; cursor: nwse-resize; }
.crop-handle.ne { top: -6px; right: -6px; cursor: nesw-resize; }
.crop-handle.se { bottom: -6px; right: -6px; cursor: nwse-resize; }
.crop-handle.sw { bottom: -6px; left: -6px; cursor: nesw-resize; }
.crop-handle.n  { top: -6px; left: calc(50% - 5px); cursor: ns-resize; }
.crop-handle.s  { bottom: -6px; left: calc(50% - 5px); cursor: ns-resize; }
.crop-handle.w  { top: calc(50% - 5px); left: -6px; cursor: ew-resize; }
.crop-handle.e  { top: calc(50% - 5px); right: -6px; cursor: ew-resize; }

.crop-grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: 
    linear-gradient(to right, rgba(56, 189, 248, 0.25) 1px, transparent 1px) 0 0 / 33.333% 100%,
    linear-gradient(to bottom, rgba(56, 189, 248, 0.25) 1px, transparent 1px) 0 0 / 100% 33.333%;
}

.crop-badge {
  position: absolute;
  top: -24px;
  left: 0;
  background: #38bdf8;
  color: #0f172a;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
}

/* Multi-slice visual guide */
.slice-rect {
  position: absolute;
  border: 2px dashed #a855f7;
  background: rgba(168, 85, 247, 0.15);
  box-sizing: border-box;
  pointer-events: none;
}
.slice-rect.active-slice {
  border: 2px solid #38bdf8;
  background: rgba(56, 189, 248, 0.2);
}
.slice-label {
  position: absolute;
  top: 4px;
  left: 4px;
  background: #a855f7;
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  pointer-events: none;
}

/* Toast Notifications */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  min-width: 280px;
  max-width: 420px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
  animation: slideIn 0.25s ease forwards;
  backdrop-filter: blur(8px);
}
.toast-success { background: rgba(16, 185, 129, 0.95); color: #fff; }
.toast-error { background: rgba(239, 68, 68, 0.95); color: #fff; }
.toast-info { background: rgba(56, 189, 248, 0.95); color: #0f172a; }
.toast-warning { background: rgba(245, 158, 11, 0.95); color: #fff; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Modal Overlay */
.modal-overlay {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(6px);
}

/* Custom inputs */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
}

/* Glass header */
.glass-header {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #334155;
}

/* QC Tool Specific Styles */
.qc-card {
  background: #131d31;
  border: 1px solid #23334d;
  transition: all 0.2s ease;
}
.qc-card:hover {
  border-color: #38bdf8;
}

.qc-badge-error {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
}
.qc-badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}
.qc-badge-pass {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.qc-split-viewport {
  height: 760px;
  overflow: auto;
  scrollbar-width: thin;
}

.preview-frame-wrapper {
  transition: width 0.2s ease;
  margin: 0 auto;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.7);
  border-radius: 8px;
  background: white;
}

.pdf-canvas-container {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100%;
  background: #090d16;
  padding: 16px;
  overflow: auto;
}

.pdf-canvas-container canvas {
  width: 666px !important;
  min-width: 666px !important;
  height: auto !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  border-radius: 8px;
  display: block;
}

.html-viewport-container {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100%;
  background: #090d16;
  padding: 16px;
  overflow: auto;
}

.qc-split-html-frame {
  width: 666px !important;
  min-width: 666px !important;
  min-height: 720px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  border: 0;
  display: block;
}

/* Split Zoom Transform Container */
.qc-zoom-wrapper {
  transform-origin: top center;
  transition: transform 0.2s ease;
}

/* Visual Overlay Diff */
.diff-overlay-stage {
  position: relative;
  width: 100%;
  height: 760px;
  overflow: auto;
  background: #090d16;
}
.diff-pdf-layer {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 666px !important;
  min-width: 666px !important;
  pointer-events: none;
  z-index: 10;
}
.diff-html-layer {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 666px !important;
  min-width: 666px !important;
  z-index: 20;
  transition: opacity 0.1s ease;
}

/* Fullscreen mode helper */
.qc-full-workspace {
  grid-column: span 12 / span 12 !important;
}

/* Link Locator Highlight Pulse Animation */
@keyframes linkPulse {
  0% { outline: 4px solid #38bdf8; box-shadow: 0 0 15px #38bdf8; transform: scale(1); }
  50% { outline: 4px solid #f43f5e; box-shadow: 0 0 25px #f43f5e; transform: scale(1.04); }
  100% { outline: 4px solid #38bdf8; box-shadow: 0 0 15px #38bdf8; transform: scale(1); }
}

.qc-link-highlight-pulse {
  animation: linkPulse 0.8s ease-in-out 3 forwards !important;
  border-radius: 4px !important;
  display: inline-block !important;
  position: relative !important;
  z-index: 9999 !important;
}
