/* Ve365 Office Shell — Microsoft Office 365 风格界面 */
@import url('global.css');
:root {
  --office-bg: #f3f2f1;
  --office-white: #ffffff;
  --office-border: #edebe9;
  --office-border-dark: #d2d0ce;
  --office-text: #323130;
  --office-text-secondary: #605e5c;
  --office-hover: #edebe9;
  --office-ribbon-height: 76px;
  --title-bar-height: 32px;
  --status-bar-height: 24px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body.office-app {
  font-family: 'Segoe UI', 'Microsoft YaHei', 'PingFang SC', sans-serif;
  font-size: 12px;
  color: var(--office-text);
  background: var(--office-bg);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* ===== 主题色 ===== */
.theme-word { --accent: #185abd; --accent-hover: #104581; --accent-light: #deecf9; }
.theme-excel { --accent: #217346; --accent-hover: #185c37; --accent-light: #dff6dd; }
.theme-ppt { --accent: #b7472a; --accent-hover: #933826; --accent-light: #fde7e3; }

/* ===== 标题栏 ===== */
.office-titlebar {
  height: var(--title-bar-height);
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 8px;
  flex-shrink: 0;
  user-select: none;
}

.office-titlebar .app-icon {
  width: 16px; height: 16px;
  margin-right: 6px;
  flex-shrink: 0;
}

.office-titlebar .app-name {
  font-size: 12px;
  font-weight: 400;
  margin-right: 4px;
}

.office-titlebar .doc-title {
  font-size: 12px;
  opacity: 0.95;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.office-titlebar .titlebar-spacer { flex: 1; }

.office-titlebar .titlebar-btn {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 11px;
  padding: 2px 10px;
  cursor: pointer;
  border-radius: 2px;
  opacity: 0.9;
}

.office-titlebar .titlebar-btn:hover {
  background: rgba(255,255,255,0.15);
  opacity: 1;
}

.office-titlebar a.home-link {
  color: #fff;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-right: 12px;
  opacity: 0.9;
}

.office-titlebar a.home-link:hover { opacity: 1; }

/* ===== 快速访问工具栏 ===== */
.qat-bar {
  height: 28px;
  background: var(--office-white);
  border-bottom: 1px solid var(--office-border);
  display: flex;
  align-items: center;
  padding: 0 8px;
  gap: 2px;
  flex-shrink: 0;
}

.qat-btn {
  width: 24px; height: 24px;
  border: none;
  background: transparent;
  border-radius: 2px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--office-text);
}

.qat-btn:hover { background: var(--office-hover); }
.qat-btn svg { width: 14px; height: 14px; fill: currentColor; }

.qat-sep {
  width: 1px; height: 16px;
  background: var(--office-border-dark);
  margin: 0 4px;
}

.qat-file-btn {
  height: 24px;
  padding: 0 12px;
  border: 1px solid var(--office-border-dark);
  background: var(--office-white);
  border-radius: 2px;
  cursor: pointer;
  font-size: 12px;
  color: var(--office-text);
  position: relative;
}

.qat-file-btn:hover { background: var(--office-hover); }

/* ===== Ribbon ===== */
.office-ribbon {
  background: var(--office-white);
  border-bottom: 1px solid var(--office-border-dark);
  flex-shrink: 0;
}

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

.ribbon-tab {
  padding: 6px 14px;
  border: none;
  background: transparent;
  font-size: 12px;
  color: var(--office-text);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: background 0.1s;
}

.ribbon-tab:hover { background: rgba(0,0,0,0.04); }

.ribbon-tab.active {
  background: var(--office-white);
  border-bottom-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.ribbon-panels {
  height: var(--office-ribbon-height);
  overflow: hidden;
}

.ribbon-panel {
  display: none;
  height: 100%;
  padding: 2px 6px;
  align-items: stretch;
  gap: 0;
}

.ribbon-panel.active { display: flex; }

.ribbon-group {
  display: flex;
  flex-direction: column;
  padding: 2px 6px;
  border-right: 1px solid var(--office-border);
  position: relative;
  min-width: 0;
}

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

.ribbon-group-content {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  flex-wrap: wrap;
  align-content: flex-start;
}

.ribbon-group-label {
  text-align: center;
  font-size: 10px;
  color: var(--office-text-secondary);
  padding-top: 0;
  line-height: 1.2;
  margin-top: auto;
}

/* Ribbon 按钮 */
.rb-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 44px;
  padding: 2px 4px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 2px;
  cursor: pointer;
  color: var(--office-text);
  gap: 1px;
}

.rb-btn:hover { background: var(--office-hover); border-color: var(--office-border-dark); }
.rb-btn.active { background: var(--accent-light); border-color: var(--accent); color: var(--accent); }

.rb-btn svg { width: 20px; height: 20px; fill: currentColor; }
.rb-btn .rb-label { font-size: 10px; line-height: 1.2; text-align: center; }

.rb-btn-sm {
  width: 24px; height: 24px;
  min-width: 24px;
  padding: 0;
  flex-direction: row;
}

.rb-btn-sm svg { width: 14px; height: 14px; }

.rb-stack {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.rb-row {
  display: flex;
  gap: 1px;
}

/* Ribbon 内联工具栏（Word / Excel / PPT 共用） */
.excel-toolbar-inner {
  display: flex; align-items: center; gap: 2px; flex-wrap: wrap;
}
.excel-toolbar-inner select,
.excel-toolbar-inner input[type="number"] {
  height: 24px; padding: 0 6px; border: 1px solid var(--office-border-dark);
  border-radius: 2px; font-size: 12px; background: #fff;
}
.excel-toolbar-inner button.fmt-btn {
  width: 24px; height: 24px; border: 1px solid transparent; background: transparent;
  border-radius: 2px; cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--office-text);
}
.excel-toolbar-inner button.fmt-btn:hover { background: var(--office-hover); border-color: var(--office-border-dark); }
.excel-toolbar-inner button.fmt-btn.active { background: var(--accent-light); border-color: var(--accent); color: var(--accent); }
.excel-toolbar-inner .tb-sep { width: 1px; height: 18px; background: var(--office-border-dark); margin: 0 3px; }
.excel-toolbar-inner .color-wrap { position: relative; }
.excel-toolbar-inner .color-bar-mini { position: absolute; bottom: 2px; left: 4px; right: 4px; height: 3px; border-radius: 1px; }

/* Ribbon 下拉 */
.rb-select {
  height: 24px;
  padding: 0 6px;
  border: 1px solid var(--office-border-dark);
  border-radius: 2px;
  font-size: 12px;
  background: var(--office-white);
  color: var(--office-text);
  outline: none;
  cursor: pointer;
}

.rb-select:focus { border-color: var(--accent); }

.rb-input {
  height: 24px;
  width: 48px;
  padding: 0 4px;
  border: 1px solid var(--office-border-dark);
  border-radius: 2px;
  font-size: 12px;
  text-align: center;
  outline: none;
}

.rb-color-btn {
  width: 24px; height: 24px;
  border: 1px solid var(--office-border-dark);
  border-radius: 2px;
  cursor: pointer;
  background: var(--office-white);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rb-color-btn .color-bar {
  position: absolute;
  bottom: 2px; left: 3px; right: 3px;
  height: 3px;
  border-radius: 1px;
}

.rb-color-input {
  position: absolute;
  opacity: 0;
  width: 0; height: 0;
}

/* ===== 文件菜单 ===== */
.file-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 9000;
}

.file-backdrop.show { display: block; }

.file-panel {
  position: fixed;
  top: 0; left: 0;
  width: 340px;
  height: 100vh;
  background: var(--accent);
  color: #fff;
  z-index: 9001;
  transform: translateX(-100%);
  transition: transform 0.25s ease;
  display: flex;
  flex-direction: column;
}

.file-panel.show { transform: translateX(0); }

.file-panel-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.15);
}

.file-panel-header h2 {
  font-size: 16px;
  font-weight: 600;
}

.file-panel-items {
  flex: 1;
  padding: 8px 0;
  overflow-y: auto;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  cursor: pointer;
  font-size: 13px;
  transition: background 0.15s;
}

.file-item:hover { background: rgba(255,255,255,0.12); }

.file-item svg { width: 18px; height: 18px; fill: currentColor; opacity: 0.9; }

.file-panel-footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(255,255,255,0.15);
}

.file-panel-footer a {
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  font-size: 12px;
}

.file-panel-footer a:hover { color: #fff; }

/* ===== 主内容区 ===== */
.office-main {
  flex: 1;
  display: flex;
  overflow: hidden;
  min-height: 0;
}

/* ===== 状态栏 ===== */
.office-statusbar {
  height: var(--status-bar-height);
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-size: 11px;
  flex-shrink: 0;
  gap: 20px;
}

.office-statusbar .status-item { opacity: 0.9; }
.office-statusbar .status-spacer { flex: 1; }

/* ===== Toast ===== */
.office-toast {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #323130;
  color: #fff;
  padding: 8px 20px;
  border-radius: 4px;
  font-size: 13px;
  z-index: 9999;
  opacity: 0;
  transition: all 0.3s;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.office-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== 隐藏文件输入 ===== */
.hidden-input { display: none; }
