/* ============================================
   Folde OS — Office Suite Styles
   Write · Sheet · Deck
   ============================================ */

/* ========================
   SHARED OFFICE CHROME
   ======================== */
.office-ribbon {
  display: flex;
  flex-direction: column;
  border-bottom: 1.5px solid var(--gray-7);
  flex-shrink: 0;
}

.ribbon-tabs {
  display: flex;
  border-bottom: 1px solid var(--gray-8);
  padding: 0 8px;
}

.ribbon-tab {
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--gray-4);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  letter-spacing: 0.2px;
}

.ribbon-tab.active {
  color: var(--black);
  border-bottom-color: var(--black);
}

.ribbon-bar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 5px 10px;
  flex-wrap: wrap;
  background: var(--gray-9);
}

.rb-group {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 6px;
  border-right: 1px solid var(--gray-7);
}

.rb-group:last-child { border-right: none; }

.rb-btn {
  height: 28px;
  min-width: 28px;
  padding: 0 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  border: 1px solid transparent;
  font-size: 13px;
  cursor: pointer;
  background: transparent;
  color: var(--gray-2);
  gap: 4px;
  font-family: var(--font-sans);
}

.rb-btn:hover { background: var(--gray-8); border-color: var(--gray-6); }
.rb-btn.active { background: var(--gray-7); border-color: var(--gray-5); }

.rb-select {
  height: 26px;
  padding: 0 6px;
  border: 1px solid var(--gray-6);
  border-radius: 3px;
  font-size: 12px;
  font-family: var(--font-sans);
  background: var(--white);
  color: var(--black);
  cursor: pointer;
}

.rb-sep { width: 1px; height: 18px; background: var(--gray-7); margin: 0 3px; }

/* ========================
   FOLDE WRITE (Word)
   ======================== */
.write-workspace {
  flex: 1;
  overflow-y: auto;
  background: var(--gray-8);
  display: flex;
  justify-content: center;
  padding: 24px 16px 48px;
}

.write-page {
  width: 100%;
  max-width: 680px;
  min-height: 900px;
  background: var(--white);
  border: 1px solid var(--gray-6);
  padding: 64px 72px;
  font-size: 14px;
  line-height: 1.8;
  outline: none;
  color: var(--black);
  font-family: var(--font-serif);
}

.write-page:focus { outline: none; }

.write-page h1 { font-size: 24px; font-weight: 700; margin-bottom: 8px; font-family: var(--font-sans); }
.write-page h2 { font-size: 18px; font-weight: 700; margin: 16px 0 6px; font-family: var(--font-sans); }
.write-page h3 { font-size: 15px; font-weight: 600; margin: 12px 0 4px; font-family: var(--font-sans); }
.write-page p  { margin-bottom: 10px; }
.write-page ul, .write-page ol { padding-left: 24px; margin-bottom: 10px; }
.write-page li { margin-bottom: 4px; }
.write-page blockquote {
  border-left: 3px solid var(--gray-5);
  padding-left: 14px;
  color: var(--gray-3);
  margin: 12px 0;
}
.write-page table {
  border-collapse: collapse;
  width: 100%;
  margin: 12px 0;
  font-family: var(--font-sans);
  font-size: 13px;
}
.write-page th, .write-page td {
  border: 1px solid var(--gray-6);
  padding: 7px 10px;
  text-align: left;
}
.write-page th { background: var(--gray-9); font-weight: 600; }

.write-statusbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 12px;
  border-top: 1px solid var(--gray-7);
  font-size: 11px;
  color: var(--gray-5);
  background: var(--gray-9);
  flex-shrink: 0;
}

/* ========================
   FOLDE SHEET (Excel)
   ======================== */
.sheet-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sheet-formula-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-bottom: 1px solid var(--gray-7);
  background: var(--gray-9);
  flex-shrink: 0;
}

.sheet-cell-ref {
  width: 64px;
  font-size: 12px;
  font-family: var(--font-mono);
  padding: 4px 6px;
  border: 1px solid var(--gray-6);
  border-radius: 3px;
  text-align: center;
  background: var(--white);
}

.sheet-formula-sep {
  width: 1px;
  height: 16px;
  background: var(--gray-6);
}

.sheet-formula-input {
  flex: 1;
  font-size: 13px;
  font-family: var(--font-mono);
  padding: 4px 8px;
  border: 1px solid var(--gray-6);
  border-radius: 3px;
}

.sheet-grid-wrap {
  flex: 1;
  overflow: auto;
  position: relative;
}

.sheet-table {
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 13px;
  font-family: var(--font-sans);
}

