/* ===== Office (éditeur type Word) ===== */
.office-card {
  display: flex;
  flex-direction: column;
}

.office-header-row {
  flex-wrap: wrap;
  align-items: flex-start;
}

.office-file-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.office-shell {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.office-title-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: end;
  flex-shrink: 0;
}

.office-title-field {
  margin: 0;
}

.office-path {
  margin: 0 0 8px;
  color: var(--muted, #9aa0a6);
  font-size: 0.8rem;
  max-width: 280px;
  text-align: right;
  word-break: break-all;
}

.office-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.28);
  flex-shrink: 0;
}

.office-select {
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.4);
  color: inherit;
  border-radius: 8px;
  min-height: 34px;
  padding: 0 8px;
}

.office-select-font {
  min-width: 160px;
}

.office-select-size {
  min-width: 72px;
}

.office-color {
  width: 34px;
  height: 34px;
  padding: 2px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.35);
  cursor: pointer;
}

.office-tool {
  min-width: 32px;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: inherit;
  font-weight: 700;
  cursor: pointer;
  font-size: 0.8rem;
}

.office-tool:hover {
  border-color: rgba(224, 177, 35, 0.55);
  background: rgba(224, 177, 35, 0.12);
}

.office-tool.is-danger {
  border-color: rgba(242, 63, 67, 0.55);
  color: #ffb4b6;
}

.office-tool.is-recording {
  border-color: rgba(242, 63, 67, 0.7);
  background: rgba(242, 63, 67, 0.18);
  color: #ffc9cb;
  animation: officePulse 1.2s ease-in-out infinite;
}

@keyframes officePulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.65;
  }
}

.office-tool-sep {
  width: 1px;
  height: 22px;
  background: rgba(255, 255, 255, 0.14);
  margin: 0 2px;
}

.office-tool-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  color: var(--muted, #9aa0a6);
  font-weight: 700;
}

.office-tool-label select,
.office-tool-label input[type="color"],
.office-tool-label input[type="range"] {
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.35);
  color: inherit;
  border-radius: 8px;
  min-height: 30px;
}

.office-tool-label select {
  max-width: 140px;
}

.office-tool-label input[type="color"] {
  width: 34px;
  padding: 2px;
  cursor: pointer;
}

.office-tool-label input[type="range"] {
  width: 110px;
  accent-color: #e0b123;
}

.office-tool-label em {
  font-style: normal;
  min-width: 52px;
  color: #ddd;
}

.office-icon-panel {
  flex-shrink: 0;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.32);
  padding: 10px 12px;
}

.office-icon-panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.office-icon-panel-head strong {
  margin-right: auto;
}

.office-icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
  gap: 6px;
  max-height: 140px;
  overflow: auto;
}

.office-img-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(90, 140, 255, 0.35);
  background: rgba(47, 111, 237, 0.12);
  flex-shrink: 0;
}

.office-img-bar > span {
  font-weight: 700;
  font-size: 0.82rem;
  color: #c8d8ff;
}

.office-page-scroll {
  flex: 1 1 0 !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 255, 255, 0.04), transparent 40%),
    #1a1b1f;
  padding: 18px 12px 40px !important;
}

.office-paper {
  width: min(820px, 100%);
  min-height: 1100px;
  margin: 0 auto;
  background: #fffef8;
  color: #141414;
  border-radius: 2px;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.08),
    0 18px 40px rgba(0, 0, 0, 0.35);
  padding: 48px 56px 72px;
}

.office-editor {
  min-height: 980px;
  outline: none;
  font-family: "Segoe UI", Tahoma, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  caret-color: #1a1a1a;
  word-break: break-word;
  position: relative;
}

.office-editor:empty::before {
  content: attr(data-placeholder);
  color: #8a8578;
  pointer-events: none;
}

.office-editor h1 {
  font-size: 2rem;
  margin: 0.4em 0;
}
.office-editor h2 {
  font-size: 1.55rem;
  margin: 0.4em 0;
}
.office-editor h3 {
  font-size: 1.25rem;
  margin: 0.4em 0;
}

.office-editor .office-media {
  position: relative;
  display: inline-block;
  max-width: 100%;
  margin: 10px 0;
  vertical-align: middle;
  line-height: 0;
  outline: 2px solid transparent;
  outline-offset: 2px;
}

