/* ── 全域設定 ─────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+TC:wght@300;400;500;600;700&family=Noto+Serif+TC:wght@400;600&family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* 主色調：薰衣草紫 */
    --lavender-50:  #f8f4fc;
    --lavender-100: #ede0f7;
    --lavender-200: #d9bfee;
    --lavender-300: #c09adf;
    --lavender-400: #a478cc;
    --lavender-500: #8b5fb8;
    --lavender-600: #7348a0;
    --lavender-700: #5c3580;
    --lavender-800: #452663;
    --lavender-900: #301a47;

    /* 自然綠 */
    --sage-100: #e8f0e9;
    --sage-400: #7a9e7e;
    --sage-500: #5c8c62;
    --sage-600: #3d6b43;

    /* 暖色背景 */
    --bg-page:   #faf8f5;
    --bg-warm:   #f5f0ea;
    --bg-card:   #ffffff;
    --bg-muted:  #f0ece5;

    /* 文字 */
    --text-primary:   #2d2419;
    --text-secondary: #6b5a4e;
    --text-muted:     #a8998c;
    --text-inverse:   #ffffff;

    /* 邊框 */
    --border:        rgba(139, 108, 160, 0.15);
    --border-warm:   rgba(139, 99, 60, 0.1);
    --border-hover:  rgba(139, 95, 184, 0.35);

    /* 陰影 */
    --shadow-sm:   0 2px 8px rgba(45, 36, 25, 0.06);
    --shadow-md:   0 4px 20px rgba(45, 36, 25, 0.1);
    --shadow-lg:   0 12px 40px rgba(45, 36, 25, 0.12);
    --shadow-glow: 0 0 30px rgba(139, 95, 184, 0.2);

    /* 圓角 */
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 22px;
    --radius-xl: 32px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
    font-family: 'Noto Sans TC', 'Inter', sans-serif;
    background: var(--bg-page);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

/* ── 背景裝飾 ─────────────────────────────────────────────── */
.bg-particles {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.bg-particles::before {
    content: '';
    position: absolute;
    width: 700px;
    height: 700px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(139,95,184,0.06) 0%, transparent 70%);
    top: -200px;
    right: -200px;
}

.bg-particles::after {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(122,158,126,0.07) 0%, transparent 70%);
    bottom: 100px;
    left: -100px;
}

/* ── Header ──────────────────────────────────────────────── */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 16px 40px;
    background: rgba(250, 248, 245, 0.88);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-warm);
    transition: all .3s ease;
}

.header.scrolled {
    padding: 12px 40px;
    background: rgba(250, 248, 245, 0.97);
    box-shadow: var(--shadow-sm);
}

.header-inner {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 40px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
}

.logo-img {
    height: 44px;
    width: auto;
}

.logo-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.logo-sub {
    font-size: 11px;
    color: var(--lavender-500);
    letter-spacing: 1px;
}

.nav {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}

.nav-link {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all .2s ease;
}

.nav-link:hover, .nav-link.active {
    color: var(--lavender-600);
    background: var(--lavender-50);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-shrink: 0;
}

.datetime-display {
    font-size: 13px;
    color: var(--text-muted);
    font-family: 'Inter', monospace;
}

.btn-login {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 20px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--lavender-500), var(--lavender-700));
    color: white;
    border: none;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s ease;
    font-family: inherit;
    box-shadow: 0 4px 16px rgba(139,95,184,0.25);
}

.btn-login:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(139,95,184,0.4);
}

/* ── Page Banner（共用：bi / kpi / training）──────────────── */
.page-banner {
    padding: 140px 32px 60px;
    max-width: 1280px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.breadcrumb {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
    margin-bottom: 28px;
    transition: color .2s;
}
.breadcrumb:hover { color: var(--lavender-400); }

.banner-tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    background: rgba(139,92,246,0.08);
    border: 1px solid rgba(139,92,246,0.2);
    border-radius: 999px;
    font-size: 13px;
    color: var(--lavender-600);
    margin-bottom: 20px;
    letter-spacing: 0.5px;
}

.banner-title {
    font-size: clamp(32px, 5vw, 52px);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.banner-desc {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 40px;
}

/* ── Hero ─────────────────────────────────────────────────── */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 120px 40px 80px;
    max-width: 1280px;
    margin: 0 auto;
    gap: 80px;
    position: relative;
    z-index: 1;
}

.hero-content {
    flex: 1;
    max-width: 560px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    background: var(--lavender-50);
    border: 1px solid rgba(139,95,184,0.2);
    border-radius: 999px;
    font-size: 13px;
    color: var(--lavender-600);
    margin-bottom: 28px;
    letter-spacing: 0.5px;
}

.badge-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--sage-500);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.5; transform: scale(0.85); }
}

.hero-title {
    font-size: clamp(34px, 4.5vw, 52px);
    font-weight: 700;
    line-height: 1.25;
    margin-bottom: 20px;
    font-family: 'Noto Serif TC', serif;
    color: var(--text-primary);
}

