/* my-linebot LIFF Stylesheet */

:root {
  --bg-gradient-start: #0f172a;
  --bg-gradient-end: #020617;
  --card-bg: rgba(30, 41, 59, 0.7);
  --card-border: rgba(255, 255, 255, 0.08);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --primary-color: #06c755; /* LINE Green */
  --primary-hover: #05b04b;
  --danger-color: #ef4444;
  --danger-hover: #dc2626;
  --warning-color: #f59e0b;
  --info-color: #3b82f6;
  --font-family: 'Outfit', 'Noto Sans TC', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
  --radius-lg: 16px;
  --radius-md: 10px;
}

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

body {
  font-family: var(--font-family);
  background: linear-gradient(135deg, var(--bg-gradient-start), var(--bg-gradient-end));
  color: var(--text-primary);
  min-height: 100vh;
  padding-bottom: 80px; /* 留給 Tab 導覽列的空間 */
  display: flex;
  flex-direction: column;
}

/* 頂部模擬器控制列 */
.sim-toolbar {
  background: rgba(15, 23, 42, 0.95);
  border-bottom: 2px solid #3b82f6;
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  position: sticky;
  top: 0;
  z-index: 999;
}

.sim-title {
  font-weight: bold;
  color: #3b82f6;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sim-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.sim-field {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sim-field label {
  color: var(--text-secondary);
}

.sim-field select, .sim-field input {
  background: #1e293b;
  border: 1px solid #475569;
  color: var(--text-primary);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  outline: none;
}

.mode-badge {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 11px;
}

.mode-badge.plus {
  background: rgba(6, 199, 85, 0.2);
  color: #2edc76;
  border: 1px solid rgba(6, 199, 85, 0.3);
}

/* 主容器 */
.liff-container {
  width: 100%;
  max-width: 500px;
  margin: 0 auto;
  padding: 16px;
  flex: 1;
}

/* Tab 導覽列 */
.tab-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 500px;
  height: 64px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--card-border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 100;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -10px 25px -5px rgba(0, 0, 0, 0.5);
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 33.33%;
  height: 100%;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: var(--font-family);
}

.tab-btn .icon {
  font-size: 20px;
  opacity: 0.6;
  transition: transform 0.2s ease;
}

.tab-btn .label {
  font-size: 11px;
  font-weight: 500;
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  color: var(--primary-color);
}

.tab-btn.active .icon {
  opacity: 1;
  transform: scale(1.15);
}

/* 分頁區塊管理 */
.panel-section {
  display: none;
  animation: fadeIn 0.4s ease forwards;
}

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

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

/* 卡片 */
.card {
  background: var(--card-bg);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-lg);
}

.header-card {
  background: linear-gradient(135deg, rgba(6, 199, 85, 0.15), rgba(30, 41, 59, 0.7));
  border: 1px solid rgba(6, 199, 85, 0.2);
}

.header-card h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}

.header-card p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 14px;
  border-left: 3px solid var(--primary-color);
  padding-left: 8px;
}

/* 按鈕樣式 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-family);
  gap: 8px;
  width: 100%;
}

.btn-primary {
  background: var(--primary-color);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 0 12px rgba(6, 199, 85, 0.4);
}

.btn-danger {
  background: var(--danger-color);
  color: #fff;
}

.btn-danger:hover {
  background: var(--danger-hover);
}

.btn-secondary {
  background: #334155;
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: #475569;
}

/* 卡包設定列表 */
.card-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  transition: background 0.2s ease;
}

.card-item:hover {
  background: rgba(15, 23, 42, 0.6);
}

.card-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.bank-badge {
  width: 8px;
  height: 32px;
  border-radius: 99px;
}

.card-names {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.bank-name {
  font-size: 11px;
  color: var(--text-secondary);
}

.card-name {
  font-size: 14px;
  font-weight: 600;
}

/* Checkbox Switch 美化 */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

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

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #334155;
  transition: .3s;
  border-radius: 24px;
}

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

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

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

/* 支付管道 Grid 選項 */
.payment-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.checkbox-tile {
  cursor: pointer;
}

.checkbox-tile input {
  display: none;
}

