/**
 * 18個孩子民宿 (18Kids House) 前台微調與後台管理系統 (CMS) 樣式表
 * 原站核心樣式由 /templates/yootheme/css/theme.css、/media/widgetkit/wk-styles-2ee77c84.css
 * 與 /media/mod_languages/css/template.css 100% 原生提供。
 */

/* ==========================================================================
   1. 前台導覽列二級選單下拉與語系切換強化
   ========================================================================== */

/* 確保導覽列右側元素排列與原站一致 */
.tm-header .uk-navbar-right {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 12px;
}

.mod-languages ul.lang-inline {
  display: inline-flex;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 6px;
}

.mod-languages ul.lang-inline li {
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 2px;
  border-radius: 3px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.mod-languages ul.lang-inline li.lang-active {
  box-shadow: 0 0 0 2px #1e87f0;
  background: rgba(30, 135, 240, 0.08);
}

.mod-languages ul.lang-inline li a {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  cursor: pointer;
}

/* 防止 Facebook 按鍵因 UIkit 圖示自動注入而出現重複 SVG 圖示 */
[data-fb-button] svg:not(:first-of-type) {
  display: none !important;
}

/* 頂部導覽列一級選單滑過時顯示二級選單下拉框 */
.uk-navbar-nav > li.has-subitems {
  position: relative;
}

.uk-navbar-nav > li.has-subitems > a::after {
  content: " ▾";
  font-size: 11px;
  margin-left: 3px;
  opacity: 0.65;
}

.uk-navbar-nav > li.has-subitems .cms-navbar-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 220px;
  background: #ffffff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.14);
  border: 1px solid #eaeaea;
  border-radius: 4px;
  padding: 8px 0;
  z-index: 1050;
}

.uk-navbar-nav > li.has-subitems:hover .cms-navbar-dropdown,
.uk-navbar-nav > li.has-subitems:focus-within .cms-navbar-dropdown {
  display: block;
}

.cms-navbar-dropdown ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.cms-navbar-dropdown ul li a {
  display: block;
  padding: 7px 16px;
  color: #444444;
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.cms-navbar-dropdown ul li a:hover,
.cms-navbar-dropdown ul li.uk-active a {
  background-color: #f4f8fc;
  color: #1e87f0;
}

/* 頁面內 Widgetkit 二級選單 Switcher 顯示控制 (確保未透過 UIkit2 初始化時亦能正常切換) */
ul.wk-switcher > li {
  display: none;
}

ul.wk-switcher > li.wk-active {
  display: block;
}

ul.wk-subnav-pill > li > a {
  cursor: pointer;
}

/* 前台右下角與頂部「後台管理」快捷入口按鈕 */
.cms-admin-entry-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 600;
  color: #1e87f0 !important;
  background: #eef6ff;
  border: 1px solid #b9daff;
  border-radius: 20px;
  text-decoration: none !important;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.cms-admin-entry-btn:hover {
  background: #1e87f0;
  color: #ffffff !important;
  border-color: #1e87f0;
}

.cms-floating-admin-btn {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 998;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: #1e87f0;
  color: #ffffff !important;
  border-radius: 30px;
  box-shadow: 0 4px 14px rgba(30, 135, 240, 0.38);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none !important;
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.cms-floating-admin-btn:hover {
  background: #0f6ecd;
  transform: translateY(-2px);
}

/* ==========================================================================
   2. 後台管理系統 (CMS Admin Panel) 介面樣式
   ========================================================================== */

.cms-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(3px);
  overflow-y: auto;
  padding: 20px;
}

.cms-overlay.is-open {
  display: block;
}

.cms-standalone-body .cms-overlay {
  display: block;
  position: static;
  background: #f1f5f9;
  padding: 0;
  min-height: 100vh;
}

.cms-shell {
  max-width: 1280px;
  margin: 0 auto;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft JhengHei", Roboto, sans-serif;
  color: #1e293b;
}

.cms-standalone-body .cms-shell {
  max-width: 100%;
  border-radius: 0;
  box-shadow: none;
  min-height: 100vh;
}

.cms-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px 24px;
  background: #0f172a;
  color: #ffffff;
}

.cms-header-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cms-header-title h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #ffffff;
}

.cms-header-badge {
  background: #2563eb;
  color: #ffffff;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 12px;
}

.cms-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.cms-tabs-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 24px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  overflow-x: auto;
}

.cms-tab-btn {
  padding: 14px 20px;
  font-size: 15px;
  font-weight: 600;
  color: #475569;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.cms-tab-btn:hover {
  color: #1e293b;
  background: #f1f5f9;
}

.cms-tab-btn.is-active {
  color: #2563eb;
  border-bottom-color: #2563eb;
  background: #ffffff;
}

.cms-body {
  padding: 24px;
}

.cms-section-panel {
  display: none;
}

