:root { 
    --primary: #38bdf8; 
    --primary-dark: #0284c7; 
    --accent: #facc15; 
    --bg: #121212; 
    --card-bg: #1e1e1e; 
    --text: #e2e8f0; 
    --text-muted: #94a3b8; 
    --border: #333333; 
    --nav-height: 60px; 
    --header-height: 60px; 
    --item-bg: #2a2a2a;
}

/* 淺色模式變數 */
body.light-mode {
    --bg: #f1f5f9;
    --card-bg: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --item-bg: #f8fafc;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body { font-family: "Microsoft JhengHei", "Heiti TC", sans-serif !important; background-color: var(--bg); color: var(--text); margin: 0; padding-bottom: calc(var(--nav-height) + 20px); transition: background-color 0.3s ease, color 0.3s ease; }

/* Header */
header { background: rgba(var(--card-bg), 0.95); backdrop-filter: blur(10px); padding: 10px 20px; position: sticky; top: 0; z-index: 100; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; height: var(--header-height); background: var(--card-bg);}
.header-left { display: flex; align-items: center; gap: 10px; }
h1 a { color: var(--text); text-decoration: none; font-weight: 800; font-size: 1.2rem; }
.date-badge { font-size: 0.85rem; color: var(--text-muted); background: var(--bg); padding: 4px 10px; border-radius: 20px; border: 1px solid var(--border); }
.icon-btn { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text); padding: 5px; }

.container { max-width: 800px; margin: 0 auto; padding: 15px; }