.sheet-table th {
  position: sticky;
  top: 0;
  background: var(--gray-9);
  border: 1px solid var(--gray-7);
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  color: var(--gray-4);
  z-index: 10;
  min-width: 90px;
  user-select: none;
}

.sheet-table th.row-header {
  left: 0;
  z-index: 20;
  min-width: 40px;
  width: 40px;
  position: sticky;
}

.sheet-table td {
  border: 1px solid var(--gray-8);
  padding: 0;
  height: 26px;
  min-width: 90px;
  position: relative;
}

.sheet-table td.row-num {
  background: var(--gray-9);
  border-color: var(--gray-7);
  text-align: center;
  font-size: 11px;
  color: var(--gray-4);
  font-weight: 600;
  position: sticky;
  left: 0;
  z-index: 5;
  width: 40px;
  min-width: 40px;
  user-select: none;
}

.sheet-cell {
  width: 100%;
  height: 100%;
  border: none;
  outline: none;
  padding: 3px 6px;
  font-size: 13px;
  font-family: var(--font-sans);
  background: transparent;
  cursor: cell;
}

.sheet-table td.selected {
  background: #f0f0f0;
  outline: 2px solid var(--black);
  outline-offset: -2px;
  z-index: 2;
}

.sheet-table td.selected .sheet-cell {
  background: #f0f0f0;
}

.sheet-tabs {
  display: flex;
  border-top: 1.5px solid var(--gray-7);
  background: var(--gray-9);
  flex-shrink: 0;
}

.sheet-tab {
  padding: 5px 16px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border-right: 1px solid var(--gray-7);
  border-top: 2px solid transparent;
  color: var(--gray-4);
}

.sheet-tab.active {
  background: var(--white);
  color: var(--black);
  border-top-color: var(--black);
}

.sheet-tab-add {
  padding: 5px 12px;
  font-size: 16px;
  cursor: pointer;
  color: var(--gray-5);
}

.sheet-statusbar {
  padding: 3px 10px;
  font-size: 11px;
  color: var(--gray-5);
  border-top: 1px solid var(--gray-7);
  display: flex;
  gap: 16px;
  background: var(--gray-9);
  flex-shrink: 0;
}

/* ========================
   FOLDE DECK (PowerPoint)
   ======================== */
.deck-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.deck-slides-panel {
  width: 160px;
  border-right: 1.5px solid var(--gray-7);
  overflow-y: auto;
  background: var(--gray-9);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.deck-slide-thumb {
  padding: 8px;
  cursor: pointer;
  border-bottom: 1px solid var(--gray-8);
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}

.deck-slide-thumb:hover { background: var(--gray-8); }
.deck-slide-thumb.active { background: var(--white); border-left: 3px solid var(--black); }

.deck-thumb-preview {
  width: 128px;
  height: 80px;
  border: 1px solid var(--gray-6);
  background: var(--white);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px;
  overflow: hidden;
  position: relative;
}

.deck-thumb-title {
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
}

.deck-thumb-body {
  font-size: 7px;
  color: var(--gray-4);
  text-align: center;
  margin-top: 3px;
  max-width: 100%;
  overflow: hidden;
  line-height: 1.3;
}

.deck-thumb-num {
  font-size: 10px;
  color: var(--gray-5);
}

.deck-add-slide {
  padding: 10px;
  text-align: center;
  font-size: 12px;
  color: var(--gray-4);
  cursor: pointer;
  border-top: 1px solid var(--gray-7);
  margin-top: auto;
}

.deck-add-slide:hover { background: var(--gray-8); color: var(--black); }

.deck-canvas-area {
  flex: 1;
  background: var(--gray-7);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 24px;
}

.deck-slide-canvas {
  width: 600px;
  height: 375px;
  background: var(--white);
  border: 1px solid var(--gray-5);
  display: flex;
  flex-direction: column;
  padding: 48px 56px;
  position: relative;
  flex-shrink: 0;
}

.deck-layout-label {
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 10px;
  color: var(--gray-6);
  letter-spacing: 0.5px;
}

.deck-slide-title-input {
  font-size: 28px;
  font-weight: 700;
  border: none;
  outline: none;
  width: 100%;
  color: var(--black);
  background: transparent;
  font-family: var(--font-sans);
  letter-spacing: -0.5px;
  margin-bottom: 16px;
}

.deck-slide-title-input::placeholder { color: var(--gray-6); }

.deck-slide-body-input {
  font-size: 14px;
  border: none;
  outline: none;
  width: 100%;
  flex: 1;
  resize: none;
  color: var(--gray-2);
  background: transparent;
  font-family: var(--font-sans);
  line-height: 1.7;
}

.deck-slide-body-input::placeholder { color: var(--gray-6); }

.deck-slide-footer {
  position: absolute;
  bottom: 12px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
}

.deck-slide-num {
  font-size: 10px;
  color: var(--gray-6);
}

.deck-properties {
  width: 200px;
  border-left: 1.5px solid var(--gray-7);
  padding: 16px;
  overflow-y: auto;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.deck-prop-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gray-5);
  font-weight: 600;
  margin-bottom: 6px;
}

