/* ============ 奇門遁甲問事網 樣式 ============ */

:root {
    --gold: #c9a227;
    --gold-light: #e8c96a;
    --gold-dark: #8a6d1a;
    --ink: #1a1a2e;
    --ink-light: #2d2d44;
    --paper: #faf6ef;
    --paper-dark: #f0e9da;
    --red: #8b1a1a;
    --red-dark: #5c1010;
    --text: #2b2b2b;
    --text-light: #666;
    --white: #fff;
    --shadow: 0 4px 20px rgba(0,0,0,0.08);
    --radius: 12px;
}

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

body {
    font-family: 'Noto Serif TC', 'Noto Sans SC', serif;
    background: var(--paper);
    color: var(--text);
    line-height: 1.6;
}

/* ============ 導航欄 ============ */
.navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 3rem;
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 15px rgba(0,0,0,0.2);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.brand-icon { font-size: 1.6rem; }

.brand-name {
    color: var(--gold-light);
    font-size: 1.3rem;
    font-weight: 900;
    letter-spacing: 2px;
}

.nav-links {
    display: flex;
    gap: 1.8rem;
}

.nav-links a {
    color: #ddd;
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.3s;
}

.nav-links a:hover { color: var(--gold-light); }

.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.lang-select {
    background: transparent;
    color: #ddd;
    border: 1px solid rgba(255,255,255,0.3);
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
}

.lang-select option { color: var(--ink); }

/* ============ 按鈕 ============ */
.btn {
    padding: 0.6rem 1.4rem;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 700;
}

.btn-primary {
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: var(--white);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(201, 162, 39, 0.4);
}

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--gold);
    color: var(--gold-light);
}

.btn-outline:hover {
    background: var(--gold);
    color: var(--ink);
}

.btn-lg { padding: 0.9rem 2.2rem; font-size: 1.05rem; }
.btn-full { width: 100%; margin-top: 0.8rem; }

/* ============ Hero ============ */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: linear-gradient(160deg, var(--ink) 0%, #2d2d44 60%, #3d3d55 100%);
    overflow: hidden;
    padding: 6rem 2rem 3rem;
}

.hero-bg {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image:
        radial-gradient(circle at 20% 30%, rgba(201,162,39,0.15) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, rgba(201,162,39,0.1) 0%, transparent 35%),
        url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="60" height="60" viewBox="0 0 60 60"><rect width="60" height="60" fill="none"/><path d="M30 0 L60 30 L30 60 L0 30 Z" fill="none" stroke="rgba(255,255,255,0.03)" stroke-width="1"/></svg>');
    background-size: 60px 60px;
    animation: float 20s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.hero-content { position: relative; z-index: 2; max-width: 800px; }

.hero-title {
    font-size: 3.5rem;
    color: var(--gold-light);
    font-weight: 900;
    letter-spacing: 4px;
    margin-bottom: 1.2rem;
    text-shadow: 0 4px 30px rgba(201,162,39,0.3);
}

.hero-subtitle {
    color: #ccc;
    font-size: 1.2rem;
    margin-bottom: 2.5rem;
    letter-spacing: 1px;
}

.hero-actions { display: flex; gap: 1.2rem; justify-content: center; margin-bottom: 3rem; }

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 4rem;
}

.stat { text-align: center; }

.stat-num {
    display: block;
    font-size: 2.2rem;
    color: var(--gold-light);
    font-weight: 900;
}

.stat-label {
    color: #999;
    font-size: 0.9rem;
}

/* ============ Sections ============ */
section { padding: 5rem 3rem; }

.section-title {
    text-align: center;
    font-size: 2.2rem;
    color: var(--ink);
    font-weight: 900;
    margin-bottom: 0.6rem;
    position: relative;
}

.section-title::after {
    content: '';
    display: block;
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--gold), transparent);
    margin: 0.8rem auto 0;
    border-radius: 2px;
}

.section-subtitle {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 2.5rem;
}

/* ============ Features ============ */
.features { background: var(--paper); }

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.8rem;
    max-width: 1100px;
    margin: 0 auto;
}

.feature-card {
    background: var(--white);
    padding: 2rem 1.6rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
    border-top: 3px solid var(--gold);
}

.feature-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.12);
}

