/* assets/css/admin.css */
/* 高階現代化後台樣式 (Modern SaaS Dashboard Style) */

:root { 
  --brand: #0f766e; 
  --brand-hover: #115e59;
  --brand-light: #ccfbf1;
  --brand-50: #f0fdfa;
  
  --bg: #f8fafc; 
  --panel: #ffffff;
  --sidebar: #0f172a; 
  --sidebar-hover: #1e293b;
  
  --ink: #0f172a;
  --text: #334155; 
  --muted: #64748b;
  
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.05), 0 4px 6px -2px rgba(0,0,0,0.025);
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
}

body { 
  margin: 0; 
  font-family: "SF Pro TC", "SF Pro Display", "PingFang TC", "Helvetica Neue", sans-serif; 
  background: var(--bg); 
  color: var(--text); 
  height: 100vh; 
  display: flex; 
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* --- 登入畫面 --- */
#login-screen { 
  position: fixed; top:0; left:0; width:100%; height:100%; 
  background: var(--bg); z-index: 999; display: flex; justify-content: center; align-items: center; 
}
.login-box { 
  background: var(--panel); padding: 40px; border-radius: var(--radius-lg); 
  box-shadow: var(--shadow-lg); width: 320px; text-align: center; border: 1px solid var(--border); 
}
.login-box h2 { color: var(--ink); margin-top: 0; margin-bottom: 24px; font-weight: 800; letter-spacing: 0.5px;}
.login-box input { 
  width: 100%; padding: 14px 16px; margin-bottom: 16px; border: 1px solid var(--border); 
  border-radius: var(--radius-md); box-sizing: border-box; font-size: 15px; transition: all 0.2s;
  background: var(--bg);
}
.login-box input:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-light); background: var(--panel); }
.login-box button { 
  width: 100%; padding: 14px; background: var(--ink); color: white; border: none; 
  border-radius: var(--radius-md); cursor: pointer; font-weight: 700; font-size: 15px; transition: all 0.2s; 
}
.login-box button:hover { background: #1e293b; transform: translateY(-1px); box-shadow: var(--shadow-md); }

/* --- 佈局 --- */
#app-screen { display: none; width: 100%; height: 100%; display: flex; }

.sidebar { 
  width: 260px; background: var(--sidebar); color: #fff; display: flex; flex-direction: column; 
  padding: 24px 20px; box-sizing: border-box; flex-shrink: 0;
}
.sidebar h3 { margin-top: 0; margin-bottom: 24px; color: #fff; font-weight: 800; font-size: 20px; letter-spacing: 0.5px;}

.manage-select { 
  width: 100%; padding: 12px; margin-bottom: 24px; border-radius: var(--radius-md); 
  border: 1px solid #334155; background: #1e293b; color: #f8fafc; font-size: 15px; font-weight: 600; cursor: pointer; 
  outline: none; transition: border-color 0.2s;
}
.manage-select:focus { border-color: var(--brand); }

.nav-btn { 
  background: transparent; border: none; color: #94a3b8; text-align: left; 
  padding: 12px 16px; font-size: 15px; font-weight: 600; cursor: pointer; border-radius: var(--radius-md); 
  margin-bottom: 8px; display: flex; align-items: center; gap: 12px; width: 100%; transition: all 0.2s;
}
.nav-btn:hover { background: var(--sidebar-hover); color: #f8fafc; }
.nav-btn.active { background: var(--brand); color: #fff; }

.user-info { 
  margin-top: auto; border-top: 1px solid #334155; padding-top: 20px; 
  font-size: 13px; color: #94a3b8; line-height: 1.6;
}

.main-content { flex: 1; padding: 32px 40px; overflow-y: auto; position: relative;}
.page { display: none; animation: fadeIn 0.3s ease-out; }
.page.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* --- 表單共用 --- */
.form-group { margin-bottom: 20px; }
label { display: block; font-weight: 700; margin-bottom: 8px; font-size: 14px; color: var(--ink); }
input[type="text"], input[type="number"], input[type="date"], input[type="url"], input[type="time"], select { 
  width: 100%; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius-md); 
  box-sizing: border-box; font-size: 15px; transition: all 0.2s; color: var(--ink); background: var(--panel);
}
input:focus, select:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-light); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* Checkbox 與 Tag UI */
.checkbox-group { 
  display: flex; gap: 24px; align-items: center; background: var(--panel); padding: 16px; 
  border-radius: var(--radius-md); border: 1px solid var(--border); flex-wrap: wrap; box-shadow: var(--shadow-sm);
}
.checkbox-group label { margin: 0; display: flex; align-items: center; cursor: pointer; font-weight: 600; color: var(--ink);}
.checkbox-group input[type="checkbox"] { width: 18px; height: 18px; margin-right: 8px; cursor: pointer; accent-color: var(--brand);}

.cat-grid { 
  display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 12px; 
  background: var(--panel); padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-sm);
}
.cat-option { display: flex; align-items: center; font-size: 14px; font-weight: 500; cursor: pointer; color: var(--ink);}
.cat-option input { width: 16px; height: 16px; margin-right: 6px; cursor: pointer; accent-color: var(--brand); }

/* --- 儀表板 Dashboard --- */
.dashboard { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 32px; }
.stat-card { background: var(--panel); padding: 24px; border-radius: var(--radius-lg); border: 1px solid var(--border); box-shadow: var(--shadow-md); position: relative; overflow: hidden;}
.stat-card::before { content: ''; position: absolute; top: 0; left: 0; width: 4px; height: 100%; background: var(--brand); }
.stat-title { font-size: 14px; color: var(--muted); font-weight: 700; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; text-transform: uppercase; letter-spacing: 0.5px;}
.stat-value { font-size: 32px; font-weight: 800; color: var(--ink); line-height: 1; margin-top: 8px;}
.log-list { max-height: 140px; overflow-y: auto; font-size: 13px; color: var(--text); padding: 0; margin: 0; list-style: none; }
.log-list li { border-bottom: 1px solid var(--border-light); padding: 8px 0; display: flex; justify-content: space-between; align-items: center;}
.log-list li:last-child { border-bottom: none; }

/* --- 列表頁面 Top Bar --- */
.top-bar { display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:16px; margin-bottom: 24px; border-bottom: 1px solid var(--border); padding-bottom: 20px;}
.top-bar h2 { margin:0; font-size: 24px; font-weight: 800; color: var(--ink); }

.search-box { 
  width: 100%; margin-bottom: 16px; padding: 14px 20px; font-size: 15px; 
  border: 1px solid var(--border); border-radius: var(--radius-md); box-sizing: border-box; 
  box-shadow: var(--shadow-sm); transition: all 0.2s; background: var(--panel);
}
.search-box:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-light); outline: none; }

