/* ZnaetAPPS Docs - Suite Editors Stylesheet */

/* Editor Toolbar */
.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 1rem;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--bg-card);
  padding: 2px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
}

.tb-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  white-space: nowrap;
  transition: var(--transition);
}

.tb-btn-icon {
  width: 32px;
  padding: 0;
}

.tb-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Custom Color Picker Popup & Palette */
.color-picker-wrapper {
  position: relative;
  display: inline-block;
}

.color-btn-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
}

.color-bar-sample {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  border: 1px solid var(--border-color);
  display: inline-block;
}

.color-palette-popup {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px;
  box-shadow: var(--shadow-lg);
  z-index: 10000;
  width: 210px;
}

.color-palette-popup.active {
  display: block;
}

.swatch-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}

.color-swatch {
  width: 26px;
  height: 26px;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: var(--transition);
}

.color-swatch:hover {
  transform: scale(1.15);
  box-shadow: var(--shadow-sm);
}

.tb-btn:hover {
  background: var(--bg-subtle);
  color: var(--text-primary);
}

.tb-btn.active {
  background: var(--primary-light);
  color: var(--primary);
}

.tb-select {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
  height: 32px;
}

.tb-input-color {
  width: 30px;
  height: 30px;
  padding: 0;
  border: none;
  background: none;
  cursor: pointer;
}

/* Dropdown Menu for Export & Actions (Never Clipped) */
.tb-dropdown {
  position: relative;
  display: inline-block;
  z-index: 100;
}

.tb-dropdown-content {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 4px;
  background-color: var(--bg-card);
  min-width: 180px;
  max-width: 90vw;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  z-index: 9999;
  overflow: hidden;
}

.tb-dropdown-content button {
  width: 100%;
  padding: 10px 14px;
  text-align: left;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.tb-dropdown-content button:hover {
  background-color: var(--bg-subtle);
  color: var(--primary);
}

.tb-dropdown:hover .tb-dropdown-content,
.tb-dropdown.active .tb-dropdown-content {
  display: block;
}

.editor-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 1rem;
  background: var(--bg-subtle);
  border-top: 1px solid var(--border-color);
  font-size: 0.8rem;
  color: var(--text-secondary);
  flex-shrink: 0;
}

/* MS Office Style Zoom Bar in Status Bar */
.zoom-bar-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: 1rem;
  user-select: none;
}

.zoom-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.zoom-btn:hover {
  color: var(--primary);
}

.zoom-slider {
  width: 100px;
  height: 4px;
  accent-color: var(--primary);
  cursor: pointer;
}

.zoom-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 42px;
  text-align: right;
  cursor: pointer;
}

.zoom-label:hover {
  color: var(--primary);
}

/* Full-Screen Workspace Layouts */
.fullscreen-app-body {
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.fullscreen-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 56px);
  padding: 0 !important;
  margin: 0 !important;
  max-width: 100% !important;
}

.fullscreen-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  border-radius: 0 !important;
  border: none !important;
  box-shadow: none !important;
}

/* Word / Text Document Sheet Viewport with Multi-Page A4 Pagination */
.word-canvas-wrapper {
  flex: 1;
  padding: 2.5rem 1.5rem;
  background: #334155;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
  gap: 2rem;
}

.word-document-page {
  background: #FFFFFF;
  color: #1E293B;
  width: 100%;
  max-width: 816px;
  min-height: 1056px;
  padding: 4rem 4.5rem 5rem 4.5rem;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4);
  border-radius: 2px;
  outline: none;
  font-family: Calibri, Arial, sans-serif;
  font-size: 11pt;
  line-height: 1.6;
  position: relative;
  box-sizing: border-box;
}

.doc-page-footer-num {
  position: absolute;
  bottom: 1.5rem;
  right: 2.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #94A3B8;
  user-select: none;
  pointer-events: none;
}

/* Page Break Divider Visual Indicator */
.doc-page-break {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 816px;
  margin: 1.5rem 0;
  position: relative;
  user-select: none;
  page-break-after: always;
}