.cms-section-panel.is-active {
  display: block;
}

/* 通用按鈕與表單控制項 */
.cms-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
}

.cms-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.cms-btn-primary {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

.cms-btn-primary:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

.cms-btn-success {
  background: #059669;
  border-color: #059669;
  color: #ffffff;
}

.cms-btn-success:hover {
  background: #047857;
}

.cms-btn-danger {
  background: #dc2626;
  border-color: #dc2626;
  color: #ffffff;
}

.cms-btn-danger:hover {
  background: #b91c1c;
}

.cms-btn-sm {
  padding: 5px 10px;
  font-size: 13px;
}

/* 表格與卡片 */
.cms-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}

.cms-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f1f5f9;
}

.cms-card-header h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
}

.cms-table-wrap {
  overflow-x: auto;
}

.cms-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.cms-table th,
.cms-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: middle;
}

.cms-table th {
  background: #f8fafc;
  font-weight: 700;
  color: #475569;
}

.cms-input,
.cms-select,
.cms-textarea,
.cms-shell input.cms-input:not([class*="uk-"]),
.cms-shell select.cms-select:not([class*="uk-"]),
.cms-shell textarea.cms-textarea:not([class*="uk-"]),
.cms-login-card input.cms-input:not([class*="uk-"]) {
  width: 100%;
  height: auto;
  box-sizing: border-box;
  padding: 8px 12px !important;
  font-size: 14px;
  border: 1px solid #cbd5e1 !important;
  border-radius: 6px !important;
  background: #ffffff !important;
  color: #0f172a !important;
}

.cms-input:focus,
.cms-select:focus,
.cms-textarea:focus,
.cms-shell input.cms-input:not([class*="uk-"]):focus,
.cms-shell select.cms-select:not([class*="uk-"]):focus,
.cms-shell textarea.cms-textarea:not([class*="uk-"]):focus,
.cms-login-card input.cms-input:not([class*="uk-"]):focus {
  outline: none;
  border-color: #2563eb !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15) !important;
}

/* 後台帳號密碼登入畫面與帳號標籤 */
.cms-login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft JhengHei", Roboto, sans-serif;
}

.cms-login-card {
  width: 100%;
  max-width: 420px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 32px 28px;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.12);
}

.cms-login-logo {
  display: block;
  max-height: 54px;
  margin: 0 auto 14px;
}

.cms-login-title {
  margin: 0 0 8px;
  font-size: 19px;
  font-weight: 700;
  color: #0f172a;
  text-align: center;
}

.cms-login-subtitle {
  margin: 0 0 20px;
  font-size: 13px;
  color: #64748b;
  text-align: center;
}

.cms-login-error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 14px;
}

.cms-user-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #e2e8f0;
  font-size: 13px;
  font-weight: 600;
}

.cms-shell input[type="checkbox"]:not([class*="uk-"]) {
  width: 16px;
  height: 16px;
  border: 1.5px solid #64748b;
  border-radius: 4px;
  vertical-align: middle;
  margin-right: 4px;
}

.cms-shell input[type="checkbox"]:not([class*="uk-"]):checked {
  background-color: #2563eb;
  border-color: #2563eb;
}

.cms-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.cms-form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 5px;
}

/* 頁面內容編輯器 (三語切換 + WYSIWYG / HTML 雙模式) */
.cms-editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 14px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
}

.cms-lang-pills,
.cms-format-btns {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.cms-lang-pill {
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 20px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  cursor: pointer;
}

.cms-lang-pill.is-active {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

.cms-wysiwyg-area {
  min-height: 420px;
  max-height: 640px;
  overflow-y: auto;
  padding: 20px;
  border: 1px solid #cbd5e1;
  border-radius: 0 0 8px 8px;
  background: #ffffff;
}

.cms-html-area {
  width: 100%;
  min-height: 420px;
  box-sizing: border-box;
  padding: 16px;
  font-family: "Fira Code", Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
  border: 1px solid #cbd5e1;
  border-radius: 0 0 8px 8px;
  background: #0f172a;
  color: #e2e8f0;
}

/* 圖片庫選擇器 */
.cms-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  max-height: 280px;
  overflow-y: auto;
  padding: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
}

.cms-gallery-item {
  border: 2px solid transparent;
  border-radius: 6px;
  overflow: hidden;
  background: #ffffff;
  cursor: pointer;
  text-align: center;
  padding: 4px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.cms-gallery-item:hover {
  border-color: #2563eb;
  transform: translateY(-2px);
}

.cms-gallery-item img {
  width: 100%;
  height: 75px;
  object-fit: cover;
  border-radius: 4px;
}

.cms-gallery-item span {
  display: block;
  font-size: 11px;
  color: #475569;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 狀態提示 Toast */
.cms-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  padding: 12px 20px;
  border-radius: 8px;
  background: #059669;
  color: #ffffff;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.cms-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}
