/* 紫微斗数排盘运势系统 - 样式 */

:root {
    --primary-color: #8b5cf6;
    --primary-dark: #7c3aed;
    --secondary-color: #f59e0b;
    --bg-color: #faf5ff;
    --card-bg: #ffffff;
    --text-color: #1f2937;
    --text-light: #6b7280;
    --border-color: #e5e7eb;
    --success-color: #10b981;
    --error-color: #ef4444;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    text-align: center;
    padding: 30px 0;
    position: relative;
}

.logo {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 15px;
}

.app-icon {
    width: 80px;
    height: 80px;
    border-radius: 18px;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.3);
}

.logo-icon {
    font-size: 60px;
    display: none;
}

.header h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.subtitle {
    color: var(--text-light);
    font-size: 1.1rem;
}

.back-link {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.95rem;
}

.back-link:hover {
    text-decoration: underline;
}

/* Main */
.main {
    flex: 1;
}

/* Form */
.form {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.1);
}

.form-group {
    margin-bottom: 24px;
}

.form-group.row {
    display: flex;
    gap: 15px;
}

.form-group.row .col {
    flex: 1;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-color);
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

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

/* Radio Group */
.radio-group {
    display: flex;
    gap: 20px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.radio-label input[type="radio"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary-color);
}

.radio-label span {
    font-size: 1rem;
}

/* Time Inputs */
.time-inputs {
    display: flex;
    gap: 12px;
}

.time-inputs select {
    flex: 1;
}

/* Package Options */
.package-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.package-option {
    cursor: pointer;
}

.package-option input {
    display: none;
}

.package-content {
    display: flex;
    align-items: center;
    padding: 16px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    transition: all 0.3s;
}

.package-option input:checked+.package-content {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.05), rgba(245, 158, 11, 0.05));
}

.package-name {
    font-weight: 600;
    font-size: 1.1rem;
    flex: 1;
}

.package-desc {
    color: var(--text-light);
    font-size: 0.9rem;
    flex: 2;
}

.package-price {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--secondary-color);
}