.gradient-text {
    background: linear-gradient(135deg, var(--lavender-500), var(--lavender-700));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-desc {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.9;
    margin-bottom: 40px;
}

.hero-buttons {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 56px;
}

.btn-primary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 13px 28px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--lavender-500), var(--lavender-700));
    color: white;
    border: none;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all .25s ease;
    font-family: inherit;
    box-shadow: 0 4px 16px rgba(139,95,184,0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(139,95,184,0.4);
}

.btn-secondary {
    padding: 13px 28px;
    border-radius: var(--radius-md);
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--border);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all .25s ease;
    font-family: inherit;
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: var(--lavender-50);
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.hero-stats {
    display: flex;
    align-items: center;
    gap: 32px;
    padding: 24px 32px;
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-warm);
    box-shadow: var(--shadow-sm);
    width: fit-content;
}

.stat { text-align: center; }

.stat-num {
    font-size: 30px;
    font-weight: 700;
    color: var(--lavender-600);
    font-family: 'Inter', sans-serif;
    line-height: 1;
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.stat-divider {
    width: 1px;
    height: 40px;
    background: var(--border-warm);
}

/* ── Dashboard Preview ─────────────────────────────────────── */
.hero-visual {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.dashboard-preview {
    width: 100%;
    max-width: 440px;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    animation: slideInRight 0.8s ease forwards;
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(40px); }
    to   { opacity: 1; transform: translateX(0); }
}

.dp-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-warm);
    background: var(--bg-warm);
}

.dp-dots { display: flex; gap: 6px; }
.dp-dots span { width: 10px; height: 10px; border-radius: 50%; }
.dp-dots span:nth-child(1) { background: #ff5f57; }
.dp-dots span:nth-child(2) { background: #ffbd2e; }
.dp-dots span:nth-child(3) { background: #28c840; }

.dp-title {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0 auto;
    font-weight: 500;
}

.dp-body {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.dp-chart {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: 90px;
    padding: 8px;
    background: var(--bg-muted);
    border-radius: var(--radius-md);
}

.chart-bar {
    flex: 1;
    height: var(--h);
    background: linear-gradient(to top, var(--lavender-600), var(--lavender-300));
    border-radius: 4px 4px 2px 2px;
    opacity: 0;
    animation: barGrow 0.6s ease var(--delay) forwards;
}

@keyframes barGrow {
    from { height: 0; opacity: 0; }
    to   { height: var(--h); opacity: 1; }
}

.dp-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.dp-card {
    padding: 12px;
    border-radius: var(--radius-md);
    background: var(--bg-muted);
}

.dp-card.green  { border-left: 3px solid var(--sage-500); }
.dp-card.purple { border-left: 3px solid var(--lavender-400); }

.dp-card-num { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.dp-card-val { font-size: 17px; font-weight: 700; color: var(--text-primary); }

.dp-list { display: flex; flex-direction: column; gap: 8px; }

.dp-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-secondary);
}

.dp-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dp-dot.green  { background: var(--sage-500); }
.dp-dot.purple { background: var(--lavender-400); }
.dp-dot.orange { background: #d97706; }

.dp-status { margin-left: auto; font-weight: 600; font-size: 13px; }
.dp-status.ok { color: var(--sage-500); }
.dp-status.building { color: #d97706; animation: spin 2s linear infinite; display: inline-block; }

@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ── Sections 共用 ─────────────────────────────────────────── */
.modules-section, .announcements-section {
    padding: 100px 40px;
    max-width: 1280px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.section-header {
    text-align: center;
    margin-bottom: 60px;
}

.section-tag {
    display: inline-block;
    padding: 5px 16px;
    background: var(--lavender-50);
    border: 1px solid rgba(139,95,184,0.2);
    border-radius: 999px;
    font-size: 13px;
    color: var(--lavender-600);
    margin-bottom: 16px;
    letter-spacing: 1px;
    font-weight: 500;
}

.section-title {
    font-size: clamp(26px, 3.5vw, 38px);
    font-weight: 700;
    margin-bottom: 14px;
    font-family: 'Noto Serif TC', serif;
    color: var(--text-primary);
}

.section-desc {
    font-size: 16px;
    color: var(--text-secondary);
    max-width: 540px;
    margin: 0 auto;
    line-height: 1.8;
}

/* ── Modules Grid ─────────────────────────────────────────── */
.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.module-card {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 24px;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all .25s ease;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.module-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--lavender-50), transparent);
    opacity: 0;
    transition: opacity .25s;
}

.module-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.module-card:hover::before { opacity: 1; }

.module-icon {
    font-size: 30px;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--lavender-50);
    border-radius: var(--radius-md);
    flex-shrink: 0;
    transition: transform .25s;
    border: 1px solid rgba(139,95,184,0.1);
}

.module-card:hover .module-icon { transform: scale(1.1) rotate(-5deg); }

.module-info { flex: 1; }

.module-info h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text-primary);
}

.module-info p {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}

.module-status {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 999px;
    font-weight: 600;
    flex-shrink: 0;
    white-space: nowrap;
}

.module-status.done {
    background: rgba(92,140,98,0.1);
    color: var(--sage-600);
    border: 1px solid rgba(92,140,98,0.25);
    animation: pulse 2s ease-in-out infinite;
}

.module-status.building {
    background: rgba(217,119,6,0.08);
    color: #92400e;
    border: 1px solid rgba(217,119,6,0.2);
}

.module-status.plan, .module-status.active {
    background: var(--lavender-50);
    color: var(--lavender-600);
    border: 1px solid rgba(139,95,184,0.2);
}

/* ── Announcements ─────────────────────────────────────────── */
.announcements-section {
    background: var(--bg-warm);
    max-width: 100%;
    padding: 100px 40px;
}

.announcements-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    max-width: 800px;
    margin: 0 auto;
}