.doc-page-break::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  border-top: 2px dashed #94A3B8;
}

.doc-page-break-label {
  position: relative;
  background: #475569;
  color: #F8FAFC;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 4px 14px;
  border-radius: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* MS Word-like Heading & Table Typography Styles */
.word-document-page h1 {
  color: #1F4E78;
  font-size: 18pt;
  font-weight: 700;
  margin-top: 1.5rem;
  margin-bottom: 0.6rem;
  line-height: 1.3;
}

.word-document-page h2 {
  color: #2E74B5;
  font-size: 14pt;
  font-weight: 700;
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
  line-height: 1.35;
}

.word-document-page h3 {
  color: #1F4E78;
  font-size: 12pt;
  font-weight: 700;
  margin-top: 1rem;
  margin-bottom: 0.4rem;
}

.word-document-page p {
  margin-bottom: 0.8rem;
}

.word-document-page strong, .word-document-page b {
  font-weight: 700;
  color: #0F172A;
}

.word-document-page table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.25rem 0;
  border: 1px solid #8EA9DB;
  font-size: 10pt;
}

.word-document-page th, .word-document-page td {
  padding: 8px 12px;
  border: 1px solid #8EA9DB;
  text-align: left;
}

.word-document-page th {
  background-color: #D9E1F2;
  color: #1F4E78;
  font-weight: 700;
}

.word-document-page ul, .word-document-page ol {
  margin-left: 1.5rem;
  margin-bottom: 0.8rem;
}

.word-document-page li {
  margin-bottom: 0.3rem;
}

[data-theme="dark"] .word-document-page {
  background: #FFFFFF;
  color: #1E293B;
}

/* Excel / Sheet Grid Viewport */
.sheet-container {
  display: flex;
  flex-direction: column;
  width: 100%;
  flex: 1;
}

.sheet-formula-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.cell-address {
  width: 60px;
  font-weight: 700;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--primary);
  text-align: center;
}

.formula-input {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-primary);
  outline: none;
}

.sheet-table-wrapper {
  flex: 1;
  overflow: auto;
  background: var(--bg-card);
}

.excel-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.85rem;
  user-select: none;
}

.excel-table th, .excel-table td {
  border: 1px solid var(--border-color);
  padding: 6px 10px;
  min-width: 90px;
  height: 32px;
  position: relative;
}

.excel-table th {
  background: var(--bg-subtle);
  color: var(--text-secondary);
  font-weight: 600;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 10;
}

.excel-table th .sort-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.65rem;
  padding: 0 2px;
  cursor: pointer;
  transition: var(--transition);
}

.excel-table th .sort-btn:hover {
  color: var(--primary);
}

.excel-table th.row-header {
  position: sticky;
  left: 0;
  z-index: 11;
  width: 50px;
  min-width: 50px;
}

.excel-table td {
  outline: none;
  color: var(--text-primary);
}

.excel-table td.selected {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
  background: rgba(37, 99, 235, 0.05);
}

/* PDF Studio Viewport */
.pdf-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.pdf-viewport {
  flex: 1;
  padding: 2rem;
  background: #334155;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
}

.pdf-canvas-card {
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  margin-bottom: 1.5rem;
  background: #FFFFFF;
}

.pdf-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  margin: auto;
  max-width: 500px;
  text-align: center;
  cursor: pointer;
  background: var(--bg-card);
  transition: var(--transition);
}

.pdf-dropzone:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

/* Slides / Presentation Showcase */
.slides-in-dev-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
  max-width: 700px;
  margin: auto;
}

.slides-icon-wrap {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-lg);
  background: rgba(217, 119, 6, 0.1);
  color: var(--accent-slides);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
}

.slides-icon-wrap svg {
  width: 44px;
  height: 44px;
}

.dev-badge {
  background: #FEF3C7;
  color: #92400E;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  margin-bottom: 1rem;
  display: inline-block;
}

.slides-features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 2rem;
  width: 100%;
}

.feature-mini-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  text-align: left;
  font-size: 0.85rem;
}

