/* ===== style.css 全文（優化後保留前端不變）===== */
:root {
  --bg-main: #181e2a;
  --bg-side: #202534;
  --side-border: #232c45;
  --nav-active: #3370ff;
  --nav-hover: #223254;
  --nav-text: #cfd5e3;
  --nav-active-text: #fff;
  --main-card: #232e44;
  --main-text: #e6ecfc;
  --card-border: #335ec1;
  --shadow: 0 6px 32px rgba(0,0,0,0.19);
}

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

html, body {
  width: 100%;
  height: 100%;
  font-family: 'Segoe UI', '微軟正黑體', sans-serif;
  background: var(--bg-main);
  color: var(--main-text);
}

/* 容器 */
.main-wrap {
  display: flex;
  height: 100vh;
}

/* 側邊欄 */
.sidebar {
  width: 270px;
  background: var(--bg-side);
  border-right: 1.5px solid var(--side-border);
  display: flex;
  flex-direction: column;
}

.sidebar-logo {
  height: 66px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1.5px solid var(--side-border);
}

.sidebar-logo img {
  max-height: 100%;
  object-fit: contain;
}

/* 導航 */
.sidebar-nav, .nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 0 20px;
  scrollbar-width: thin;
  scrollbar-color: #335ec188 #232c45;
}

.nav-group {
  margin-bottom: 14px;
}

.nav-group-title {
  display: flex;
  align-items: center;
  font-size: 1.06em;
  font-weight: bold;
  color: #95bbff;
  padding: 7px 0 7px 30px;
  background: none;
  border: none;
  outline: none;
  width: 100%;
  cursor: pointer;
  border-radius: 9px;
  transition: background 0.17s;
}

.nav-group-title .arrow {
  margin-right: 9px;
  transition: transform 0.21s;
}

.nav-group-title.collapsed .arrow {
  transform: rotate(-90deg);
}

.nav-list {
  list-style: none;
  margin: 0 0 0 11px;
  padding: 0;
  max-height: 500px;
  overflow: hidden;
  transition: max-height 0.26s;
}

.nav-list.collapsed {
  max-height: 0 !important;
}

.nav-item {
  margin-bottom: 1px;
}

.nav-link, .nav a {
  display: block;
  padding: 8px 18px 8px 44px;
  font-size: 1.05em;
  font-weight: 500;
  color: var(--nav-text);
  text-decoration: none;
  background: none;
  border-left: 4px solid transparent;
  border-radius: 8px 22px 22px 8px;
  transition: background 0.13s, color 0.16s;
}

.nav-link:hover, .nav a:hover {
  background: var(--nav-hover);
  color: #fff;
}

.nav-link.active, .nav a.active {
  background: var(--nav-active) !important;
  color: var(--nav-active-text) !important;
  font-weight: 700;
  border-left: 4px solid var(--card-border);
}

/* 底部語言切換 */
.sidebar-lang-switch, .sidebar-bottom {
  border-top: 1.5px solid var(--side-border);
  padding: 17px 0;
  display: flex;
  justify-content: center;
  gap: 12px;
}

.lang-btn, .lang-switch a {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 17px;
  font-weight: 600;
  color: #b7caed;
  padding: 7px 13px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  transition: background 0.17s, color 0.17s;
  text-decoration: none;
}

.lang-btn .flag, .lang-switch .flag-emoji {
  font-size: 18px;
  margin-right: 8px;
}

.lang-btn.active, .lang-btn:hover,
.lang-switch a.active, .lang-switch a:hover {
  background: #314263;
  color: #fff;
}

/* 主內容區 */
.main-content, .content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: auto;
}

.main-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px;
}