.announcement-item {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    padding: 24px;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: all .25s ease;
    box-shadow: var(--shadow-sm);
}

.announcement-item.pinned {
    border-color: rgba(139,95,184,0.25);
    background: var(--lavender-50);
}

.announcement-item:hover {
    border-color: var(--border-hover);
    transform: translateX(4px);
    box-shadow: var(--shadow-md);
}

.ann-badge {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 2px;
}

.ann-badge.pin {
    background: var(--lavender-100);
    color: var(--lavender-700);
}

.ann-badge.new {
    background: rgba(92,140,98,0.12);
    color: var(--sage-600);
}

.ann-content { flex: 1; }

.ann-content h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.ann-content p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
}

.ann-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: right;
    flex-shrink: 0;
    font-size: 12px;
    color: var(--text-muted);
}

/* ── Footer ──────────────────────────────────────────────── */
.footer {
    border-top: 1px solid var(--border-warm);
    padding: 60px 40px 0;
    position: relative;
    z-index: 1;
    background: var(--bg-warm);
}

.footer-inner {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    gap: 80px;
    flex-wrap: wrap;
    padding-bottom: 48px;
}

.footer-brand { flex: 2; }

.footer-brand p {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 16px;
    max-width: 300px;
    line-height: 1.8;
}

.footer-links { flex: 1; display: flex; gap: 60px; }

.footer-col { display: flex; flex-direction: column; gap: 12px; }

.footer-col h5 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

.footer-col a {
    font-size: 14px;
    color: var(--text-muted);
    text-decoration: none;
    transition: color .2s;
}

.footer-col a:hover { color: var(--lavender-600); }

.footer-bottom {
    max-width: 1280px;
    margin: 0 auto;
    padding: 20px 0;
    border-top: 1px solid var(--border-warm);
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
}

/* ── 管理者登入 Modal ─────────────────────────────────────── */
.admin-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(45,36,25,0.55);
    z-index: 500;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}
.admin-overlay.open { display: flex; }

.admin-modal {
    background: white;
    border-radius: var(--radius-xl);
    padding: 40px;
    width: 420px;
    max-width: 92vw;
    box-shadow: var(--shadow-lg);
    position: relative;
}

.admin-modal-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}
.admin-modal-sub {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 28px;
}

.admin-input-group { margin-bottom: 16px; }
.admin-input-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.admin-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary);
    outline: none;
    transition: border-color .2s;
    box-sizing: border-box;
}
.admin-input:focus { border-color: var(--lavender-400); }

.admin-error {
    font-size: 13px;
    color: #b91c1c;
    margin-bottom: 12px;
    display: none;
}

.btn-admin-submit {
    width: 100%;
    padding: 11px;
    background: linear-gradient(135deg, var(--lavender-500), var(--lavender-700));
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: all .2s;
    box-shadow: 0 4px 16px rgba(139,95,184,0.3);
}
.btn-admin-submit:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(139,95,184,0.45); }

.admin-close {
    position: absolute;
    top: 16px; right: 18px;
    font-size: 22px;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
    background: none;
    border: none;
    transition: color .2s;
}
.admin-close:hover { color: var(--text-primary); }

/* ── 管理者面板 ──────────────────────────────────────────── */
.admin-panel {
    display: none;
    position: fixed;
    top: 72px; right: 24px;
    width: 340px;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 300;
    overflow: hidden;
}
.admin-panel.open { display: block; }

.admin-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(135deg, var(--lavender-600), var(--lavender-800));
    color: white;
}
.admin-panel-title { font-size: 14px; font-weight: 700; }
.btn-admin-close-panel {
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
}

.admin-panel-body { padding: 16px; display: flex; flex-direction: column; gap: 8px; }

.admin-action-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: white;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: all .18s;
    width: 100%;
}
.admin-action-btn:hover { background: var(--lavender-50); border-color: var(--lavender-300); color: var(--lavender-700); }
.admin-action-btn .aa-icon { font-size: 18px; }

.admin-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(115,72,160,0.12);
    color: var(--lavender-700);
    font-size: 11px;
    font-weight: 700;
    margin-left: 6px;
}

/* 登入按鈕狀態 */
.btn-login.logged-in {
    background: linear-gradient(135deg, var(--sage-500), var(--sage-600));
    box-shadow: 0 4px 16px rgba(92,140,98,0.3);
}