.list-filters-row { margin-bottom: 16px; display:flex; justify-content:space-between; align-items:center; gap:12px; flex-wrap:wrap; background: var(--panel); padding: 12px 16px; border-radius: var(--radius-md); border: 1px solid var(--border); box-shadow: var(--shadow-sm);}
.list-filters-left { display:flex; flex-wrap:wrap; gap:12px; align-items:center; font-size:14px; color:var(--ink); font-weight: 600;}
.list-filters-left select { padding:6px 12px; border-radius:var(--radius-sm); border:1px solid var(--border); background:var(--bg); font-weight: 500; font-size: 13px; width: auto;}
.list-filters-right { display:flex; align-items:center; gap:12px; }
.list-count { font-size:13px; color:var(--muted); margin-left:8px; font-weight: 500; background: var(--bg); padding: 4px 8px; border-radius: 99px;}
.status-msg { color: #10b981; font-weight:bold; font-size:13px; }

/* --- 按鈕 --- */
.btn { 
  padding: 10px 16px; color: white; border: none; border-radius: var(--radius-sm); 
  cursor: pointer; font-weight: 700; text-decoration: none; display: inline-flex; 
  align-items: center; justify-content: center; gap:6px; font-size: 13px; 
  transition: all 0.2s; box-shadow: var(--shadow-sm); line-height: 1.2;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); filter: brightness(1.05); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-primary { background: var(--brand); font-size: 15px; padding: 12px 24px; border-radius: var(--radius-md); }
.btn-danger { background: #ef4444; }
.btn-warning { background: #f59e0b; color: #fff;}
.btn-edit { background: var(--ink); }
.btn-refresh { background: var(--panel); color: var(--ink); border: 1px solid var(--border); box-shadow: none;}
.btn-refresh:hover { background: var(--bg); }
.btn-quick { background: var(--brand-50); color: var(--brand); border: 1px solid rgba(15, 118, 110, 0.2); box-shadow: none;} 
.btn-quick:hover { background: var(--brand-light); }

/* --- 列表項目 Card --- */
.event-item { 
  background: var(--panel); padding: 20px; border-radius: var(--radius-lg); margin-bottom: 16px; 
  display: flex; justify-content: space-between; align-items: center; border: 1px solid var(--border); 
  flex-wrap: wrap; gap: 16px; box-shadow: var(--shadow-sm); transition: all 0.2s;
}
.event-item:hover { box-shadow: var(--shadow-md); border-color: #cbd5e1; }
.event-item.hidden { display: none; }
.event-info { flex: 1; min-width: 250px; }
.event-title { font-weight: 800; font-size: 1.15rem; color: var(--ink); display: flex; align-items: center; flex-wrap: wrap; margin-bottom: 8px; gap: 8px; }
.event-meta { font-size: 0.9rem; color: var(--muted); font-weight: 500; display: flex; align-items: center; flex-wrap: wrap; gap: 6px;}
.event-pill { background: var(--bg); color: var(--text); padding: 4px 10px; border-radius: var(--radius-sm); font-size: 12px; font-weight: 700; border: 1px solid var(--border);}
.status-expired { background: #fef2f2; color: #ef4444; padding: 4px 8px; border-radius: var(--radius-sm); font-size: 11px; font-weight: 700; border: 1px solid #fecaca; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.empty-msg { text-align: center; padding: 60px 20px; color: var(--muted); font-size: 15px; font-weight: 600; background: var(--panel); border-radius: var(--radius-lg); border: 1px dashed #cbd5e1;}

.thumbnail-preview { width: 64px; height: 64px; object-fit: cover; border-radius: var(--radius-md); border: 1px solid var(--border-light); flex-shrink: 0; }

/* --- Table (人員管理) --- */
.user-table { width: 100%; border-collapse: separate; border-spacing: 0; margin-top: 24px; background: var(--panel); border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--border); box-shadow: var(--shadow-sm); }
.user-table th, .user-table td { padding: 16px 20px; text-align: left; border-bottom: 1px solid var(--border-light); }
.user-table th { background: var(--bg); color: var(--muted); font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px;}
.user-table tr:last-child td { border-bottom: none; }
.user-table tbody tr:hover { background: var(--bg); }
.add-user-box { background: var(--panel); padding: 24px; border-radius: var(--radius-lg); border: 1px solid var(--border); margin-bottom: 24px; display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; box-shadow: var(--shadow-sm); }

/* --- 營業時間產生器 --- */
.schedule-editor { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px; margin-bottom: 16px; display: none; }
.schedule-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.schedule-label { width: 40px; font-weight: 700; color: var(--ink); font-size: 14px; }
.schedule-input { width: 120px !important; padding: 8px 12px !important; font-size: 14px; }
.schedule-sep { color: var(--muted); font-weight: 600; }
.schedule-split-group { display: none; align-items: center; gap:8px; }
.schedule-check { margin-left: 12px; font-size: 13px; display: flex; align-items: center; gap: 4px; cursor: pointer; color: var(--text); white-space: nowrap; font-weight: 600;}
.schedule-tools { display: flex; gap: 10px; margin-bottom: 16px; border-bottom: 1px solid var(--border); padding-bottom: 16px; flex-wrap: wrap;}

/* --- Toast 通知 --- */
#toast-container { position: fixed; bottom: 32px; left: 50%; transform: translateX(-50%); z-index: 3000; display: flex; flex-direction: column; gap: 12px; pointer-events: none; }
.toast { 
    background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 99px; 
    font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lg); animation: fadeInOut 3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; 
    display: flex; align-items: center; gap: 8px; max-width: 80%; margin: 0 auto; 
}
@keyframes fadeInOut { 
    0% { opacity: 0; transform: translateY(20px) scale(0.95); } 
    10% { opacity: 1; transform: translateY(0) scale(1); } 
    85% { opacity: 1; transform: translateY(0) scale(1); } 
    100% { opacity: 0; transform: translateY(-20px) scale(0.95); } 
}

/* 模式控制 */
.group-event, .group-food, .group-spots { display: none; }
body.mode-events .group-event { display: block; }
body.mode-events .group-event-flex { display: flex; }
body.mode-food .group-food { display: block; }
body.mode-spots .group-spots { display: block; }

/* 響應式 */
@media (max-width: 768px) {
  #app-screen { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; padding: 12px 16px; overflow-x: auto; align-items: center; gap: 12px; border-bottom: 1px solid #1e293b;}
  .sidebar h3, .user-info { display: none; }
  .manage-select { width: auto; margin-bottom: 0; padding: 8px 12px; font-size: 14px;}
  .nav-btn { flex: 0 0 auto; justify-content: center; margin-bottom:0; white-space: nowrap; padding: 8px 16px; font-size: 14px;}
  
  .main-content { padding: 20px 16px; }
  .dashboard { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; gap: 16px; }
  .add-user-box { flex-direction: column; align-items: stretch; }
  .cat-grid { grid-template-columns: repeat(3, 1fr); }
  
  .event-item { flex-direction: column; align-items: stretch; }
  .actions { justify-content: flex-end; margin-top: 8px; border-top: 1px solid var(--border-light); padding-top: 12px;}
  .schedule-input { width: 105px !important; }
}