/* ===== 基礎重設 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans TC', 'Microsoft JhengHei', sans-serif;
  background-color: #f5f0e8;
  color: #333;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ===== 固定頂部區塊 ===== */
.top-fixed {
  flex-shrink: 0;
  background: #f5f0e8;
  z-index: 100;
  border-bottom: 1px solid #e0d8d0;
  padding-bottom: 12px;
}

.top-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ===== 頂部標題 ===== */
.site-header {
  text-align: center;
  padding: 18px 0 10px;
  position: relative;
}

.site-title {
  font-size: 26px;
  color: #e07850;
  font-weight: 700;
}

.title-en {
  font-size: 24px;
  font-weight: 400;
  color: #b08060;
}

/* ===== 登入區域 ===== */
.user-area {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}

.login-btn {
  padding: 8px 20px;
  font-size: 14px;
  font-weight: 600;
  border: 2px solid #e07850;
  border-radius: 8px;
  background: #fff;
  color: #e07850;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.login-btn:hover {
  background: #e07850;
  color: #fff;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid #e07850;
}

.user-name {
  font-size: 14px;
  color: #555;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.logout-btn {
  padding: 4px 12px;
  font-size: 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fff;
  color: #888;
  cursor: pointer;
  transition: all 0.2s;
}

.logout-btn:hover {
  border-color: #e07850;
  color: #e07850;
}

/* ===== 頁籤列 ===== */
.tab-bar {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 0;
  padding: 0;
  margin-bottom: 10px;
  margin-left: 344px;
}

.tab-btn {
  padding: 10px 28px;
  font-size: 15px;
  font-weight: 600;
  border: 2px solid #e07850;
  background: #fff;
  color: #e07850;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn[data-tab="kaomoji"] {
  border-radius: 8px 0 0 8px;
}

.tab-btn[data-tab="emoji"] {
  border-radius: 0 8px 8px 0;
  border-left: none;
}

.tab-btn.active {
  background: #e07850;
  color: #fff;
}

.tab-btn:hover:not(.active) {
  background: #fdf0ea;
}

/* ===== Emoji 風格選擇器 ===== */
.emoji-style-selector {
  display: flex;
  align-items: center;
  margin-left: 16px;
  gap: 6px;
  white-space: nowrap;
}

.emoji-style-selector label {
  font-size: 13px;
  color: #888;
}

.emoji-style-selector select {
  padding: 6px 10px;
  font-size: 13px;
  border: 2px solid #ddd;
  border-radius: 6px;
  background: #fff;
  color: #555;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}

.emoji-style-selector select:focus {
  border-color: #e07850;
}

/* ===== 搜尋列 ===== */
.search-bar {
  display: flex;
  justify-content: center;
  padding: 0;
  position: relative;
  max-width: 500px;
  margin: 0 auto;
  width: 100%;
}

.search-bar input {
  width: 100%;
  padding: 10px 40px 10px 16px;
  font-size: 15px;
  border: 2px solid #ddd;
  border-radius: 24px;
  outline: none;
  transition: border-color 0.2s;
}

.search-bar input:focus {
  border-color: #e07850;
}

.clear-btn {
  position: absolute;
  right: 28px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 16px;
  color: #aaa;
  cursor: pointer;
  padding: 4px 8px;
  display: none;
}

.clear-btn.visible {
  display: block;
}

.clear-btn:hover {
  color: #e07850;
}

/* ===== 主內容區（sidebar + scroll-area 並排） ===== */
.main-container {
  display: flex;
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 0 16px;
  gap: 16px;
  overflow: hidden;
}

/* ===== 左側標籤欄（固定不動，自己內部可捲動） ===== */
.sidebar {
  width: 180px;
  flex-shrink: 0;
  overflow-y: auto;
  background: #fff;
  border-radius: 12px;
  padding: 16px 12px;
  margin: 12px 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* ===== 右側可捲動區 ===== */
.scroll-area {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0 0;
  min-width: 0;
}

.sidebar-title {
  font-size: 13px;
  font-weight: 700;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #eee;
}

.tag-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  margin-bottom: 2px;
  font-size: 14px;
  border: none;
  background: transparent;
  color: #555;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.tag-btn:hover {
  background: #fdf0ea;
  color: #e07850;
}

.tag-btn.active {
  background: #e07850;
  color: #fff;
  font-weight: 600;
}

.tag-count {
  font-size: 11px;
  color: #aaa;
  margin-left: 4px;
}

.tag-btn.active .tag-count {
  color: rgba(255,255,255,0.7);
}

/* ===== 內容區 ===== */
.content {
  flex: 1;
  min-width: 0;
}

/* 分類區塊 */
.category-section {
  margin-bottom: 20px;
}

.category-title {
  font-size: 16px;
  font-weight: 700;
  color: #e07850;
  padding: 8px 0;
  margin-bottom: 8px;
  border-bottom: 2px solid #f0d8c8;
}

.category-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* 表情符號卡片 */
.emoticon-card {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 15px;
  min-height: 42px;
  user-select: none;
  position: relative;
}

.emoticon-card:hover {
  border-color: #e07850;
  box-shadow: 0 2px 8px rgba(224,120,80,0.15);
  transform: translateY(-1px);
}

.emoticon-card:active {
  transform: translateY(0);
  box-shadow: none;
}

.emoticon-card.copied {
  background: #e07850;
  color: #fff;
  border-color: #e07850;
}

/* Emoji 專用 - 較大顯示 */
.emoticon-card.emoji-card {
  font-size: 28px;
  padding: 8px 10px;
  min-width: 48px;
  min-height: 48px;
}

/* Twemoji 圖片樣式 */
.emoticon-card.emoji-card img.emoji {
  width: 28px;
  height: 28px;
  vertical-align: middle;
}

/* 空狀態 */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #999;
  font-size: 18px;
}