/* Drawing Canvas & Vector Shape Modals */
.drawing-pad-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.drawing-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-subtle);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  width: 100%;
}

.drawing-canvas-card {
  background: #FFFFFF;
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-md);
  cursor: crosshair;
  box-shadow: var(--shadow-sm);
  touch-action: none;
}

.shapes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.shape-option-card {
  background: var(--bg-subtle);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}

.shape-option-card:hover, .shape-option-card.active {
  border-color: var(--primary);
  background: var(--primary-light);
}

.shape-option-card svg {
  width: 48px;
  height: 48px;
  margin-bottom: 0.5rem;
}

/* Embedded Document Elements (Resizable SVGs and Images) */
.doc-embedded-shape, .doc-embedded-img {
  display: inline-block;
  margin: 0.5rem;
  max-width: 100%;
  vertical-align: middle;
}

.doc-embedded-shape svg {
  display: block;
  max-width: 100%;
}

/* Mobile Editor Adaptations (MS Office Mobile Style) */
@media (max-width: 768px) {
  .fullscreen-main {
    height: calc(100vh - 48px) !important;
  }

  .word-canvas-wrapper {
    padding: 0.75rem 0.25rem !important;
    gap: 1rem !important;
  }

  .word-document-page {
    padding: 1.5rem 1.25rem !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 600px !important;
    font-size: 15px !important;
    border-radius: 4px !important;
  }

  .editor-toolbar {
    height: 42px !important;
    padding: 0 0.5rem !important;
    gap: 0.35rem !important;
    display: flex !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    align-items: center !important;
    justify-content: flex-start !important;
    -webkit-overflow-scrolling: touch !important;
    background: var(--bg-subtle) !important;
    border-bottom: 1px solid var(--border-color) !important;
  }

  .toolbar-group {
    flex-shrink: 0 !important;
    height: 32px !important;
  }

  .tb-btn {
    min-width: 28px !important;
    height: 28px !important;
    padding: 0 6px !important;
    font-size: 0.8rem !important;
  }

  .tb-select {
    height: 28px !important;
    font-size: 0.8rem !important;
    padding: 2px 4px !important;
    max-width: 110px !important;
  }

  .tb-dropdown-content {
    position: fixed !important;
    left: 5vw !important;
    right: 5vw !important;
    top: auto !important;
    bottom: 20px !important;
    width: 90vw !important;
    max-width: 90vw !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5) !important;
    z-index: 10000 !important;
  }

  .sheet-formula-bar {
    flex-wrap: wrap;
  }

  .pdf-controls {
    flex-direction: column;
    gap: 0.5rem;
    align-items: stretch;
  }

  .pdf-viewport {
    padding: 1rem 0.5rem;
  }

  .pdf-dropzone {
    padding: 2rem 1rem;
    margin: 1.5rem 0.5rem;
  }
}

/* PERFECT PRINT MEDIA OVERRIDE - NO HEADERS / FOOTERS / SITE CHROME */
@media print {
  @page {
    margin: 15mm;
    size: A4 portrait;
  }

  /* Completely hide website header, footer, toolbars, controls, ecosystem bar, modals */
  .site-header,
  .site-footer,
  .editor-toolbar,
  .editor-status-bar,
  .ecosystem-bar,
  .hero-banner,
  .android-banner,
  .modal-overlay,
  .tb-dropdown,
  .header-controls,
  .pdf-controls,
  .sheet-formula-bar {
    display: none !important;
  }

  body,
  html,
  .fullscreen-app-body,
  .main-content,
  .fullscreen-main,
  .suite-panel,
  .fullscreen-panel,
  .word-canvas-wrapper {
    background: #FFFFFF !important;
    color: #000000 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    box-shadow: none !important;
    width: 100% !important;
    height: auto !important;
    overflow: visible !important;
  }

  .word-document-page {
    width: 100% !important;
    max-width: 100% !important;
    min-height: auto !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    border: none !important;
    background: #FFFFFF !important;
    color: #000000 !important;
  }
}