/* Buttons */
.btn-primary {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Sections */
.section {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
}

.section h2 {
    font-size: 1.4rem;
    color: var(--primary-color);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-desc {
    color: var(--text-light);
    margin-bottom: 16px;
}

/* Pan Display */
.pan-display {
    overflow-x: auto;
}

.pan-info {
    background: linear-gradient(135deg, #f3e8ff, #fef3c7);
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.pan-info p {
    margin: 6px 0;
    font-size: 0.95rem;
}

/* Palaces Grid */
.palaces-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.palace-card {
    background: #f9fafb;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px;
    text-align: center;
    font-size: 0.85rem;
}

.palace-card.ming-gong {
    background: linear-gradient(135deg, #ede9fe, #f3e8ff);
    border-color: var(--primary-color);
}

.palace-name {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.palace-ganzhi {
    color: var(--text-light);
    font-size: 0.8rem;
    margin-bottom: 4px;
}

.palace-stars {
    color: var(--text-color);
    font-size: 0.75rem;
    line-height: 1.4;
}

/* Reading Content */
.reading-content {
    background: #f9fafb;
    padding: 24px 28px;
    border-radius: 12px;
    line-height: 1.9;
    font-size: 0.95rem;
    color: #2d3748;
}

.reading-content h3 {
    font-size: 1.15rem;
    color: var(--primary-color);
    margin: 28px 0 14px 0;
    padding: 8px 0 8px 14px;
    border-left: 4px solid var(--primary-color);
    background: linear-gradient(90deg, rgba(139, 92, 246, 0.06), transparent);
    border-radius: 0 6px 6px 0;
}

.reading-content h3:first-child {
    margin-top: 0;
}

.reading-content h4 {
    font-size: 1.05rem;
    color: #4a3a6b;
    margin: 20px 0 10px 0;
    padding-left: 12px;
    border-left: 3px solid var(--secondary-color);
}

.reading-content h5 {
    font-size: 0.98rem;
    color: #5a4a7a;
    margin: 16px 0 8px 0;
}

.reading-content p {
    margin: 10px 0;
    text-indent: 2em;
    text-align: justify;
}

.reading-content strong {
    color: #1a1035;
    font-weight: 700;
}

.reading-content ul,
.reading-content ol {
    margin: 10px 0 10px 1.5em;
    padding: 0;
}

.reading-content ul {
    list-style: none;
}

.reading-content ul li {
    position: relative;
    padding-left: 1.2em;
    margin-bottom: 6px;
}

.reading-content ul li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-weight: bold;
}

.reading-content ol li {
    margin-bottom: 6px;
    padding-left: 0.3em;
}

.reading-content hr {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(139,92,246,0.25), transparent);
    margin: 24px 0;
}

.reading-content em {
    color: var(--primary-dark);
    font-style: normal;
    border-bottom: 1px dashed var(--primary-color);
}

/* Reading Options */
.reading-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.reading-option {
    background: #f9fafb;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s;
}

.reading-option:hover {
    border-color: var(--primary-color);
}

.option-icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

.option-title {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 6px;
}

.option-desc {
    color: var(--text-light);
    font-size: 0.85rem;
    margin-bottom: 12px;
}

.option-price {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--secondary-color);
    margin-bottom: 12px;
}

.btn-buy,
.btn-read {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin: 4px;
}

.btn-buy {
    background: var(--secondary-color);
    color: white;
}

.btn-buy:hover:not(:disabled) {
    background: #d97706;
}

.btn-buy:disabled {
    background: var(--success-color);
    cursor: default;
}

.btn-read {
    background: var(--primary-color);
    color: white;
}

.btn-read:hover {
    background: var(--primary-dark);
}

/* Overview Paywall */
.overview-paywall {
    text-align: center;
    padding: 32px 20px;
    background: linear-gradient(135deg, #f3e8ff, #fef3c7);
    border-radius: 12px;
    border: 2px dashed var(--primary-color);
}

.paywall-hint {
    color: var(--text-color);
    font-size: 1rem;
    margin-bottom: 20px;
    line-height: 1.6;
}

.btn-buy-overview {
    display: inline-block;
    padding: 14px 36px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.35);
}

.btn-buy-overview:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.45);
}

/* Reading Result (reuse reading-content styles) */
.reading-result-content {
    background: #f9fafb;
    padding: 24px 28px;
    border-radius: 12px;
    line-height: 1.9;
    font-size: 0.95rem;
    color: #2d3748;
}

.reading-result-content h3,
.reading-result-content h4,
.reading-result-content h5,
.reading-result-content p,
.reading-result-content strong,
.reading-result-content ul,
.reading-result-content ol,
.reading-result-content li,
.reading-result-content hr,
.reading-result-content em {
    /* 继承 .reading-content 的样式 */
}

.reading-result-content h3 {
    font-size: 1.15rem;
    color: var(--primary-color);
    margin: 28px 0 14px 0;
    padding: 8px 0 8px 14px;
    border-left: 4px solid var(--primary-color);
    background: linear-gradient(90deg, rgba(139, 92, 246, 0.06), transparent);
    border-radius: 0 6px 6px 0;
}

.reading-result-content h3:first-child { margin-top: 0; }

.reading-result-content h4 {
    font-size: 1.05rem;
    color: #4a3a6b;
    margin: 20px 0 10px 0;
    padding-left: 12px;
    border-left: 3px solid var(--secondary-color);
}

.reading-result-content p {
    margin: 10px 0;
    text-indent: 2em;
    text-align: justify;
}

.reading-result-content strong { color: #1a1035; font-weight: 700; }

.reading-result-content ul,
.reading-result-content ol { margin: 10px 0 10px 1.5em; padding: 0; }

.reading-result-content ul { list-style: none; }

.reading-result-content ul li {
    position: relative;
    padding-left: 1.2em;
    margin-bottom: 6px;
}

.reading-result-content ul li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: var(--primary-color);
    font-weight: bold;
}

.reading-result-content ol li { margin-bottom: 6px; padding-left: 0.3em; }

.reading-result-content hr {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(139,92,246,0.25), transparent);
    margin: 24px 0;
}

.error {
    color: var(--error-color);
}

/* Footer */
.footer {
    text-align: center;
    padding: 30px 0;
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 600px) {
    .palaces-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .reading-options {
        grid-template-columns: 1fr;
    }

    .header h1 {
        font-size: 2rem;
    }

    .package-content {
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }
}