.main-card {
  background: var(--main-card);
  border: 1.5px solid var(--card-border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 48px 38px 38px;
  margin: 42px 0 28px;
  max-width: 820px;
  width: 98%;
  animation: fadein 0.32s;
}

.main-card h2 {
  margin-bottom: 15px;
  color: #e2eaff;
  font-weight: 700;
}

.main-card p, .main-card ul, .main-card ol {
  color: var(--main-text);
  font-size: 1.08em;
  line-height: 1.85;
}

.main-card ul, .main-card ol {
  padding-left: 1.5em;
}

.main-card li {
  margin-bottom: 10px;
}

.main-card a {
  color: #77aaff;
  word-break: break-word;
}

.main-card a:hover {
  color: #fff;
  text-decoration: underline;
}

.alert {
  background: #31202a;
  color: #ffe7e0;
  padding: 16px;
  border-radius: 9px;
  border-left: 6px solid #ff8c60;
  margin: 18px 0;
  font-size: 1em;
}

@keyframes fadein {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .main-wrap {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    height: auto;
  }
  .sidebar-logo {
    height: 44px;
  }
  .sidebar-lang-switch {
    padding: 11px 0;
  }
  .main-card {
    padding: 19px 7px;
    margin: 13px 0;
  }
}

@media (max-width: 600px) {
  .main-card {
    padding: 12px 2px;
  }
  .sidebar-logo img {
    max-height: 26px;
  }
}

/* ===== 後台專用樣式，不影響前台 ===== */
.admin-wrap {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 240px;
  background: var(--bg-side);
  border-right: 1.5px solid var(--side-border);
  display: flex;
  flex-direction: column;
  padding: 20px 10px;
  box-sizing: border-box;
}

.admin-sidebar .sidebar-logo img {
  max-width: 100%;
  height: auto;
  margin-bottom: 20px;
}

.admin-sidebar .sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-sidebar .sidebar-nav .nav-link {
  padding: 10px 15px;
  background: var(--main-card);
  border-radius: 6px;
  color: var(--nav-text);
  font-weight: 500;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}

.admin-sidebar .sidebar-nav .nav-link:hover {
  background: var(--nav-hover);
  color: #fff;
}

.admin-content {
  flex: 1;
  padding: 40px;
  background: var(--bg-main);
  box-sizing: border-box;
}

/* 返回按鈕樣式 */
.back-btn-wrapper {
  margin-bottom: 20px;
}

.back-btn {
  display: inline-block;
  padding: 6px 14px;
  background: #2980b9;
  color: #fff;
  border-radius: 6px;
  text-decoration: none;
}

.back-btn:hover {
  background: #3498db;
}

/* 表單與區塊格式 */
form.form-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 15px;
}

form.form-inline label {
  display: flex;
  flex-direction: column;
  font-size: 0.95em;
  color: #ccc;
}

form.form-inline input,
form.form-inline select {
  padding: 5px 8px;
  border-radius: 4px;
  border: none;
  background: #1f2c44;
  color: #fff;
}

form.form-inline .btn {
  padding: 6px 12px;
  background: #3370ff;
  color: #fff;
  border-radius: 4px;
  cursor: pointer;
  border: none;
}

form.form-inline .btn:hover {
  background: #558dff;
}

ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

ul li {
  margin-bottom: 8px;
}

/* 調整 CKEditor 深色主題樣式（黑底白字） */
.ck.ck-editor__editable_inline {
  background: #1b2230 !important;
  color: #e0e6f2 !important;
  border-radius: 6px;
  min-height: 220px;
}

/* 讓下方編輯區塊排版更清楚 */
.page-edit-form {
  display: flex;
  flex-direction: column;
  gap: 25px;
  margin-top: 30px;
}

.page-edit-form .row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.page-edit-form .row label {
  flex: 1;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: #ccc;
  font-size: 0.95em;
}

.page-edit-form .row label input,
.page-edit-form .row label select {
  background: #1f2c44;
  color: #fff;
  padding: 6px 10px;
  border: none;
  border-radius: 4px;
}

.page-edit-form .editor-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.page-edit-form .editor-section .ck-editor__editable_inline {
  min-height: 260px;
}

.page-edit-form .submit-button {
  align-self: flex-start;
  margin-top: 14px;
}

.page-edit-form .submit-button .btn {
  background: #3370ff;
  color: white;
  padding: 10px 18px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
}

.page-edit-form .submit-button .btn:hover {
  background: #558dff;
}
