/* ==========================================================================
   DocScanner - Professional Document Scanner Studio
   Matches Windows Scanner Interface (HP Ink Tank 310 series USB)
   ========================================================================== */

:root {
  --win-font: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  --win-bg: #ffffff;
  --win-sidebar: #f0f0f0;
  --win-ribbon: #ffffff;
  --win-border: #d9d9d9;
  --win-input-border: #adadad;
  --win-hover: #e5f1fb;
  --win-hover-border: #0078d7;
  --win-active: #cce4f7;
  --win-text: #000000;
  --win-text-muted: #555555;
  --naps-blue: #0078d7;
  --selected-border: #0078d7;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--win-font);
  background: var(--win-bg);
  color: var(--win-text);
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  user-select: none;
}

/* --------------------------------------------------------------------------
   1. Window Title Bar (DocScanner Title)
   -------------------------------------------------------------------------- */
.naps2-titlebar {
  background: #ffffff;
  border-bottom: 1px solid #e5e5e5;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 0 10px;
  font-size: 12px;
  color: #333333;
}

.titlebar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.naps2-logo-icon {
  width: 16px;
  height: 16px;
}

.window-title {
  font-size: 12px;
  color: #1e1e1e;
  font-weight: 500;
}

.titlebar-right {
  display: flex;
  align-items: center;
  height: 100%;
}

.home-link-btn {
  font-size: 11px;
  color: #0067b8;
  text-decoration: none;
  padding: 4px 10px;
  border-right: 1px solid #e5e5e5;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 4px;
}

.home-link-btn:hover {
  background: #f0f0f0;
}

.win-control-btn {
  width: 44px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  font-size: 11px;
  color: #333333;
  cursor: pointer;
}

.win-control-btn:hover {
  background: #e5e5e5;
}

.win-control-btn.close:hover {
  background: #e81123;
  color: #ffffff;
}

/* --------------------------------------------------------------------------
   2. Top Ribbon Toolbar
   -------------------------------------------------------------------------- */
.naps2-ribbon {
  background: var(--win-ribbon);
  border-bottom: 1px solid var(--win-border);
  min-height: 86px;
  padding: 4px 6px;
  display: flex;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
}

.ribbon-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px 6px;
  min-width: 52px;
  height: 74px;
  cursor: pointer;
  font-family: var(--win-font);
  font-size: 11px;
  color: #2b2b2b;
  position: relative;
  transition: all 0.1s ease;
}

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

.ribbon-btn:active {
  background: var(--win-active);
  border-color: var(--win-hover-border);
}

.ribbon-btn svg {
  width: 30px;
  height: 30px;
  margin-bottom: 4px;
}

.ribbon-btn-scan {
  min-width: 58px;
}

.scan-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.scan-arrow {
  position: absolute;
  right: -8px;
  bottom: 8px;
  font-size: 8px;
  color: #555555;
}

/* Stacked Move Up / Move Down Button */
.ribbon-btn-stacked {
  min-width: 76px;
  height: 74px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 3px 6px;
}

.stacked-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #2b2b2b;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 2px;
  width: 100%;
}

.stacked-row:hover {
  background: var(--win-hover);
}

.stacked-row svg {
  width: 15px;
  height: 15px;
  margin-bottom: 0;
  flex-shrink: 0;
}

/* Right-aligned Settings & About */
.ribbon-right-group {
  margin-left: auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 0 10px;
}

.ribbon-right-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #2b2b2b;
  cursor: pointer;
  padding: 3px 6px;
  border: 1px solid transparent;
  border-radius: 2px;
}

.ribbon-right-item:hover {
  background: var(--win-hover);
  border-color: var(--win-hover-border);
}

.ribbon-right-item svg {
  width: 15px;
  height: 15px;
}

/* --------------------------------------------------------------------------
   3. Main Body: Left Sidebar + Center Workspace
   -------------------------------------------------------------------------- */