/* Mode Switch */
.mode-switch {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.mode-btn {
    padding: 12px 24px;
    border: 2px solid var(--primary-color);
    background: white;
    color: var(--primary-color);
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.mode-btn.active {
    background: var(--primary-color);
    color: white;
}

.mode-form {
    display: none !important;
}

.mode-form.active {
    display: block !important;
}

/* Chat Mode */
.chat-container {
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.1);
    overflow: hidden;
    height: 500px;
    display: flex;
    flex-direction: column;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chat-message {
    display: flex;
    gap: 10px;
    max-width: 85%;
}

.chat-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.chat-message.user .chat-avatar {
    background: linear-gradient(135deg, #10b981, #059669);
}

.chat-content {
    background: #f3f4f6;
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.6;
}

.chat-message.user .chat-content {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
}

.chat-content .example {
    background: rgba(139, 92, 246, 0.1);
    padding: 8px 12px;
    border-radius: 8px;
    margin: 8px 0;
    font-size: 0.9rem;
    color: var(--primary-color);
}

.chat-input-container {
    display: flex;
    gap: 10px;
    padding: 15px;
    border-top: 1px solid var(--border-color);
    background: white;
}

.chat-input-container input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 25px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
}

.chat-input-container input:focus {
    border-color: var(--primary-color);
}

.btn-send {
    padding: 12px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-send:hover {
    background: var(--primary-dark);
}

.btn-send:disabled {
    background: var(--text-light);
    cursor: not-allowed;
}

.chat-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-light);
    font-size: 0.9rem;
}

.chat-loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 16px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.modal-content h3 {
    margin-bottom: 20px;
    color: var(--primary-color);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
}

.btn-cancel {
    padding: 10px 20px;
    background: #f3f4f6;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.btn-submit {
    padding: 10px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

/* Processing Page */
.processing-page {
    display: flex;
    justify-content: center;
    padding: 20px 0;
}

.processing-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 8px 32px rgba(139, 92, 246, 0.15);
    text-align: center;
    max-width: 600px;
    width: 100%;
}

.processing-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    animation: pulse 2s ease-in-out infinite;
}

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

.processing-card h2 {
    color: var(--primary-color);
    margin-bottom: 16px;
    font-size: 1.5rem;
}

.processing-desc {
    color: var(--text-light);
    margin-bottom: 24px;
    line-height: 1.8;
}

.reading-info {
    background: linear-gradient(135deg, #f3e8ff, #fef3c7);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 24px;
    text-align: left;
}

.reading-info p {
    margin: 8px 0;
    font-size: 0.95rem;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-badge.processing {
    background: #fef3c7;
    color: #d97706;
}

.status-badge.completed {
    background: #d1fae5;
    color: #059669;
}

.status-badge.failed {
    background: #fee2e2;
    color: #dc2626;
}

.pan-preview {
    background: #f9fafb;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 24px;
    text-align: left;
}

.pan-preview h3 {
    font-size: 1rem;
    color: var(--primary-color);
    margin-bottom: 12px;
}

.pan-preview p {
    margin: 6px 0;
    font-size: 0.9rem;
}

.reading-list {
    background: #f9fafb;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 24px;
    text-align: left;
}

.reading-list h3 {
    font-size: 1rem;
    color: var(--primary-color);
    margin-bottom: 12px;
}

.reading-list ul {
    list-style: none;
    padding: 0;
}

.reading-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    background: white;
}

.reading-list li.current {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(245, 158, 11, 0.1));
    border: 1px solid var(--primary-color);
}

.reading-name {
    font-weight: 600;
    flex: 1;
}

.reading-status {
    font-size: 0.8rem;
    padding: 4px 10px;
    border-radius: 12px;
}

.reading-status.completed {
    background: #d1fae5;
    color: #059669;
}

.reading-status.processing {
    background: #fef3c7;
    color: #d97706;
}

.reading-status.pending {
    background: #e0e7ff;
    color: #4f46e5;
}

.reading-time {
    font-size: 0.8rem;
    color: var(--text-light);
}

.btn-check {
    margin-bottom: 16px;
}