.feature-icon { font-size: 2.5rem; margin-bottom: 1rem; }

.feature-card h3 {
    color: var(--ink);
    font-size: 1.2rem;
    margin-bottom: 0.6rem;
}

.feature-card p { color: var(--text-light); font-size: 0.9rem; }

/* ============ 排盤區 ============ */
.paipan-section {
    background: var(--ink);
    background-image: linear-gradient(160deg, var(--ink) 0%, #24243a 100%);
}

.paipan-section .section-title { color: var(--gold-light); }

.paipan-container {
    max-width: 1000px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
    align-items: start;
}

.paipan-form {
    background: rgba(255,255,255,0.06);
    padding: 1.8rem;
    border-radius: var(--radius);
    border: 1px solid rgba(255,255,255,0.1);
}

.form-group { margin-bottom: 1.2rem; }

.form-group label {
    display: block;
    color: #ccc;
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.7rem 0.9rem;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 8px;
    color: var(--white);
    font-family: inherit;
    font-size: 0.95rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--gold);
}

.form-group select option { color: var(--ink); }

.form-hint {
    color: #999;
    font-size: 0.8rem;
    margin-top: 0.8rem;
}

.paipan-result {
    background: rgba(255,255,255,0.08);
    padding: 1.8rem;
    border-radius: var(--radius);
    min-height: 300px;
    border: 1px solid rgba(255,255,255,0.1);
    color: #eee;
    overflow-x: auto;
    font-size: 0.9rem;
    white-space: pre-wrap;
}

.result-placeholder { color: #888; text-align: center; padding: 4rem 0; }

/* ============ 套餐 ============ */
.pricing { background: var(--paper); }

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 2rem;
    max-width: 1000px;
    margin: 0 auto;
}

.pricing-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2.2rem 1.8rem;
    text-align: center;
    transition: transform 0.3s;
    position: relative;
}

.pricing-card:hover { transform: translateY(-6px); }

.pricing-card.featured {
    border: 2px solid var(--gold);
    box-shadow: 0 10px 40px rgba(201,162,39,0.2);
}

.pricing-card.featured::before {
    content: '★ 熱門';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--gold);
    color: var(--white);
    padding: 0.3rem 1.2rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
}

.pricing-name { font-size: 1.3rem; color: var(--ink); font-weight: 900; margin-bottom: 0.8rem; }
.pricing-points { color: var(--text-light); margin-bottom: 1rem; }
.pricing-price { font-size: 2.5rem; color: var(--gold-dark); font-weight: 900; margin-bottom: 1.5rem; }
.pricing-price span { font-size: 1rem; color: var(--text-light); font-weight: 400; }

/* ============ Footer ============ */
.footer {
    background: var(--ink);
    color: #999;
    text-align: center;
    padding: 2.5rem 2rem;
    font-size: 0.9rem;
}

.footer p { margin-bottom: 0.5rem; }

.disclaimer { font-size: 0.8rem; color: #777; }

/* ============ Modal ============ */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.modal.active { display: flex; }

.modal-content {
    background: var(--paper);
    padding: 2.5rem;
    border-radius: 16px;
    max-width: 420px;
    width: 90%;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content.modal-lg { max-width: 560px; }

.modal-content h2 {
    color: var(--ink);
    margin-bottom: 1.5rem;
    text-align: center;
    font-weight: 900;
}

.modal-close {
    position: absolute;
    top: 1rem; right: 1.2rem;
    font-size: 1.6rem;
    color: var(--text-light);
    cursor: pointer;
    transition: color 0.3s;
}

.modal-close:hover { color: var(--red); }

.modal-content .form-group label { color: var(--text); }
.modal-content .form-group input,
.modal-content .form-group select,
.modal-content .form-group textarea {
    background: var(--white);
    border-color: #ddd;
    color: var(--text);
}

.modal-switch {
    text-align: center;
    margin-top: 1.2rem;
    font-size: 0.9rem;
    color: var(--text-light);
}

.modal-switch a { color: var(--gold-dark); font-weight: 700; }

.points-hint {
    text-align: center;
    color: var(--gold-dark);
    font-weight: 700;
    font-size: 0.9rem;
    margin-top: 0.8rem;
}

#ask-result {
    margin-top: 1rem;
    max-height: 300px;
    overflow-y: auto;
    background: var(--ink);
    color: #eee;
    padding: 1rem;
    border-radius: 8px;
    font-size: 0.8rem;
    white-space: pre-wrap;
    display: none;
}

/* ============ 響應式 ============ */
@media (max-width: 900px) {
    .paipan-container { grid-template-columns: 1fr; }
    .hero-title { font-size: 2.5rem; }
    .navbar { padding: 0.8rem 1.2rem; }
    .nav-links { display: none; }
    .hero-stats { gap: 2rem; }
    section { padding: 3.5rem 1.2rem; }
}

@media (max-width: 600px) {
    .hero-title { font-size: 2rem; }
    .hero-actions { flex-direction: column; align-items: center; }
    .stat-num { font-size: 1.6rem; }
    .pricing-grid { grid-template-columns: 1fr; }
}

/* 登入後狀態 */
.user-badge {
    background: var(--gold);
    color: var(--ink);
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
}

.points-badge {
    background: rgba(255,255,255,0.15);
    color: var(--gold-light);
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
}

.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--ink);
    color: var(--white);
    padding: 0.9rem 1.8rem;
    border-radius: 8px;
    z-index: 3000;
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
    display: none;
    animation: slideUp 0.3s ease;
}

