/* ============================================================
   iBET Admin — 共用樣式 (wireframe / prototype)
   每張畫面 link 這支，維持一致的視覺與尺寸
   ============================================================ */

:root {
  --header-bg:   #3c8dbc;
  --header-line: #367fa9;
  --body-bg:     #ecf0f5;
  --card-bg:     #ffffff;
  --card-border: #e1e5e9;

  --text:        #3c4650;
  --text-muted:  #7b848c;
  --link:        #337ab7;
  --link-hover:  #23527c;

  --btn-primary: #1f6fb2;
  --btn-success: #5cb85c;
  --btn-default: #f4f4f4;

  --status-on:   #3c9a3c;
  --status-off:  #c9302c;

  --input-border:#cfd4d9;
  --row-line:    #e7eaec;
  --row-alt:     #f9f9f9;

  --radius: 3px;
  --shell:  1366px;   /* 對齊 Axure Base 1366，不滿版 */
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--body-bg);
  color: var(--text);
  font-family: "Source Sans Pro", "Helvetica Neue", Helvetica, Arial,
               "PingFang TC", "Microsoft JhengHei", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }

/* ---------- Top bar ---------- */
.topbar {
  height: 68px;
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-line);
}
.topbar-inner {
  height: 100%; max-width: var(--shell); margin: 0 auto; padding: 0 26px;
  display: flex; align-items: center; justify-content: space-between;
}
.topbar-left  { display: flex; align-items: center; gap: 42px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.logo   { color: #fff; font-size: 29px; font-weight: 700; letter-spacing: -0.5px; }
.navitem{ display: flex; align-items: center; gap: 7px; color: #fff; font-size: 15px; cursor: default; }
.avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: #d7dde2;
  display: flex; align-items: center; justify-content: center;
}
.username { color: #fff; font-size: 15px; }

/* ---------- Page shell ---------- */
.page { max-width: var(--shell); margin: 0 auto; padding: 22px 26px 40px; }

.page-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 20px; margin-bottom: 18px;
}
.page-title { font-size: 21px; font-weight: 400; margin: 0 0 18px; }
.page-head .page-title { margin: 0; }
.breadcrumb { font-size: 14px; color: var(--text); white-space: nowrap; }
.breadcrumb .sep { color: var(--text-muted); margin: 0 6px; }

.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 26px 24px 22px;
}
.card + .card { margin-top: 18px; }
.card-section-title { font-size: 15px; font-weight: 700; margin: 0 0 24px; }

/* ---------- Toolbar ---------- */
.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 26px;
}
.toolbar-group { display: flex; align-items: center; gap: 10px; }