.deck-prop-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.deck-prop-name {
  font-size: 12px;
  color: var(--gray-3);
}

.deck-layout-btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.deck-layout-btn {
  border: 1.5px solid var(--gray-7);
  border-radius: 4px;
  padding: 8px 4px;
  font-size: 10px;
  cursor: pointer;
  text-align: center;
  background: var(--white);
  color: var(--gray-3);
}

.deck-layout-btn.active, .deck-layout-btn:hover {
  border-color: var(--black);
  background: var(--black);
  color: var(--white);
}

/* ========================
   CLASSROOM SYNC APP
   ======================== */
.classroom-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.classroom-mode-bar {
  display: flex;
  border-bottom: 1.5px solid var(--gray-7);
  flex-shrink: 0;
}

.classroom-mode-btn {
  flex: 1;
  padding: 12px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--gray-4);
  border-bottom: 2px solid transparent;
  background: var(--gray-9);
}

.classroom-mode-btn.active {
  color: var(--black);
  border-bottom-color: var(--black);
  background: var(--white);
}

.classroom-panel {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* BT scanner */
.bt-scan-area {
  border: 1.5px solid var(--gray-7);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.bt-icon {
  font-size: 40px;
  line-height: 1;
}

.bt-status {
  font-size: 14px;
  font-weight: 600;
}

.bt-sub {
  font-size: 12px;
  color: var(--gray-4);
  text-align: center;
}

.bt-devices {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.bt-device-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1.5px solid var(--gray-7);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.bt-device-row:hover { background: var(--gray-9); }
.bt-device-row.connected { border-color: var(--black); background: var(--black); color: var(--white); }
.bt-device-row.connected .bt-device-sub { color: var(--gray-6); }

.bt-device-icon { font-size: 20px; }
.bt-device-name { font-size: 13px; font-weight: 600; }
.bt-device-sub { font-size: 11px; color: var(--gray-5); }
.bt-device-badge {
  margin-left: auto;
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 20px;
  border: 1px solid currentColor;
  font-weight: 600;
  text-transform: uppercase;
}

/* Lesson queue */
.lesson-queue-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gray-5);
  font-weight: 600;
}

.sync-lesson-card {
  border: 1.5px solid var(--gray-7);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sync-lesson-card.new-sync {
  border-color: var(--black);
  background: var(--gray-9);
}

.sync-lesson-title { font-size: 14px; font-weight: 600; }
.sync-lesson-meta { font-size: 12px; color: var(--gray-5); display: flex; gap: 12px; }
.sync-new-badge {
  display: inline-block;
  font-size: 10px;
  padding: 2px 7px;
  background: var(--black);
  color: var(--white);
  border-radius: 20px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

/* Teacher upload panel */
.teacher-upload-area {
  border: 2px dashed var(--gray-6);
  border-radius: var(--radius-md);
  padding: 32px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.teacher-upload-area:hover { border-color: var(--black); background: var(--gray-9); }

.teacher-upload-icon { font-size: 36px; }
.teacher-upload-label { font-size: 14px; font-weight: 600; }
.teacher-upload-sub { font-size: 12px; color: var(--gray-5); }

.teacher-lesson-form {
  border: 1.5px solid var(--gray-7);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input {
  padding: 9px 12px;
  border: 1.5px solid var(--gray-6);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font-sans);
}

.form-textarea {
  padding: 9px 12px;
  border: 1.5px solid var(--gray-6);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font-sans);
  resize: vertical;
  min-height: 100px;
  line-height: 1.6;
}

.broadcast-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  background: var(--black);
  color: var(--white);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.3px;
  width: 100%;
}

.broadcast-btn:hover { background: var(--gray-2); }

.connected-students {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.student-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--gray-8);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.student-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--black);
  flex-shrink: 0;
}

/* ========================
   POWER MANAGEMENT
   ======================== */
body.ultra-save {
  filter: brightness(0.7) contrast(1.2);
}

body.ultra-save .app-icon-img,
body.ultra-save .dock-item.active {
  background: var(--gray-2) !important;
}

.power-banner {
  position: fixed;
  bottom: calc(var(--dock-height) + 4px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--black);
  color: var(--white);
  padding: 7px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  z-index: 2000;
  white-space: nowrap;
}