.tile-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  padding: 12px 8px;
  transition: all 0.2s ease;
  height: 72px;
  text-align: center;
}

.tile-icon {
  font-size: 20px;
  margin-bottom: 6px;
}

.tile-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.checkbox-tile input:checked + .tile-content {
  background: rgba(6, 199, 85, 0.15);
  border-color: var(--primary-color);
}

.checkbox-tile input:checked + .tile-content .tile-label {
  color: var(--primary-color);
}

/* Plus 模式卡片 */
.plus-card {
  border: 1px dashed rgba(6, 199, 85, 0.4);
  background: rgba(6, 199, 85, 0.03);
}

.plus-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.plus-badge {
  background: var(--primary-color);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
}

.plus-card h3 {
  border: none;
  padding: 0;
  margin: 0;
}

.plus-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
}

.plus-status {
  background: rgba(15, 23, 42, 0.4);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.status-indicator {
  font-size: 13px;
  font-weight: 600;
}

.status-indicator.online {
  color: #2edc76;
}

.status-indicator.offline {
  color: var(--text-secondary);
}

.plus-user-info {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.plus-status button {
  width: auto;
  font-size: 12px;
  padding: 6px 12px;
}

/* 快速記帳表單 */
.form-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-group input, .form-group select {
  width: 100%;
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--card-border);
  color: var(--text-primary);
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-family: var(--font-family);
  outline: none;
  transition: border-color 0.2s ease;
}

.form-group input:focus, .form-group select:focus {
  border-color: var(--primary-color);
}

.helper-text {
  font-size: 11px;
  color: var(--warning-color);
}

.btn-submit {
  background: var(--primary-color);
  color: #fff;
  padding: 14px;
  font-size: 16px;
  margin-top: 10px;
}

.btn-submit:hover {
  background: var(--primary-hover);
  box-shadow: 0 0 16px rgba(6, 199, 85, 0.5);
}

/* 帳本明細頁 */
.ledger-summary {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--card-border);
  margin-bottom: 14px;
  color: var(--text-secondary);
}

.ledger-summary strong {
  color: var(--text-primary);
}

.ledger-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 420px;
  overflow-y: auto;
  padding-right: 4px;
}

/* 自訂捲軸 */
.ledger-list::-webkit-scrollbar {
  width: 4px;
}
.ledger-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 99px;
}

.ledger-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.03);
  padding: 12px 14px;
  border-radius: var(--radius-md);
}

.ledger-item-left {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ledger-merchant {
  font-size: 14px;
  font-weight: 600;
}

.ledger-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-secondary);
}

.ledger-cat-badge {
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.ledger-card-name {
  color: #3b82f6;
  font-weight: 600;
}

.ledger-item-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ledger-amount {
  font-size: 16px;
  font-weight: 700;
  color: #2edc76;
}

.btn-delete {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  opacity: 0.5;
  transition: opacity 0.2s ease, transform 0.2s ease;
  padding: 4px;
}

.btn-delete:hover {
  opacity: 1;
  transform: scale(1.15);
}

.no-data {
  text-align: center;
  padding: 40px 0;
  color: var(--text-secondary);
  font-size: 13px;
}

/* Toast 提示 */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--primary-color);
  color: #fff;
  padding: 12px 24px;
  border-radius: 30px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: none;
}

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

.toast.error {
  border-color: var(--danger-color);
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(2, 6, 17, 0.8);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  padding: 20px;
}

.modal-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: #1e293b;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 360px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.modal-card h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 10px;
}

.modal-card p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  gap: 12px;
}

.modal-actions button {
  width: 50%;
}

.loading-placeholder {
  text-align: center;
  padding: 20px 0;
  color: var(--text-secondary);
  font-size: 13px;
  font-style: italic;
}

/* Card details sub-box */
.card-details {
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.card-metadata {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.4;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.metadata-line {
  display: block;
}

.card-tier-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.03);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  margin-top: 4px;
}

.card-tier-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-primary);
}

.card-payment-control {
  background: rgba(255, 255, 255, 0.03);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
}

.card-payment-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-top: 8px;
}

.card-payment-options label {
  font-size: 11px;
  color: var(--text-secondary);
}