/* ---------- Form controls ---------- */
.select, .input {
  height: 36px;
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  font: inherit;
  padding: 0 10px;
}
.select {
  min-width: 122px; appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M2 4.5L6 8.5L10 4.5' fill='none' stroke='%237b848c' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 9px center;
  padding-right: 28px;
}
.select[disabled] { background-color: #f4f6f8; color: var(--text-muted); }
.input:focus, .select:focus { outline: none; border-color: #8bb8dc; }
.input::placeholder { color: #b3b9bf; }
.input-search { width: 200px; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px 34px;
}
.field { display: flex; flex-direction: column; gap: 7px; }
.field > label { font-size: 14px; color: var(--text); }
.field .input, .field .select { width: 100%; }
.field-hint { font-size: 12px; color: var(--text-muted); line-height: 1.6; }

/* ---------- Buttons ---------- */
.btn {
  height: 36px; padding: 0 18px;
  border: none; border-radius: var(--radius);
  font: inherit; font-size: 14px; letter-spacing: .4px;
  color: #fff; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none;
}
.btn:hover { filter: brightness(.94); color: #fff; text-decoration: none; }
.btn-primary { background: var(--btn-primary); }
.btn-success { background: var(--btn-success); padding: 0 26px; }
.btn-info    { background: #2fa4e7; }
.btn-default {
  background: var(--btn-default); color: var(--text);
  border: 1px solid var(--input-border);
}
.btn-default:hover { color: var(--text); }

/* ---------- Table ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table thead tr { border-bottom: 2px solid #dfe3e6; }
.table th {
  text-align: left; font-weight: 600;
  padding: 0 8px 12px 0; white-space: nowrap;
}
.table th:first-child, .table td:first-child { padding-left: 4px; }
.table td { padding: 15px 8px 15px 0; }
.table tbody tr { border-bottom: 1px solid var(--row-line); }
.table tbody tr:nth-child(odd) { background: var(--row-alt); }

.status-on  { color: var(--status-on); }
.status-off { color: var(--status-off); }
.empty { text-align: center; color: var(--text-muted); padding: 48px 0; }

.cell-actions { white-space: nowrap; }
.cell-actions .sep { color: #cfd4d9; margin: 0 8px; }
.link-off { color: #a7aeb4; cursor: default; }

/* ---------- Pagination ---------- */
.tablefoot {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 10px; padding-top: 18px;
}
.tablefoot .input { width: 62px; height: 34px; text-align: center; padding: 0; }
.pager { display: flex; align-items: center; margin-left: 12px; }
.pager a {
  width: 36px; height: 34px;
  border: 1px solid #dfe3e6; border-right: none;
  display: flex; align-items: center; justify-content: center;
  background: #fff; color: var(--link); text-decoration: none;
}
.pager a:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.pager a:last-child  { border-right: 1px solid #dfe3e6; border-radius: 0 var(--radius) var(--radius) 0; }
.pager a:hover { background: #f4f6f8; text-decoration: none; }
.pager a.active { background: var(--btn-primary); border-color: var(--btn-primary); color: #fff; }

/* ============================================================
   Roulette Settings
   ============================================================ */
.prize-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px 34px;
}
.prize { display: flex; flex-direction: column; gap: 7px; }
.prize-head {
  display: flex; align-items: baseline; justify-content: space-between;
  font-size: 14px; color: var(--text);
}
.prize-row { display: flex; }
.prize-row .select-type { width: 124px; border-radius: var(--radius) 0 0 var(--radius); }
.prize-row .prize-value { flex: 1; min-width: 0; border-radius: 0; border-left: none; }
.prize-row .prize-prob {
  width: 84px; border-radius: 0 var(--radius) var(--radius) 0;
  border-left: none; text-align: center;
}

/* 檢核訊息：顯示在該格下方 */
.prize-msg {
  display: none;
  font-size: 12px; line-height: 1.4; color: var(--status-off);
}
.prize-msg.is-error { display: block; margin-top: 5px; }

.prize-total {
  margin-top: 22px; padding-top: 16px;
  border-top: 1px solid var(--row-line);
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 14px;
}
.prize-total .sum { font-weight: 700; }
.prize-total .sum.ok  { color: var(--status-on); }
.prize-total .sum.err { color: var(--status-off); }

/* ============================================================
   語系分頁
   ============================================================ */
.lang-tabs { display: flex; gap: 8px; }
.lang-tab {
  height: 36px; padding: 0 24px;
  border: none; border-radius: 4px;
  background: #eef1fa; color: #6c5ce7;
  font: inherit; font-size: 14px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none;
}
.lang-tab:hover { background: #e3e8f8; color: #6c5ce7; text-decoration: none; }
.lang-tab.active, .lang-tab.active:hover { background: #6c5ce7; color: #fff; }

/* ============================================================
   Prize Setting：inline 新增列
   ============================================================ */
.prize-items { display: flex; flex-direction: column; gap: 12px; }
.prize-item  { display: flex; align-items: center; gap: 16px; }

.ig { display: flex; min-width: 0; }
.ig .chip {
  background: #f4f6f8;
  border: 1px solid var(--input-border);
  border-right: none;
  border-radius: var(--radius) 0 0 var(--radius);
  height: 36px; padding: 0 14px;
  display: flex; align-items: center;
  font-size: 14px; color: var(--text); white-space: nowrap;
}
.ig .input { flex: 1; min-width: 0; border-radius: 0; }
.ig .input:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.ig .btn { border-radius: 0 var(--radius) var(--radius) 0; padding: 0 16px; }
.ig-name { flex: 1; }
.ig-img  { flex: 1.35; }
.input-file { background: #fbfcfd; color: var(--text-muted); }

.btn-del {
  width: 26px; height: 26px; flex-shrink: 0;
  border-radius: 4px; background: #e03131;
  display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none;
}
.btn-del:hover { background: #c92a2a; text-decoration: none; }

.prize-empty {
  border: 1px dashed var(--input-border);
  border-radius: var(--radius);
  padding: 34px 0; text-align: center;
  color: var(--text-muted); font-size: 14px;
}

/* ============================================================
   富文字編輯器（示意）
   ============================================================ */
.rte { border: 1px solid var(--input-border); border-radius: var(--radius); }
.rte-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--input-border);
}
.rte-group { display: flex; align-items: center; gap: 12px; }
.rte-sel { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: #5a626a; }
.rte-btn { font-size: 14px; color: #5a626a; min-width: 14px; text-align: center; }
.rte-divider { width: 1px; height: 18px; background: #e4e8eb; }
.rte-body { min-height: 330px; padding: 16px 18px; font-size: 14px; line-height: 1.9; }
.rte-body p { margin: 0 0 14px; }
.rte-body.is-empty { color: #b3b9bf; }

/* ---------- 表單底部按鈕 ---------- */
.form-actions { display: flex; align-items: center; gap: 10px; margin-top: 24px; }
.form-actions .spacer { flex: 1; }

/* ---------- 儲存成功提示 ---------- */
.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 13px 16px; margin-bottom: 18px;
  border-radius: var(--radius); font-size: 14px;
}
.alert-success { background: #eaf7ea; border: 1px solid #b8e0b8; color: #2f7d2f; }
.alert .close { margin-left: auto; color: inherit; opacity: .55; text-decoration: none; }
.alert .close:hover { opacity: 1; color: inherit; text-decoration: none; }

/* ============================================================
   光箱（Modal）
   ============================================================ */
.modal { position: fixed; inset: 0; z-index: 50; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, .42);
}
.modal-box {
  position: relative;
  width: 380px; max-width: calc(100vw - 32px);
  margin: 90px auto 0;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .28);
  overflow: hidden;
}
.modal-head {
  background: #f4f6f8;
  border-bottom: 1px solid #e4e8eb;
  padding: 14px 20px;
  font-size: 15px; font-weight: 600;
}
.modal-body {
  padding: 24px 20px 4px;
  display: flex; flex-direction: column; gap: 20px;
}
.modal-body .field > label { font-weight: 600; }
.modal-body .input { width: 100%; }
.req { color: #d9363e; margin-right: 3px; }
.modal-foot {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 28px 20px 30px;
}
.modal-foot .btn { padding: 0 28px; }