.naps2-main {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* Left Sidebar */
.naps2-sidebar {
  width: 236px;
  background: var(--win-sidebar);
  border-right: 1px solid var(--win-border);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sidebar-field-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-label {
  font-size: 12px;
  color: #1e1e1e;
  font-weight: 400;
}

.profile-action-btns {
  display: flex;
  gap: 4px;
}

.profile-btn {
  background: #ffffff;
  border: 1px solid #adadad;
  border-radius: 2px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

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

.sidebar-select {
  width: 100%;
  height: 25px;
  background: #ffffff;
  border: 1px solid var(--win-input-border);
  border-radius: 2px;
  padding: 1px 6px;
  font-family: var(--win-font);
  font-size: 12px;
  color: #000000;
  outline: none;
}

.sidebar-select:focus {
  border-color: var(--win-hover-border);
}

/* Device Box */
.device-box {
  background: #ffffff;
  border: 1px solid var(--win-input-border);
  border-radius: 2px;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.device-box-icon {
  width: 38px;
  height: 28px;
  flex-shrink: 0;
}

.device-box-details {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.device-box-name {
  font-size: 12px;
  color: #000000;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.device-box-driver {
  font-size: 11px;
  color: #666666;
  margin-top: 1px;
}

/* Big Scan Button in Sidebar */
.sidebar-scan-btn {
  background: #e1e1e1;
  border: 1px solid #adadad;
  border-radius: 2px;
  height: 28px;
  width: 106px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  font-family: var(--win-font);
  font-size: 12px;
  color: #000000;
  margin-top: 4px;
  transition: all 0.1s ease;
}

.sidebar-scan-btn:hover {
  background: var(--win-hover);
  border-color: var(--win-hover-border);
}

.sidebar-scan-btn:active {
  background: var(--win-active);
}

.sidebar-scan-btn svg {
  width: 16px;
  height: 16px;
}

/* --------------------------------------------------------------------------
   Center Document Workspace (ISOLATED DOCUMENT ZOOM ONLY)
   -------------------------------------------------------------------------- */
.naps2-workspace {
  flex: 1;
  background: #ffffff;
  overflow: auto;
  padding: 24px;
  position: relative;
  /* Prevent full-page scroll/zoom artifacts */
  touch-action: pan-x pan-y;
}

.workspace-pages-container {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  align-items: flex-start;
  min-height: 100%;
  transform-origin: 0 0;
  transition: transform 0.08s ease-out;
}

/* Scanned Page Card (Draggable + Multi-select) */
.naps2-page-card {
  background: #ffffff;
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
  user-select: none;
  transition: box-shadow 0.15s, border-color 0.15s, opacity 0.15s;
}

/* Page Selected: Bright blue border like in reference screenshot */
.naps2-page-card.selected {
  border: 2px solid #0078d7 !important;
  outline: 1px solid #0078d7;
  box-shadow: 0 2px 10px rgba(0, 120, 215, 0.35);
}

/* Page Unselected: Dark grey border like in reference screenshot */
.naps2-page-card:not(.selected) {
  border: 1px solid #717171;
  box-shadow: 2px 2px 6px rgba(0, 0, 0, 0.15);
}

/* Drag & Drop Feedback */
.naps2-page-card.dragging {
  opacity: 0.45;
  border: 2px dashed #0078d7 !important;
}

.naps2-page-card.drag-over {
  border-left: 5px solid #0078d7 !important;
  transform: translateX(4px);
}

.naps2-page-card-wrap {
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.naps2-page-img {
  display: block;
  max-width: 100%;
  height: auto;
  pointer-events: none;
}

/* Page Selection Badge */
.page-badge-number {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(0, 120, 215, 0.85);
  color: #ffffff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 2px;
  pointer-events: none;
}

.page-checkbox-wrap {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 18px;
  height: 18px;
  background: #ffffff;
  border: 1px solid #717171;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.naps2-page-card.selected .page-checkbox-wrap {
  background: #0078d7;
  border-color: #0078d7;
}

.page-checkbox-wrap svg {
  display: none;
  width: 12px;
  height: 12px;
  color: #ffffff;
}

.naps2-page-card.selected .page-checkbox-wrap svg {
  display: block;
}

/* --------------------------------------------------------------------------
   4. Bottom Toolbar & Notifications
   -------------------------------------------------------------------------- */
.naps2-bottombar {
  background: #ffffff;
  border-top: 1px solid var(--win-border);
  height: 28px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: #555555;
}

.bottombar-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.bottom-icon-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 2px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #444444;
}

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

.bottom-icon-btn svg {
  width: 14px;
  height: 14px;
}

.bottombar-right {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 11px;
}

/* Windows Toast Banner */
.win-toast-banner {
  position: fixed;
  bottom: 34px;
  right: 14px;
  background: #ffffff;
  border: 1px solid #d9d9d9;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border-radius: 2px;
  padding: 10px 14px;
  min-width: 160px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 1000;
  font-family: var(--win-font);
}

.win-toast-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.win-toast-title {
  font-size: 12px;
  font-weight: 600;
  color: #1e1e1e;
}

.win-toast-close {
  background: transparent;
  border: none;
  font-size: 12px;
  color: #777777;
  cursor: pointer;
  line-height: 1;
}

.win-toast-close:hover {
  color: #000000;
}

.win-toast-link {
  font-size: 11px;
  color: #0067b8;
  text-decoration: underline;
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   5. Dynamic Circular Scanning Progress Overlay
   -------------------------------------------------------------------------- */
.scan-spinner-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 20000;
  color: #ffffff;
  font-family: var(--win-font);
}

.scan-progress-box {
  background: #1e293b;
  border: 1px solid #475569;
  border-radius: 8px;
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  min-width: 320px;
}

.circular-progress-wrap {
  position: relative;
  width: 110px;
  height: 110px;
  margin-bottom: 16px;
}

.progress-ring {
  transform: rotate(-90deg);
}

.progress-ring-bg {
  stroke: rgba(255, 255, 255, 0.15);
}

.progress-ring-fill {
  stroke: #0ea5e9;
  transition: stroke-dashoffset 0.18s ease;
}

.progress-text-center {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: #38bdf8;
}

.scan-stage-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
  color: #f8fafc;
}

.scan-stage-detail {
  font-size: 12px;
  color: #94a3b8;
}

/* --------------------------------------------------------------------------
   6. Image Studio Tool Tabs & Multi-Page Editing Modal
   -------------------------------------------------------------------------- */
.naps2-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.naps2-dialog {
  background: #ffffff;
  border: 1px solid #707070;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  width: 95%;
  max-width: 940px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
}

.dialog-titlebar {
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
}

.dialog-close-btn {
  background: transparent;
  border: none;
  font-size: 15px;
  cursor: pointer;
  color: #475569;
}

.dialog-close-btn:hover {
  color: #0f172a;
}

/* Studio Tool Tabs */
.image-studio-tabs {
  display: flex;
  background: #f1f5f9;
  border-bottom: 1px solid #cbd5e1;
  padding: 4px 8px 0;
  gap: 2px;
  overflow-x: auto;
}

.studio-tab-btn {
  background: transparent;
  border: 1px solid transparent;
  border-bottom: none;
  padding: 6px 12px;
  font-family: var(--win-font);
  font-size: 11px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  border-radius: 4px 4px 0 0;
  transition: all 0.12s;
  white-space: nowrap;
}

.studio-tab-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.studio-tab-btn.active {
  background: #ffffff;
  color: #0078d7;
  border-color: #cbd5e1;
  border-bottom-color: #ffffff;
  margin-bottom: -1px;
}

.dialog-body {
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 12px;
}

.image-edit-grid {
  display: grid;
  grid-template-columns: 1fr 290px;
  gap: 16px;
}

.canvas-preview-wrap {
  background: #1e293b;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  max-height: 480px;
  overflow: hidden;
  position: relative;
  border-radius: 4px;
}

.canvas-preview-wrap canvas {
  max-width: 100%;
  max-height: 450px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

.edit-tools-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 480px;
  overflow-y: auto;
  padding-right: 4px;
}

.tool-section {
  display: none;
  flex-direction: column;
  gap: 10px;
}

.tool-section.active {
  display: flex;
}

.edit-tool-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.edit-tool-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  color: #334155;
}

.filter-btn-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.filter-tag-btn {
  background: #ffffff;
  border: 1px solid #adadad;
  border-radius: 2px;
  padding: 5px 6px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
}

.filter-tag-btn.active, .filter-tag-btn:hover {
  background: var(--win-hover);
  border-color: var(--win-hover-border);
  color: #0078d7;
}

.dialog-footer {
  background: #f0f0f0;
  border-top: 1px solid #d9d9d9;
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-left-info {
  font-size: 11px;
  color: #475569;
}

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

.win-btn {
  background: #e1e1e1;
  border: 1px solid #adadad;
  border-radius: 2px;
  padding: 5px 14px;
  font-family: var(--win-font);
  font-size: 12px;
  cursor: pointer;
}

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

.win-btn-primary {
  background: #0078d7;
  color: #ffffff;
  border-color: #005a9e;
}

.win-btn-primary:hover {
  background: #106ebe;
}

/* Print CSS */
@media print {
  body * {
    visibility: hidden;
  }
  .print-area, .print-area * {
    visibility: visible;
  }
  .print-area {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
  }
  .print-page {
    page-break-after: always;
    width: 100%;
    margin: 0;
  }
  .print-page img {
    width: 100%;
    height: auto;
    display: block;
  }
}

/* ==========================================================================
   Adobe Acrobat-Style Print Studio Styles
   ========================================================================== */
.print-studio-dialog {
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.acrobat-group {
  border: 1px solid #d1d5db;
  border-radius: 3px;
  padding: 8px 10px;
  background: #ffffff;
  font-family: var(--win-font);
  font-size: 11px;
}

.acrobat-group legend {
  font-weight: 700;
  font-size: 11.5px;
  color: #1f2937;
  padding: 0 4px;
}

.acrobat-row {
  display: flex;
  align-items: center;
  font-size: 11px;
}

.acrobat-radio-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.acrobat-radio-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 11.5px;
  user-select: none;
}

.acrobat-radio-label input[type="radio"],
.acrobat-radio-label input[type="checkbox"] {
  cursor: pointer;
  margin: 0;
}

.acrobat-tabs {
  border-bottom: 1px solid #cbd5e1;
  padding-bottom: 4px;
}

.acrobat-tab-btn {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  padding: 3px 8px;
  font-size: 11px;
  border-radius: 3px;
  cursor: pointer;
  transition: all 0.1s ease;
}

.acrobat-tab-btn:hover {
  background: #e2e8f0;
}

.acrobat-tab-btn.active {
  background: #0078d7;
  color: #ffffff;
  border-color: #005a9e;
  font-weight: 600;
}

.preview-sheet-frame {
  transition: transform 0.15s ease;
}

.preview-nav-bar button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

