/* ==========================================================================
   CSS 設計系統 - AstroNumerology (生命靈數計算機)
   採用高級暗色星宿與神秘金黃 (Mystical Starry & Gold) 視覺風格
   ========================================================================== */

/* 變數定義 */
:root {
    --bg-primary: #06040a;
    --bg-secondary: #0f0a1d;
    --bg-card: rgba(15, 10, 29, 0.7);
    --border-color: rgba(212, 175, 55, 0.15); /* 輕微金黃邊框 */
    --border-focus: #f59e0b; /* 琥珀金 */
    
    --text-primary: #f5f3ff;
    --text-secondary: #c084fc;
    --text-hint: #7c3aed;
    
    --color-accent: #f59e0b; /* 琥珀金 */
    --color-accent-light: #fbbf24;
    --color-primary: #8b5cf6; /* 紫羅蘭 */
    --color-purple-glow: rgba(139, 92, 246, 0.3);
    --color-gold-glow: rgba(245, 158, 11, 0.3);
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 10px 40px rgba(0, 0, 0, 0.6);
    --shadow-neon-purple: 0 0 20px rgba(139, 92, 246, 0.2);
    --shadow-neon-gold: 0 0 25px rgba(245, 158, 11, 0.25);
    
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 全域重設 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', 'Noto Sans TC', sans-serif;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    line-height: 1.6;
    background-image: radial-gradient(circle at 80% 20%, rgba(139, 92, 246, 0.08) 0%, transparent 50%),
                      radial-gradient(circle at 10% 80%, rgba(245, 158, 11, 0.05) 0%, transparent 50%);
}

.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
}

/* 動畫定義 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse-gold {
    0% { box-shadow: 0 0 15px rgba(245, 158, 11, 0.2); }
    50% { box-shadow: 0 0 30px rgba(245, 158, 11, 0.5); }
    100% { box-shadow: 0 0 15px rgba(245, 158, 11, 0.2); }
}

.animate-fade-in {
    animation: fadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.delay-100 { animation-delay: 0.1s; opacity: 0; }
.delay-200 { animation-delay: 0.2s; opacity: 0; }
.delay-300 { animation-delay: 0.3s; opacity: 0; }

/* 頁首 Header */
.app-header {
    position: relative;
    padding: 24px 0 12px;
    text-align: center;
    background: radial-gradient(circle at 50% 0%, rgba(139, 92, 246, 0.12) 0%, transparent 60%);
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    background: rgba(245, 158, 11, 0.05);
    padding: 4px 12px;
    border-radius: 50px;
    border: 1px solid var(--border-color);
}

.logo-icon {
    font-size: 1.25rem;
    color: var(--color-accent);
    text-shadow: 0 0 10px rgba(245, 158, 11, 0.6);
}

.logo-text {
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--text-primary);
}

.app-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 12px;
    background: linear-gradient(135deg, #ffffff 40%, #fcd34d 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.app-header .subtitle {
    color: var(--text-secondary);
    font-size: 0.85rem;
    max-width: 600px;
    margin: 0 auto;
}

/* 主版面佈局 */
.main-content {
    flex: 1;
    padding-bottom: 60px;
}

/* 卡片基礎樣式 */
.card {
    background-color: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    box-shadow: var(--shadow-md);
    transition: var(--transition-smooth);
    margin-bottom: 12px;
}

.card:hover {
    border-color: rgba(245, 158, 11, 0.25);
    box-shadow: 0 12px 45px rgba(0, 0, 0, 0.6);
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* 輸入面板 */
.input-container {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 12px;
    align-items: flex-end;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

input[type="date"] {
    background-color: rgba(6, 4, 10, 0.8);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 1px;
    outline: none;
    transition: var(--transition-smooth);
}

input[type="date"]:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.2);
}

/* 結果版面配置 */
.result-layout {
    display: grid;
    grid-template-columns: 1fr 1.3fr;
    gap: 12px;
    margin-top: 12px;
}

