/* 基本樣式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: tauhu-oo, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
  background-color: #f6f8fc;
  color: #202124;
  min-height: 100vh;
  padding: 0;
  margin: 0;
}

.editor-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 1200px;
  margin: 0 auto;
  background-color: #ffffff;
}

/* 頁首樣式 */
.editor-header {
  background-color: #ffffff;
  padding: 0.5rem;
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  border-bottom: 1px solid #e8eaed;
}

.editor-title {
  font-size: 1.25rem;
  margin-right: 0.75rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.editor-title:hover {
  background-color: #f1f3f4;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
}

.tool-btn {
  background: none;
  border: none;
  border-radius: 4px;
  padding: 0.35rem;
  cursor: pointer;
  color: #5f6368;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
  position: relative;
  min-width: 32px;
  height: 32px;
}

.tool-btn:hover {
  background-color: #f1f3f4;
  color: #202124;
}

.tool-btn svg {
  width: 18px;
  height: 18px;
}

.tool-btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.tool-btn.active {
  color: #202124;
  background-color: #e8eaed;
}

/* 主要編輯區域 */
.editor-main {
  flex: 1;
  padding: 1rem;
}

#editor {
  width: 100%;
  height: calc(100vh - 7rem);
  padding: 1rem;
  border: none;
  resize: none;
  font-family: tauhu-oo, Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  background-color: #ffffff;
  color: #202124;
  outline: none;
}

#editor.nowrap {
  white-space: nowrap;
  overflow-x: auto;
}

#editor.font-thin {
  font-size: 12px;
}

#editor.font-small {
  font-size: 14px;
}

#editor.font-fit {
  font-size: 16px;
}

#editor.font-medium {
  font-size: 18px;
}

#editor.font-large {
  font-size: 24px;
}

#editor.font-huge {
  font-size: 32px;
}

#editor.font-giant {
  font-size: 40px;
}

#editor.font-extreme {
  font-size: 56px;
}

#editor.font-massive {
  font-size: 64px;
}

/* 下拉選單 */
.dropdown {
  position: relative;
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background-color: #ffffff;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(60, 64, 67, 0.15);
  padding: 0.5rem 0;
  min-width: 180px;
  z-index: 100;
  max-height: 400px;
  overflow-y: auto;
}

.dropdown-menu.show {
  display: block;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  color: #5f6368;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s;
}

.dropdown-item:hover {
  background-color: #f1f3f4;
  color: #202124;
}

.dropdown-item.active {
  background-color: #e8eaed;
  color: #202124;
}

/* 字體大小選單 */
.font-size-menu {
  min-width: 120px;
}

/* 搜尋對話框 */
.search-dialog {
  position: absolute;
  top: 60px;
  right: 20px;
  width: auto;
  min-width: 300px;
  max-width: 400px;
  background-color: #ffffff;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(60, 64, 67, 0.3);
  display: none;
  z-index: 1000;
  cursor: move;
}

.dialog-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  border-bottom: 1px solid #e8eaed;
  cursor: move;
  background-color: #f1f3f4;
  border-radius: 8px 8px 0 0;
}

.dialog-title {
  font-weight: 500;
  font-size: 14px;
  color: #202124;
}

.dialog-content {
  padding: 12px;
}

.search-input-group,
.replace-input-group {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.replace-input-group {
  margin-bottom: 0;
}

.search-input-group input,
.replace-input-group input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #e8eaed;
  border-radius: 4px;
  font-size: 14px;
  outline: none;
}

.search-input-group input:focus,
.replace-input-group input:focus {
  border-color: #1a73e8;
}

.search-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-btn {
  background: none;
  border: 1px solid #e8eaed;
  border-radius: 4px;
  padding: 4px 8px;
  cursor: pointer;
  color: #5f6368;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.nav-btn:hover {
  background-color: #f1f3f4;
  color: #202124;
}

.nav-btn.active {
  background-color: #e8f0fe;
  color: #1a73e8;
  border-color: #1a73e8;
}

.close-btn {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: #5f6368;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.close-btn:hover {
  color: #202124;
}

.replace-buttons {
  display: flex;
  gap: 8px;
}

.replace-btn {
  background-color: #1a73e8;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 6px 12px;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.2s;
}

.replace-btn:hover {
  background-color: #1557b0;
}

/* 提示訊息 */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background-color: #323232;
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  font-size: 0.9rem;
  box-shadow: 0 2px 6px rgba(60, 64, 67, 0.15);
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
}

/* 響應式設計 */
@media (max-width: 600px) {
  .tool-btn.priority-low {
    display: none;
  }

  .tool-btn.always-show,
  .dropdown.always-show {
    display: flex;
  }
}

@media (max-width: 480px) {
  .tool-btn.priority-medium {
    display: none;
  }

  .tool-btn.always-show,
  .dropdown.always-show {
    display: flex;
  }
}

@media (max-width: 360px) {
  .toolbar {
    flex-wrap: wrap;
  }

  .tool-btn.always-show,
  .dropdown.always-show {
    display: flex;
  }
}

