/* ========================================================
   結び Musubi URL Shortener — 後台工作台樣式
   Admin Minimalist Dashboard Styles
   ======================================================== */

.admin-body {
  background-color: var(--bg-washi);
  min-height: 100vh;
}

.admin-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px 60px;
}

/* 頂部管理導航列 */
.admin-navbar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px 0 16px;
  border-bottom: 1px solid var(--border-line);
  margin-bottom: 28px;
}

.admin-navbar-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.admin-nav-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
  overflow: visible;
}

.admin-tab-btn {
  padding: 8px 16px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--text-charcoal);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.admin-tab-btn:hover {
  background: var(--bg-card);
  border-color: var(--border-line);
}

.admin-tab-btn.active {
  background: var(--bg-card);
  border-color: var(--accent-shu);
  color: var(--accent-shu);
  font-weight: 500;
  box-shadow: 0 2px 6px rgba(194, 62, 42, 0.08);
}

.admin-user-ctrl {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* 統計指標卡片網格 */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-subtle);
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  letter-spacing: 0.03em;
  margin-bottom: 8px;
}

.stat-value {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--text-sumi);
  line-height: 1.1;
}

.stat-hint {
  font-size: 0.75rem;
  color: var(--text-faint);
  margin-top: 8px;
}

/* 區塊卡片 */
.admin-card {
  background: var(--bg-card);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-md);
  padding: 28px;
  box-shadow: var(--shadow-subtle);
  margin-bottom: 28px;
}

.admin-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-line);
}

.admin-card-title {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-sumi);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 走勢圖 Canvas 區域 */
.chart-wrap {
  width: 100%;
  height: 240px;
  position: relative;
  margin-top: 10px;
}

.chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* 表格樣式 */
.zen-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.zen-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}

.zen-table th {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-dark);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  background: var(--bg-washi-subtle);
}

.zen-table td {
  padding: 14px;
  border-bottom: 1px solid var(--border-line);
  color: var(--text-charcoal);
  vertical-align: middle;
}

.zen-table tr:hover td {
  background: var(--bg-washi);
}

/* 標籤 Badge */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-default {
  background: var(--accent-shu-subtle);
  color: var(--accent-shu);
  border: 1px solid rgba(194, 62, 42, 0.3);
}

.badge-active {
  background: #EDF7EE;
  color: var(--accent-matcha);
  border: 1px solid rgba(63, 94, 77, 0.25);
}

.badge-disabled {
  background: var(--bg-washi-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border-line);
}

/* 切換開關 Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--border-dark);
  transition: .3s;
  border-radius: 22px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--accent-shu);
}

input:checked + .slider:before {
  transform: translateX(18px);
}

/* 表單佈局 */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.form-full {
  grid-column: 1 / -1;
}

.admin-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-charcoal);
  margin-bottom: 6px;
}

.admin-help {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* 彈窗 Modal */
.zen-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(26, 25, 24, 0.45);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.zen-modal {
  background: var(--bg-card);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-lg);
  max-width: 640px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-hover);
  padding: 32px;
  position: relative;
  animation: modalIn 0.25s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.zen-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-line);
}

.zen-modal-close {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

.zen-modal-close:hover {
  color: var(--text-sumi);
}

/* 登入卡片 */
.login-wrap {
  max-width: 420px;
  margin: 80px auto;
  background: var(--bg-card);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow-subtle);
  text-align: center;
}

.login-title {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  font-weight: 700;
  margin: 16px 0 6px;
  color: var(--text-sumi);
}

.login-sub {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 24px;
}

@media (max-width: 768px) {
  .admin-navbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  .admin-nav-tabs {
    width: 100%;
  }
}