.toast.show { display: block; }

@keyframes slideUp {
    from { transform: translateX(-50%) translateY(20px); opacity: 0; }
    to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

.toast.success { border-left: 4px solid #4caf50; }
.toast.error { border-left: 4px solid var(--red); }

/* ============ 會員中心 ============ */
.member-section {
    background: var(--paper-dark);
    display: none;
}

.member-container {
    max-width: 1000px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 1.8rem;
}

.member-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.8rem;
    border-top: 3px solid var(--gold);
}

.member-card h3 {
    color: var(--ink);
    font-size: 1.15rem;
    margin-bottom: 1.2rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid #eee;
}

.member-wide { grid-column: span 1; }

.profile-row {
    display: flex;
    justify-content: space-between;
    padding: 0.7rem 0;
    border-bottom: 1px dashed #eee;
}

.profile-row:last-child { border-bottom: none; }
.profile-row span { color: var(--text-light); }
.profile-row strong { color: var(--ink); }

.points-highlight {
    color: var(--gold-dark) !important;
    font-size: 1.3rem;
    font-weight: 900;
}

.question-item, .order-item {
    background: var(--paper);
    padding: 1rem 1.2rem;
    border-radius: 8px;
    margin-bottom: 0.8rem;
    border-left: 3px solid var(--gold);
}

.question-item .q-type {
    color: var(--gold-dark);
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
}

.question-item .q-text {
    color: var(--text);
    font-size: 0.95rem;
    margin-bottom: 0.3rem;
}

.question-item .q-meta {
    color: var(--text-light);
    font-size: 0.78rem;
}

.order-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left-color: #4caf50;
}

.order-item .o-plan { font-weight: 700; color: var(--ink); }
.order-item .o-meta { color: var(--text-light); font-size: 0.8rem; }
.order-item .o-status {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 0.2rem 0.8rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 700;
}

.order-item .o-status.pending {
    background: #fff3e0;
    color: #e65100;
}

.empty-hint {
    color: var(--text-light);
    text-align: center;
    padding: 2rem 0;
    font-size: 0.9rem;
}

@media (max-width: 900px) {
    .member-container { grid-template-columns: 1fr; }
}

/* ============ 支付 ============ */
.payment-plan-info {
    text-align: center;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gold-dark);
    margin-bottom: 1.2rem;
    padding: 0.8rem;
    background: var(--paper-dark);
    border-radius: 8px;
}

.stripe-element {
    background: var(--white);
    padding: 0.8rem;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.stripe-errors {
    color: var(--red);
    font-size: 0.85rem;
    margin: 0.5rem 0;
    min-height: 1.2em;
}

.payment-status {
    margin-top: 1rem;
    padding: 0.8rem;
    border-radius: 8px;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 700;
    display: none;
}

.payment-status.success {
    display: block;
    background: #e8f5e9;
    color: #2e7d32;
}

.payment-status.error {
    display: block;
    background: #fdecea;
    color: var(--red);
}