/* Dashboard */
.hero-section { position: relative; background: linear-gradient(135deg, #0f172a 0%, #2563eb 100%); border-radius: 20px; padding: 25px; text-align: center; color: white; margin-bottom: 20px; box-shadow: 0 4px 20px rgba(37, 99, 235, 0.2); }
.hero-label { font-size: 0.9rem; opacity: 0.8; letter-spacing: 1px; margin-bottom: 5px; }
.hero-title { font-size: 1.4rem; font-weight: 700; margin: 10px 0; line-height: 1.4; text-shadow: 0 2px 4px rgba(0,0,0,0.3); }
.hero-countdown { font-size: 2.2rem; font-weight: 800; margin: 10px 0; color: var(--accent); }
.hero-date { font-size: 0.95rem; opacity: 0.9; background: rgba(255,255,255,0.1); display: inline-block; padding: 4px 12px; border-radius: 12px; }

/* 更新按鈕 */
.refresh-btn { 
    position: absolute; top: 15px; right: 15px; 
    background: rgba(255,255,255,0.25); border: 1px solid rgba(255,255,255,0.3); 
    color: white; padding: 6px 12px; border-radius: 20px; font-size: 0.85rem; 
    cursor: pointer; backdrop-filter: blur(5px); display: flex; align-items: center; gap: 5px;
    z-index: 50; box-shadow: 0 2px 5px rgba(0,0,0,0.2); transition: all 0.2s ease;
}
.refresh-btn:active { transform: scale(0.95); background: rgba(255,255,255,0.4); }

/* Skeleton */
.skeleton-item {
    background: #2a2a2a;
    background-image: linear-gradient(to right, #2a2a2a 0%, #3a3a3a 20%, #2a2a2a 40%, #2a2a2a 100%);
    background-repeat: no-repeat;
    background-size: 800px 100%; 
    display: block;
    position: relative;
    animation-duration: 1.5s;
    animation-fill-mode: forwards;
    animation-iteration-count: infinite;
    animation-name: shimmer;
    animation-timing-function: linear;
    width: 100%;
    height: 60px;
    border-radius: 12px;
    margin-bottom: 10px;
    opacity: 0.7;
}
body.light-mode .skeleton-item {
    background: #e2e8f0;
    background-image: linear-gradient(to right, #e2e8f0 0%, #f1f5f9 20%, #e2e8f0 40%, #e2e8f0 100%);
}
@keyframes shimmer {
    0% { background-position: -468px 0; }
    100% { background-position: 468px 0; }
}

/* Toast */
#toast-box {
    position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
    z-index: 2000; display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.toast-msg {
    background: rgba(30, 30, 30, 0.9); color: white; padding: 12px 20px;
    border-radius: 50px; font-size: 0.95rem; box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    opacity: 0; transform: translateY(20px); transition: all 0.3s ease;
    display: flex; align-items: center; gap: 8px; pointer-events: auto;
}
body.light-mode .toast-msg { background: rgba(0, 0, 0, 0.85); }
.toast-msg.show { opacity: 1; transform: translateY(0); }

/* Lunch Card Styles */
.lunch-card { padding: 15px; margin-bottom: 20px; border-left: 4px solid #f97316; } 
.lunch-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.lunch-date-input { background: var(--item-bg); border: 1px solid var(--border); color: var(--text); padding: 4px 8px; border-radius: 6px; font-size: 0.9rem; }

/* New: Vendor Section Styles */
.kitchen-section { margin-bottom: 15px; border-bottom: 1px dashed var(--border); padding-bottom: 10px; }
.kitchen-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.kitchen-title { font-size: 1rem; color: var(--primary); margin: 0 0 8px 0; font-weight: bold; display: flex; align-items: center; gap: 5px; }
.kitchen-title::before { content: '👨‍🍳'; font-size: 0.9rem; }

.lunch-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.dish-tag { 
    font-size: 0.9rem; padding: 6px 10px; border-radius: 6px; background: var(--item-bg); border: 1px solid var(--border); 
    display: flex; align-items: center; gap: 5px; color: var(--text);
}
.dish-cat { font-size: 0.75rem; opacity: 0.7; border: 1px solid var(--text-muted); padding: 0 4px; border-radius: 4px; }

.lunch-detail-btn {
    display: block; text-align: center; margin-top: 15px; padding: 8px; 
    background: var(--item-bg); border-radius: 8px; 
    color: var(--text-muted); font-size: 0.9rem; text-decoration: none; 
    border: 1px solid var(--border); transition: 0.2s;
}
.lunch-detail-btn:hover { background: var(--border); color: var(--text); }

.dash-item { display: flex; align-items: center; padding: 12px; background: var(--card-bg); border-radius: 12px; margin-bottom: 10px; border: 1px solid var(--border); }
.dash-date-box { width: 55px; height: 55px; background: var(--item-bg); border-radius: 8px; display: flex; flex-direction: column; justify-content: center; align-items: center; margin-right: 15px; border-left: 3px solid #666; flex-shrink: 0; }
.dash-date-box.admin { border-left-color: #c084fc; }
.dash-date-box.edu { border-left-color: #38bdf8; }
.dash-date-box.stu { border-left-color: #4ade80; }
.dash-date-box.gen { border-left-color: #fb923c; }
.dash-date-box.coun { border-left-color: #f472b6; }
.dash-date-box.kinder { border-left-color: #2dd4bf; }
.dd-month { font-size: 0.7rem; color: var(--text-muted); }
.dd-day { font-size: 1.3rem; font-weight: 700; color: var(--text); line-height: 1; }
.dash-content { flex: 1; overflow: hidden; }
.dash-title { color: var(--text); font-size: 1rem; font-weight: 600; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-meta { display: flex; align-items: center; }
.dash-dept { font-size: 0.75rem; color: var(--text-muted); }

/* Tools */
.fake-search-bar { background: var(--card-bg); border-radius: 12px; padding: 12px 15px; color: var(--text-muted); margin-bottom: 20px; cursor: pointer; border: 1px solid var(--border); }
.sticky-tools { position: sticky; top: var(--header-height); z-index: 95; background: var(--bg); padding: 10px 0; border-bottom: 1px solid var(--border); transition: background-color 0.3s ease; }
.search-bar { width: 100%; padding: 12px; background: var(--card-bg); border: 1px solid var(--border); color: var(--text); border-radius: 10px; font-size: 1rem; margin-bottom: 10px; outline: none; }
.filter-scroller { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 5px; scrollbar-width: none; }
.filter-chip { padding: 6px 12px; background: var(--card-bg); border: 1px solid var(--border); border-radius: 20px; color: var(--text-muted); white-space: nowrap; transition: 0.2s; }
.filter-chip.active { background: var(--primary); color: #000; font-weight: bold; border-color: var(--primary); }

/* Calendar Items */
.month-header { position: sticky; top: 160px; background: rgba(18,18,18,0.95); backdrop-filter: blur(5px); color: var(--primary); font-weight: bold; padding: 10px 0; z-index: 90; font-size: 1.1rem; border-bottom: 1px solid var(--border); margin-top: 10px; }
body.light-mode .month-header { background: rgba(241, 245, 249, 0.95); } 

.event-item { display: flex; flex-direction: column; background: var(--card-bg); border-radius: 12px; margin-bottom: 15px; border: 1px solid var(--border); overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.05); transition: all 0.3s ease; }
.event-row-main { display: flex; align-items: stretch; }

.event-item.today-highlight { border: 2px solid var(--accent); }
.date-box { width: 70px; display: flex; flex-direction: column; justify-content: center; align-items: center; background: var(--item-bg); border-right: 1px solid var(--border); flex-shrink: 0; }
.date-box.active { background: var(--accent); color: #000; }
.date-box.active .db-day { color: #000; }
.date-box.active .db-month { color: #333; }
.db-day { font-size: 1.8rem; font-weight: 800; color: var(--primary); line-height: 1; }
.db-month { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; }
.info-column { flex: 1; padding: 12px 15px; display: flex; flex-direction: column; justify-content: center; border-right: 1px solid var(--border); }
.event-title { font-size: 1.05rem; font-weight: 600; color: var(--text); line-height: 1.5; margin-bottom: 6px; }
.event-meta { display: flex; gap: 5px; align-items: center; }
.tag { font-size: 0.75rem; padding: 2px 8px; border-radius: 6px; font-weight: 500; }
.tag-admin { background: rgba(192, 132, 252, 0.15); color: #c084fc; border: 1px solid rgba(192, 132, 252, 0.3); }
.tag-edu { background: rgba(56, 189, 248, 0.15); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.3); }
.tag-stu { background: rgba(74, 222, 128, 0.15); color: #4ade80; border: 1px solid rgba(74, 222, 128, 0.3); }
.tag-gen { background: rgba(251, 146, 60, 0.15); color: #fb923c; border: 1px solid rgba(251, 146, 60, 0.3); }
.tag-coun { background: rgba(244, 114, 182, 0.15); color: #f472b6; border: 1px solid rgba(244, 114, 182, 0.3); }
.tag-kinder { background: rgba(45, 212, 191, 0.15); color: #2dd4bf; border: 1px solid rgba(45, 212, 191, 0.3); }
.btns-col { display: flex; flex-direction: column; }
.action-btn { background: transparent; border: none; width: 50px; flex:1; display: flex; align-items: center; justify-content: center; color: var(--text-muted); cursor: pointer; border-bottom: 1px solid var(--border); }
.action-btn:last-child { border-bottom: none; }
.action-btn:active { background: rgba(255,255,255,0.1); }
.action-btn svg { width: 20px; height: 20px; fill: currentColor; }

/* 備忘錄 */
.note-section { padding: 10px; background: var(--item-bg); border-top: 1px solid var(--border); display: none; }
.note-section.active { display: block; animation: fadeIn 0.3s; }
.note-input { width: 100%; background: var(--card-bg); border: 1px solid var(--border); color: var(--text); padding: 8px; border-radius: 6px; font-family: inherit; resize: vertical; min-height: 60px; }
.note-save-btn { margin-top: 5px; background: var(--primary); color: #000; border: none; padding: 4px 12px; border-radius: 4px; font-size: 0.8rem; font-weight: bold; cursor: pointer; }
.has-note-indicator { display: inline-block; width: 8px; height: 8px; background: var(--accent); border-radius: 50%; margin-left: 5px; }

/* Timeline */
.status-card { background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%); border-radius: 16px; padding: 25px; text-align: center; color: white; margin-bottom: 25px; box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3); border: 1px solid rgba(255,255,255,0.1); }
.status-icon { font-size: 2.5rem; margin-bottom: 10px; display: block; animation: bounce 2s infinite; }
.status-text { font-size: 1.5rem; font-weight: 800; margin: 0; text-shadow: 0 2px 4px rgba(0,0,0,0.3); }
.status-sub { font-size: 0.9rem; opacity: 0.8; margin-top: 5px; }
@keyframes bounce { 0%, 20%, 50%, 80%, 100% {transform: translateY(0);} 40% {transform: translateY(-10px);} 60% {transform: translateY(-5px);} }
.timeline-container { position: relative; padding-left: 20px; }
.timeline-container::before { content: ''; position: absolute; left: 7px; top: 0; bottom: 0; width: 2px; background: #333; border-radius: 2px; }
body.light-mode .timeline-container::before { background: #cbd5e1; }

.timeline-item { position: relative; margin-bottom: 20px; padding-left: 25px; transition: all 0.3s ease; opacity: 0.5; }
.timeline-dot { position: absolute; left: 0; top: 8px; width: 16px; height: 16px; background: #444; border-radius: 50%; border: 3px solid var(--bg); z-index: 2; transition: all 0.3s; }
.timeline-content { background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px; padding: 12px 15px; display: flex; justify-content: space-between; align-items: center; }
.tl-time { font-family: monospace; font-size: 0.95rem; color: var(--primary); font-weight: bold; }
.tl-desc { font-size: 1rem; color: var(--text); font-weight: 600; }
.timeline-item.active { opacity: 1; transform: scale(1.02); }
.timeline-item.active .timeline-dot { background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.timeline-item.active .timeline-content { border-color: var(--primary); background: linear-gradient(90deg, rgba(56, 189, 248, 0.1) 0%, rgba(30, 30, 30, 0) 100%); }
.status-card.off { background: linear-gradient(135deg, #10b981 0%, #059669 100%); }
.status-card.weekend { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }

/* Nav */
.bottom-nav { position: fixed; bottom: 0; left: 0; width: 100%; height: var(--nav-height); background: var(--card-bg); border-top: 1px solid var(--border); display: flex; justify-content: space-around; align-items: center; z-index: 100; transition: background 0.3s ease; }
.nav-item { flex: 1; border: none; background: none; color: var(--text-muted); font-size: 0.75rem; display: flex; flex-direction: column; align-items: center; padding: 8px 0; }
.nav-item.active { color: var(--primary); }
.nav-item svg { width: 22px; height: 22px; margin-bottom: 3px; fill: currentColor; }
.view-section { display: none; padding-bottom: 20px; }
.view-section.active { display: block; animation: fadeIn 0.3s; }
.loading { text-align: center; padding: 40px; color: #666; }
.card { background: var(--card-bg); border-radius: 16px; padding: 20px; margin-bottom: 16px; border: 1px solid var(--border); }

.event-item.highlight-active {
    border: 2px solid #facc15; 
    box-shadow: 0 0 15px rgba(250, 204, 21, 0.2);
    transform: scale(1.01);
    z-index: 5;
    background: var(--item-bg);
}
body.light-mode .event-item.highlight-active { background: #fffbeb; }

/* Contact Styles */
.contact-main-card { text-align: center; padding: 25px 20px; background: linear-gradient(180deg, var(--card-bg) 0%, var(--bg) 100%); border: 1px solid var(--border); }
.contact-row { margin-bottom: 8px; color: var(--text); }
.action-buttons { margin-top: 20px; display: flex; justify-content: center; }
.main-call-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: var(--primary);
    color: #000;
    text-decoration: none;
    padding: 12px 24px;
    border-radius: 50px;
    font-weight: bold;
    font-size: 1.1rem;
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.4);
    transition: transform 0.2s;
    width: 100%;
    max-width: 300px;
}
.main-call-btn:active { transform: scale(0.96); }
.main-call-btn .icon { font-size: 1.5rem; }

.section-header { margin: 25px 0 15px 5px; color: var(--text-muted); font-size: 1rem; border-left: 3px solid var(--accent); padding-left: 10px; }
.dept-group { background: var(--card-bg); border-radius: 16px; padding: 15px; margin-bottom: 15px; border: 1px solid var(--border); }
.dept-title { font-size: 1.1rem; font-weight: bold; color: var(--text); margin-bottom: 12px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.dept-title.edu { color: #38bdf8; }
.dept-title.stu { color: #4ade80; }
.dept-title.gen { color: #fb923c; }
.dept-title.coun { color: #f472b6; }
.dept-title.kinder { color: #2dd4bf; }

.phone-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.p-item { background: var(--item-bg); padding: 10px; border-radius: 8px; display: flex; justify-content: space-between; align-items: center; border: 1px solid var(--border); }
.p-name { font-size: 0.95rem; color: var(--text-muted); }
.p-num { font-family: monospace; font-size: 1.1rem; font-weight: bold; color: var(--primary); }

/* 🔥 新增：分機連結樣式 */
.p-num a {
    color: var(--primary);
    text-decoration: none;
    border-bottom: 1px dashed var(--primary);
    transition: all 0.2s;
}
.p-num a:active {
    background: rgba(56, 189, 248, 0.2);
}

/* Quick Links Styles */
.link-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; } 
@media (min-width: 500px) {
    .link-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); } 
}
.link-btn {
    display: flex; align-items: center; justify-content: center; text-align: center;
    padding: 12px 10px; background: var(--item-bg); border: 1px solid var(--border);
    border-radius: 10px; color: var(--text); text-decoration: none; font-size: 0.95rem;
    font-weight: 500; transition: all 0.2s ease; box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.link-btn:active { transform: scale(0.96); background: var(--card-bg); }
.link-btn:hover { border-color: var(--primary); color: var(--primary); }

/* Back to Top */
#back-to-top {
    position: fixed; bottom: 80px; right: 20px; width: 45px; height: 45px;
    background: var(--primary); color: #000; border: none; border-radius: 50%;
    font-size: 1.2rem; cursor: pointer; box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    z-index: 98; display: none; transition: transform 0.2s, opacity 0.3s;
}
#back-to-top:active { transform: scale(0.9); }
#back-to-top.show { display: block; opacity: 1; }