/* ── Reset & Base ────────────────────────────────────── */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans TC', sans-serif;
    background: #f5f5f5;
    color: #333;
    min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
}

.page { display: none; padding: 16px; max-width: 480px; margin: 0 auto; }
.page.active { display: block; }

/* ── Login ───────────────────────────────────────────── */
.login-container {
    margin-top: 20vh;
    padding: 24px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}
.login-container h1 {
    text-align: center;
    margin-bottom: 24px;
    font-size: 24px;
}
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    color: #666;
}
.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s;
}
.form-group input:focus { border-color: #06C755; }
.error-text { color: #e53e3e; font-size: 14px; margin-top: 8px; text-align: center; }

/* ── Buttons ─────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-user-select: none;
    user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: #06C755; color: #fff; }
.btn-primary:hover { background: #05b04c; }
.btn-danger { background: #e53e3e; color: #fff; }
.btn-secondary { background: #eee; color: #333; }
.btn-outline { background: transparent; border: 1px solid #ddd; color: #666; }
.btn-block { width: 100%; padding: 14px; }
.btn-small { padding: 6px 12px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── Header ──────────────────────────────────────────── */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.header h2 { font-size: 18px; }
.header-info { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.event-badge {
    background: #06C755;
    color: #fff;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
}
.staff-badge {
    background: #eee;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 13px;
}

/* ── Event List ──────────────────────────────────────── */
.event-list { display: flex; flex-direction: column; gap: 12px; }
.event-card {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
    cursor: pointer;
    transition: all 0.2s;
    border-left: 4px solid #06C755;
}
.event-card:active { transform: scale(0.98); background: #f9f9f9; }
.event-card h3 { font-size: 16px; margin-bottom: 4px; }
.event-card .meta { font-size: 13px; color: #888; }

/* ── Stats Bar ───────────────────────────────────────── */
.stats-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}
.stat-item {
    flex: 1;
    background: #fff;
    border-radius: 10px;
    padding: 10px;
    text-align: center;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.stat-item.stat-vip { border-top: 3px solid #FFB800; }
.stat-label { display: block; font-size: 12px; color: #888; }
.stat-value { display: block; font-size: 18px; font-weight: 700; margin: 2px 0; }
.stat-rate { display: block; font-size: 13px; color: #06C755; font-weight: 600; }

/* ── Search ──────────────────────────────────────────── */
.search-section {
    background: #fff;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 12px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
}
.search-tabs { display: flex; gap: 8px; margin-bottom: 10px; }
.tab {
    flex: 1;
    padding: 8px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    background: #f5f5f5;
    color: #666;
    transition: all 0.2s;
}
.tab.active { background: #06C755; color: #fff; font-weight: 500; }
.search-input-group { display: flex; gap: 8px; }
.search-input {
    flex: 1;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    outline: none;
}
.search-input:focus { border-color: #06C755; }

/* ── Search Results ──────────────────────────────────── */
.search-results { display: flex; flex-direction: column; gap: 10px; }
.result-card {
    background: #fff;
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
}
.result-card.checked-in { border-left: 4px solid #06C755; opacity: 0.7; }
.result-card.vip { border-left: 4px solid #FFB800; }
.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.result-name { font-size: 16px; font-weight: 600; }
.result-badge {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
}
.badge-vip { background: #FFF3D0; color: #B8860B; }
.badge-checkedin { background: #D4EDDA; color: #155724; }
.badge-pending { background: #FFF3CD; color: #856404; }
.result-info { font-size: 13px; color: #888; margin-bottom: 10px; }
.result-info span { margin-right: 12px; }
.same-name-warning {
    font-size: 12px;
    color: #e53e3e;
    background: #fff5f5;
    padding: 4px 8px;
    border-radius: 6px;
    margin-bottom: 8px;
}
.count-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.count-btn {
    min-width: 48px;
    padding: 10px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    background: #fff;
    transition: all 0.15s;
}
.count-btn:active { transform: scale(0.95); }
.count-btn.recommended {
    background: #06C755;
    color: #fff;
    border-color: #06C755;
}
.action-buttons { display: flex; gap: 8px; margin-top: 8px; }

/* ── Toast ───────────────────────────────────────────── */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: #333;
    color: #fff;
    padding: 12px 24px;
    border-radius: 10px;
    font-size: 15px;
    z-index: 999;
    transition: transform 0.3s;
    max-width: 90vw;
    text-align: center;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { background: #06C755; }
.toast.error { background: #e53e3e; }

/* ── Loading ─────────────────────────────────────────── */
.loading {
    text-align: center;
    padding: 20px;
    color: #888;
}
.spinner {
    display: inline-block;
    width: 24px; height: 24px;
    border: 3px solid #ddd;
    border-top: 3px solid #06C755;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive ──────────────────────────────────────── */
@media (min-width: 768px) {
    .page { max-width: 600px; }
    .stats-bar { gap: 12px; }
    .count-btn { min-width: 56px; padding: 12px 18px; }
}
