/* BioStudio AI — Word & Excel (Office-like) apps. */

.office-app {
  background: #f3f3f3;
}

.office-titlebar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  font-size: 12px;
  color: #fff;
  font-weight: 600;
}
.word-app .office-titlebar { background: #1b5bb0; }
.excel-app .office-titlebar { background: #107c41; }
.office-filename,
.word-filename { letter-spacing: 0.2px; }

/* --- Ribbon ---------------------------------------------------------------- */
.office-ribbon {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: #fafafa;
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
  flex-wrap: wrap;
}
.office-ribbon-group {
  display: flex;
  align-items: center;
  gap: 3px;
}
.office-ribbon-divider {
  width: 1px;
  align-self: stretch;
  margin: 2px 5px;
  background: rgba(0, 0, 0, 0.12);
}

.word-btn,
.excel-btn {
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  border-radius: 5px;
  border: 1px solid transparent;
  background: transparent;
  color: #333;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s ease, border-color 0.1s ease;
}
.word-btn:hover,
.excel-btn:hover { background: #e9eef7; border-color: rgba(0, 0, 0, 0.12); }
.word-btn:active,
.excel-btn:active { background: #dbe5f3; }

.word-primary { background: #1b5bb0; color: #fff; }
.word-primary:hover { background: #1a52a0; border-color: transparent; }
.excel-primary { background: #107c41; color: #fff; }
.excel-primary:hover { background: #0d6b38; border-color: transparent; }

.word-strong { font-weight: 800; }
.word-em { font-style: italic; font-family: Georgia, serif; }
.word-ul { text-decoration: underline; }
.word-strike { text-decoration: line-through; }

.word-select {
  height: 28px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 5px;
  background: #fff;
  font-size: 12.5px;
  padding: 0 4px;
  color: #222;
  cursor: pointer;
}
.word-size { width: 56px; }
.word-color {
  width: 28px;
  height: 28px;
  padding: 2px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 5px;
  background: #fff;
  cursor: pointer;
}

/* --- Word document page ---------------------------------------------------- */
.word-scroll {
  flex: 1 1 auto;
  overflow: auto;
  background: #cdd0d6;
  padding: 26px 0 60px;
  display: flex;
  justify-content: center;
}
/* The page is a single contenteditable column painted to look like a stack of
   letter-sized pages: a repeating gradient draws white page slabs separated by
   gray gaps, and a drop-shadow filter (which follows the transparent gaps)
   gives every page its own shadow. */
.word-page {
  --pg-h: 1056px;   /* 11in @ 96dpi */
  --pg-gap: 26px;   /* visual space between pages */
  width: 816px;     /* 8.5in @ 96dpi */
  max-width: 96%;
  box-sizing: border-box;
  min-height: var(--pg-h);
  padding: 96px;    /* 1in page margins */
  outline: none;
  color: #1b1b1f;
  font-family: Calibri, "Segoe UI", Arial, sans-serif;
  font-size: 11pt;
  line-height: 1.5;
  background-color: transparent;
  background-image: repeating-linear-gradient(
    to bottom,
    #ffffff 0,
    #ffffff var(--pg-h),
    transparent var(--pg-h),
    transparent calc(var(--pg-h) + var(--pg-gap))
  );
  filter: drop-shadow(0 2px 9px rgba(0, 0, 0, 0.28));
}
.word-page:focus { outline: none; }
.word-page p { margin: 0 0 10px; }
.word-page h1 { font-size: 20pt; margin: 0 0 12px; font-weight: 600; }
.word-page h2 { font-size: 16pt; margin: 0 0 10px; font-weight: 600; }
.word-page h3 { font-size: 13pt; margin: 0 0 8px; font-weight: 600; }
.word-page img { max-width: 100%; height: auto; }
.word-page table { border-collapse: collapse; }
.word-page td, .word-page th { border: 1px solid #bbb; padding: 4px 6px; }
.word-status { background: #1b5bb0; color: #eaf1fb; border-top: none; }

/* --- Excel ----------------------------------------------------------------- */
.excel-formula-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.14);
  background: #fff;
}
.excel-namebox {
  width: 86px;
  height: 26px;
  border: none;
  border-right: 1px solid rgba(0, 0, 0, 0.14);
  text-align: center;
  font-size: 12.5px;
  color: #222;
  background: #fafafa;
}
.excel-fx {
  padding: 0 10px;
  font-style: italic;
  font-family: Georgia, serif;
  color: #777;
  border-right: 1px solid rgba(0, 0, 0, 0.14);
  line-height: 26px;
}
.excel-formula-input {
  flex: 1 1 auto;
  height: 26px;
  border: none;
  padding: 0 10px;
  font-size: 13px;
  color: #222;
  outline: none;
}

.excel-grid-scroll {
  flex: 1 1 auto;
  overflow: auto;
  background: #fff;
  outline: none;
}
.excel-table {
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12.5px;
  color: #1b1b1f;
}
.excel-table th,
.excel-table td {
  border: 1px solid #d4d4d4;
  height: 22px;
  padding: 0 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.excel-table td.excel-cell {
  width: 92px;
  max-width: 92px;
  text-align: left;
  background: #fff;
  cursor: cell;
}
.excel-table td.excel-cell.num { text-align: right; }
.excel-table td.excel-cell.err { color: #c0392b; }
.excel-table td.excel-cell.sel {
  outline: 2px solid #107c41;
  outline-offset: -2px;
}
.excel-table td.excel-cell.editing { padding: 0; }
.excel-cell-input {
  width: 100%;
  height: 100%;
  border: none;
  outline: none;
  padding: 0 4px;
  font-size: 12.5px;
  font-family: inherit;
}

.excel-corner {
  position: sticky;
  left: 0;
  top: 0;
  z-index: 3;
  width: 40px;
  background: #f0f0f0;
}
.excel-colhead {
  position: sticky;
  top: 0;
  z-index: 2;
  width: 92px;
  max-width: 92px;
  background: #f0f0f0;
  color: #555;
  font-weight: 600;
  text-align: center;
}
.excel-rowhead {
  position: sticky;
  left: 0;
  z-index: 1;
  width: 40px;
  min-width: 40px;
  background: #f0f0f0;
  color: #555;
  font-weight: 600;
  text-align: center;
}
.excel-colhead.sel,
.excel-rowhead.sel { background: #cfe8d8; color: #0d6b38; }

.excel-sheet-tabs {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px 8px;
  background: #f0f0f0;
  border-top: 1px solid rgba(0, 0, 0, 0.12);
  overflow-x: auto;
}
.excel-tab {
  height: 24px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-bottom: none;
  background: transparent;
  font-size: 12px;
  color: #444;
  cursor: pointer;
  border-radius: 4px 4px 0 0;
}
.excel-tab:hover { background: #e3e3e3; }
.excel-tab.active {
  background: #fff;
  color: #107c41;
  font-weight: 600;
  border-color: rgba(0, 0, 0, 0.12);
}
.excel-tab-add {
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  font-size: 16px;
  color: #555;
  cursor: pointer;
  border-radius: 4px;
}
.excel-tab-add:hover { background: #e3e3e3; }
.excel-status { background: #107c41; color: #eafaf0; border-top: none; }