.left-column,
.right-column {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* 核心靈數主卡 */
.num-main-card {
    text-align: center;
    background: radial-gradient(circle at 50% 30%, rgba(139, 92, 246, 0.15) 0%, transparent 60%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 10px;
}

.badge-container {
    margin-bottom: 20px;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    font-size: 2rem;
    font-weight: 800;
    color: var(--color-accent);
    background: rgba(6, 4, 10, 0.8);
    border: 3px solid var(--color-accent);
    border-radius: 50%;
    box-shadow: var(--shadow-neon-gold);
    animation: pulse-gold 3s infinite ease-in-out;
}

.num-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.num-keyword {
    color: var(--color-accent-light);
    font-weight: 500;
    font-size: 0.9rem;
    letter-spacing: 2px;
    background: rgba(245, 158, 11, 0.05);
    padding: 4px 12px;
    border-radius: 50px;
    border: 1px solid rgba(245, 158, 11, 0.1);
    margin-bottom: 12px;
}

.stats-bars {
    width: 100%;
    max-width: 280px;
}

.bar-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.bar-label span:last-child {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 0.95rem;
}

/* 3x3 命運九宮格 (Grid) */
.grid-container {
    display: flex;
    justify-content: center;
    margin: 5px 0 12px;
}

.numerology-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    width: 180px;
    height: 180px;
}

.grid-cell {
    background-color: rgba(6, 4, 10, 0.6);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    transition: var(--transition-smooth);
}

/* 當該格子有圈數時啟動發光樣式 */
.grid-cell.active {
    border-color: var(--color-accent);
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.15) inset;
    background-color: rgba(245, 158, 11, 0.02);
}

.grid-cell.active .cell-num {
    color: var(--color-accent-light);
    font-weight: 700;
    text-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}

.cell-num {
    font-size: 1.2rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.2);
    transition: var(--transition-smooth);
}

/* 圈數小徽章 */
.cell-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background-color: var(--color-accent);
    color: #000000;
    font-size: 0.75rem;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.6);
    transition: var(--transition-smooth);
}

.grid-cell.active .cell-count {
    opacity: 1;
    transform: scale(1);
}

/* 特質連線清單 */
.connections-box {
    border-top: 1px solid var(--border-color);
    padding-top: 10px;
}

.connections-box h4 {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.connections-list {
    list-style-type: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.connection-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(245, 158, 11, 0.02);
    border: 1px solid rgba(245, 158, 11, 0.08);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
}

.connection-name {
    font-weight: 600;
    color: var(--text-primary);
}

.connection-desc {
    color: var(--text-secondary);
}

/* 右側性格分析報告 */
.report-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.report-section {
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    padding-bottom: 8px;
}

.report-section:last-of-type {
    border-bottom: none;
    padding-bottom: 0;
}

.section-subtitle {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-accent-light);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.report-section p {
    font-size: 0.80rem;
    color: #e2e8f0;
    text-align: justify;
}

/* 幸運色與寶石 */
.luck-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 6px;
}

.luck-box {
    background: rgba(139, 92, 246, 0.05);
    border: 1px solid var(--border-color);
    padding: 8px;
    border-radius: var(--radius-sm);
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.luck-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.luck-value {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* 按鈕樣式 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: var(--transition-smooth);
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-accent) 0%, var(--color-accent-light) 100%);
    color: #000000;
    box-shadow: var(--shadow-neon-gold);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.4);
}

/* FAQ */
.faq-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.faq-item {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.faq-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.faq-question {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.faq-answer {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.faq-answer ul {
    margin-top: 6px;
    margin-left: 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* 頁尾 */
.app-footer {
    padding: 30px 0;
    text-align: center;
    background: rgba(0, 0, 0, 0.5);
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: #555160;
}

.app-footer p {
    margin-bottom: 4px;
}

.github-badge {
    color: var(--color-primary);
    font-weight: 500;
}

/* 響應式佈局 */
@media (max-width: 900px) {
    .result-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .container {
        padding: 0 16px;
    }
    
    .app-header h1 {
        font-size: 1.85rem;
    }
    
    .card {
        padding: 20px;
    }
    
    .input-container {
        grid-template-columns: 1fr;
    }
}