/* ===== 複製提示 Toast ===== */
.toast {
  position: fixed;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(50, 50, 50, 0.9);
  color: #fff;
  padding: 10px 24px;
  border-radius: 24px;
  font-size: 14px;
  opacity: 0;
  transition: all 0.3s;
  pointer-events: none;
  z-index: 1000;
}

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

/* ===== 頁尾 ===== */
.site-footer {
  text-align: center;
  padding: 20px 16px;
  border-top: 1px solid #e0d8d0;
}

.site-footer a {
  color: #e07850;
  text-decoration: none;
  font-size: 14px;
}

.site-footer a:hover {
  text-decoration: underline;
}

.footer-divider {
  color: #ccc;
  margin: 0 12px;
}

/* ===== 滾動條美化 ===== */
.sidebar::-webkit-scrollbar,
.scroll-area::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track,
.scroll-area::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb,
.scroll-area::-webkit-scrollbar-thumb {
  background: #ddd;
  border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover,
.scroll-area::-webkit-scrollbar-thumb:hover {
  background: #ccc;
}

/* ===== 響應式 ===== */
@media (max-width: 768px) {
  .site-title {
    font-size: 20px;
  }

  .title-en {
    display: block;
    font-size: 17px;
    margin-top: 2px;
  }

  .login-btn {
    position: static;
    transform: none;
    display: block;
    margin: 8px auto 0;
    padding: 6px 16px;
    font-size: 13px;
  }

  .tab-bar {
    flex-wrap: wrap;
  }

  .tab-btn {
    padding: 8px 16px;
    font-size: 13px;
  }

  .emoji-style-selector {
    width: 100%;
    justify-content: center;
    margin-left: 0;
    margin-top: 8px;
  }

  .main-container {
    flex-direction: column;
    overflow: visible;
  }

  .sidebar {
    width: 100%;
    overflow-y: visible;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 12px;
    margin: 0 0 8px;
    align-items: center;
  }

  .scroll-area {
    overflow-y: visible;
  }

  .sidebar-title {
    width: 100%;
    margin-bottom: 6px;
  }

  .tag-btn {
    width: auto;
    padding: 6px 12px;
    font-size: 13px;
  }

  .emoticon-card {
    padding: 6px 10px;
    font-size: 14px;
  }

  .emoticon-card.emoji-card {
    font-size: 24px;
    min-width: 42px;
    min-height: 42px;
  }

  .category-grid {
    gap: 6px;
  }
}

@media (max-width: 480px) {
  .tab-btn {
    padding: 8px 12px;
    font-size: 12px;
  }
}
