/* 現代化星空深色主題設計 (Dark Glassmorphism) */
:root {
    --bg-dark: #0f172a;
    --panel-bg: rgba(30, 41, 59, 0.7);
    --panel-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --primary-color: #3b82f6;
    --primary-hover: #2563eb;
    --danger-color: #ef4444;
    --danger-hover: #dc2626;
    --gradient-1: #3b82f6;
    --gradient-2: #8b5cf6;
    --gradient-3: #ec4899;
    --font-heading: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Roboto', -apple-system, sans-serif;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: var(--font-body);
    min-height: 100vh;
    background-image: radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.15), transparent 25%),
                      radial-gradient(circle at 85% 30%, rgba(139, 92, 246, 0.15), transparent 25%);
    background-attachment: fixed;
    line-height: 1.6;
}

h1, h2, h3 { font-family: var(--font-heading); }

/* --- 基礎小元件 --- */
.gradient-text {
    background: linear-gradient(135deg, var(--gradient-1), var(--gradient-2), var(--gradient-3));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
}

.text-center { text-align: center; }

.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--panel-border);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-panel:hover {
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.3);
}

.btn {
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-size: 0.95rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--gradient-1), var(--gradient-2));
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}
.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { background: #475569; cursor: not-allowed; box-shadow: none; }

.btn-outline {
    background: transparent;
    border: 1px solid var(--text-secondary);
    color: var(--text-primary);
}
.btn-outline:hover { background: rgba(255, 255, 255, 0.1); }

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

.btn-small { padding: 0.4rem 0.8rem; font-size: 0.8rem; }
.full-width { width: 100%; }

/* --- 導覽列 --- */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 3%;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--panel-border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.logo { font-size: 1.5rem; font-weight: 800; display: flex; align-items: center; gap: 0.5rem; }
.logo small { font-size: 0.8rem; letter-spacing: 2px; color: var(--gradient-3); }

.nav-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

select {
    background: var(--bg-dark);
    color: var(--text-primary);
    border: 1px solid var(--panel-border);
    padding: 0.4rem 1rem;
    border-radius: 6px;
    outline: none;
}

/* --- 頁面配置 --- */
.main-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

#guest-screen { margin-top: 5rem; padding: 4rem 2rem; }
.huge-text { font-size: 3rem; margin-bottom: 1rem; }
.subtitle { color: var(--text-secondary); font-size: 1.1rem; }
.lock-icon { font-size: 4rem; margin: 2rem 0; opacity: 0.5; }

/* Dashboard 區塊 */
.dashboard-section {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.summary-card { display: flex; flex-direction: column; justify-content: center; align-items: center; }
.huge-number { font-size: 2.5rem; font-weight: 800; color: #10b981; margin-top: 1rem; text-shadow: 0 0 20px rgba(16, 185, 129, 0.4); }

.chart-card h3 { margin-bottom: 1rem; }
.category-bars { width: 100%; }
.bar-row { display: flex; align-items: center; margin-bottom: 0.8rem; }
.bar-label { width: 100px; font-weight: bold; font-size: 0.9rem; }
.bar-track { flex: 1; height: 12px; background: rgba(0,0,0,0.3); border-radius: 6px; position: relative; overflow: hidden; margin: 0 1rem; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--gradient-1), var(--gradient-2)); border-radius: 6px; transition: width 1s ease-out; }
.bar-value { width: 80px; text-align: right; font-size: 0.85rem; color: var(--text-secondary); }

/* Input 區塊 */
.action-section { margin-bottom: 2rem; }
.helper-text { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 1rem; }
textarea {
    width: 100%;
    height: 150px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 1rem;
    color: var(--text-primary);
    font-family: monospace;
    resize: vertical;
    outline: none;
    transition: border-color 0.3s;
}
textarea:focus { border-color: var(--gradient-1); box-shadow: 0 0 10px rgba(59, 130, 246, 0.2); }
.action-bar { display: flex; justify-content: flex-end; margin-top: 1rem; }

/* Table 區塊 */
.table-header { margin-bottom: 1rem; display: flex; justify-content: space-between; align-items: center; }
.table-responsive { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 1rem; text-align: left; border-bottom: 1px solid rgba(255,255,255,0.05); }
th { color: var(--text-secondary); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 1px; }
tr:hover { background: rgba(255, 255, 255, 0.02); }
.tag { background: rgba(139, 92, 246, 0.2); color: #c4b5fd; padding: 0.2rem 0.6rem; border-radius: 12px; font-size: 0.8rem; }

/* 登入彈窗 */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8); backdrop-filter: blur(8px);
    display: none; justify-content: center; align-items: center; z-index: 1000;
}
.modal-overlay.active { display: flex; }
.modal-content { position: relative; width: 90%; max-width: 400px; padding: 2.5rem; }
.close-btn { position: absolute; top: 15px; right: 20px; font-size: 1.5rem; background: none; border: none; color: var(--text-secondary); cursor: pointer; }
.close-btn:hover { color: white; }
.form-group { margin-bottom: 1.5rem; display: flex; flex-direction: column; gap: 0.5rem; }
.glow-input {
    background: rgba(0,0,0,0.3); border: 1px solid var(--panel-border);
    padding: 0.8rem; border-radius: 6px; color: white; outline: none; transition: 0.3s;
}
.glow-input:focus { border-color: var(--gradient-2); box-shadow: 0 0 15px rgba(139, 92, 246, 0.3); }
.modal-footer { margin-top: 1.5rem; text-align: center; font-size: 0.9rem; }
.modal-footer a { color: var(--gradient-1); text-decoration: none; }
.modal-footer a:hover { text-decoration: underline; }

@media (max-width: 768px) {
    .dashboard-section { grid-template-columns: 1fr; }
    .navbar { flex-direction: column; gap: 1rem; }
}