.office-editor .office-media.is-selected {
  outline-color: #2f6fed;
}

.office-editor .office-media img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 2px;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.office-editor .office-media.is-left {
  float: left;
  margin: 6px 16px 10px 0;
}
.office-editor .office-media.is-right {
  float: right;
  margin: 6px 0 10px 16px;
}
.office-editor .office-media.is-center {
  display: block;
  float: none;
  margin: 12px auto;
}

.office-resize-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: #fff;
  border: 2px solid #2f6fed;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  display: none;
  z-index: 3;
  pointer-events: auto;
}

.office-media.is-selected .office-resize-handle {
  display: block;
}

.office-resize-handle[data-dir="nw"] { left: -5px; top: -5px; cursor: nwse-resize; }
.office-resize-handle[data-dir="n"]  { left: 50%; top: -5px; transform: translateX(-50%); cursor: ns-resize; }
.office-resize-handle[data-dir="ne"] { right: -5px; top: -5px; cursor: nesw-resize; }
.office-resize-handle[data-dir="e"]  { right: -5px; top: 50%; transform: translateY(-50%); cursor: ew-resize; }
.office-resize-handle[data-dir="se"] { right: -5px; bottom: -5px; cursor: nwse-resize; }
.office-resize-handle[data-dir="s"]  { left: 50%; bottom: -5px; transform: translateX(-50%); cursor: ns-resize; }
.office-resize-handle[data-dir="sw"] { left: -5px; bottom: -5px; cursor: nesw-resize; }
.office-resize-handle[data-dir="w"]  { left: -5px; top: 50%; transform: translateY(-50%); cursor: ew-resize; }

.office-img-hint {
  font-style: normal;
  font-size: 0.75rem;
  color: #9eb4ff;
  margin-left: 4px;
}

.office-editor .office-media,
.office-editor .office-icon {
  cursor: grab;
  touch-action: none;
}

.office-editor .office-media.is-dragging,
.office-editor .office-icon.is-dragging {
  opacity: 0.85;
  cursor: grabbing;
  z-index: 40 !important;
}

.office-editor .office-media.is-free,
.office-editor .office-icon.is-free {
  position: absolute;
  float: none !important;
  margin: 0 !important;
  z-index: 6;
}

.office-editor .office-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  border-radius: 4px;
  outline: 2px solid transparent;
  outline-offset: 1px;
  user-select: none;
  color: #1f2937;
}

.office-editor .office-icon.is-selected {
  outline-color: #e0b123;
  background: rgba(224, 177, 35, 0.12);
}

.office-editor .office-icon svg {
  width: 1em;
  height: 1em;
  display: block;
  fill: currentColor;
}

.office-icon-btn {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: #e8eaed;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 6px;
}

.office-icon-btn svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.office-icon-btn:hover {
  border-color: rgba(224, 177, 35, 0.5);
  background: rgba(224, 177, 35, 0.12);
}

.office-editor audio,
.office-editor .office-audio-block {
  display: block;
  width: 100%;
  max-width: 420px;
  margin: 10px 0;
}

.office-crop-card {
  width: min(640px, calc(100% - 32px));
}

.office-crop-stage {
  position: relative;
  width: 100%;
  height: 360px;
  border-radius: 12px;
  overflow: hidden;
  background: #0b0b0d;
  cursor: grab;
  touch-action: none;
}

.office-crop-stage.is-dragging {
  cursor: grabbing;
}

.office-crop-stage canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.office-crop-frame {
  pointer-events: none;
  position: absolute;
  inset: 28px 48px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.45);
  border-radius: 4px;
}

.page[data-page-view="office"].is-active {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 160px);
  max-height: calc(100vh - 160px);
  min-height: 0;
  overflow: hidden;
}

.page[data-page-view="office"].is-active .edt-card {
  flex: 1;
  min-height: 0;
  max-height: 100%;
  height: 100%;
  overflow: hidden;
}

@media (max-width: 900px) {
  .office-title-row {
    grid-template-columns: 1fr;
  }

  .office-path {
    text-align: left;
    max-width: none;
  }

  .office-paper {
    padding: 28px 20px 48px;
    min-height: 900px;
  }

  .office-editor {
    min-height: 780px;
  }
}
