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

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #8b5cf6;
    --text-color: #1f2937;
    --text-light: #6b7280;
    --bg-color: #f9fafb;
    --card-bg: #ffffff;
    --border-color: #e5e7eb;
    --success-color: #10b981;
    --error-color: #ef4444;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.header {
    text-align: center;
    color: white;
    margin-bottom: 3rem;
}

.header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

.main-content {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
    margin-bottom: 2rem;
}

.prediction-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 0;
}

.form-group label,
.form-label {
    font-weight: 600;
    color: var(--text-color);
    font-size: 1rem;
}

.form-input {
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* 日期时间选择器样式 - 自适应布局 */
.datetime-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: clamp(0.5rem, 2vw, 0.75rem);
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.date-label {
    position: relative;
    display: block;
    cursor: pointer;
    min-width: 0;
    flex: 1 1 min(180px, 100%); /* 空间充足时与时间并排，不足时换行占满 */
    max-width: 100%;
}

.time-label {
    position: relative;
    display: block;
    cursor: pointer;
    min-width: 0;
    flex: 1 1 min(110px, 100%); /* 并排时较窄，换行后占满整行 */
    max-width: 100%;
}

.date-input,
.time-input {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    cursor: pointer;
    padding-right: 2.75rem;
    font-size: clamp(14px, 1.5vw, 1rem);
}

/* 防止 form-group 撑破布局 */
.form-group {
    min-width: 0;
}


/* 隐藏默认日历图标，让整个输入框可点击 */
.date-input::-webkit-calendar-picker-indicator,
.time-input::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0;
    position: absolute;
    right: 0;
    top: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
}

/* 自定义图标 */
.date-icon,
.time-icon {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    z-index: 1;
    font-size: 1.2rem;
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.date-label:hover .date-icon,
.time-label:hover .time-icon {
    opacity: 1;
}

/* 地址选择器样式 */
.address-selector {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

.address-select {
    width: 100%;
    transition: all 0.3s ease;
}

.address-select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: var(--bg-color);
    pointer-events: none; /* 确保禁用状态下无法点击 */
}

.address-select:not(:disabled) {
    cursor: pointer; /* 确保启用状态下可以点击 */
}

.address-select:not(:disabled):hover {
    border-color: var(--primary-color);
}

.address-select:not(:disabled):focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}


/* 下拉选择框样式优化 */
select.form-input {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236366f1' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 12px;
    padding-right: 2.5rem;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

/* 屏幕阅读器专用标签（隐藏但保持可访问性） */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.form-hint {
    color: var(--text-light);
    font-size: 0.875rem;
}

.submit-btn {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 1rem;
    position: relative;
    overflow: hidden;
}

.submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.submit-btn:active:not(:disabled) {
    transform: translateY(0);
}

.submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.customer-service {
    margin-top: 1.5rem;
    padding-top: 1rem;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-light);
}

.customer-service .wechat-id {
    color: var(--primary-color);
    font-weight: 500;
}

/* 任何场景下联系信息均为白色 */
.customer-service,
.customer-service .wechat-id,
.footer .customer-service,
.footer .customer-service .wechat-id {
    color: white !important;
}

.btn-loader {
    display: inline-block;
}

.result-container {
    margin-top: 2rem;
    background: var(--card-bg);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    border: 2px solid var(--border-color);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.result-header h2 {
    color: var(--primary-color);
    font-size: 1.5rem;
}

.header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
}

.close-hint {
    font-size: 0.8rem;
    color: var(--text-light);
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-light);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: var(--bg-color);
    color: var(--text-color);
}

.result-content {
    line-height: 1.8;
    color: var(--text-color);
}

.analysis-content {
    line-height: 1.8;
    color: var(--text-color);
    word-wrap: break-word; /* 长单词换行 */
}

.analysis-content h3 {
    color: var(--primary-color);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-size: 1.2rem;
}

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

.analysis-content pre {
    background: var(--bg-color);
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 1rem 0;
    border: 1px solid var(--border-color);
}

.analysis-content strong {
    font-weight: 600;
    color: var(--primary-dark);
}

.disclaimer {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-light);
    font-size: 0.9rem;
    font-style: italic;
}

/* 支付区域样式 */
.payment-section {
    margin-top: 2rem;
    padding: 2rem;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 12px;
    text-align: center;
    border: 2px dashed var(--primary-color);
}

.payment-prompt {
    margin-bottom: 1.5rem;
}

.payment-prompt p {
    margin: 0.5rem 0;
    color: var(--text-color);
    font-size: 1rem;
}

.payment-amount {
    font-size: 1.5rem !important;
    font-weight: 700 !important;
    color: var(--primary-color) !important;
}

.pay-button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 1rem 2.5rem;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin: 0 auto; /* 确保按钮居中 */
}

.pay-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.pay-button:active:not(:disabled) {
    transform: translateY(0);
}

.pay-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.pay-icon {
    font-size: 1.3rem;
}

.pay-text {
    font-size: 1.1rem;
}

/* 二维码支付区域样式 */
.qr-code-section {
    margin-top: 1rem;
}

.qr-code-hint {
    font-size: 1rem;
    color: var(--text-color);
    margin-bottom: 1rem;
    font-weight: 500;
}

.qr-code-container {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
    background: white;
    border-radius: 12px;
    margin: 1rem 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.qr-code-container img {
    max-width: 300px;
    width: 100%;
    height: auto;
    border: 2px solid var(--border-color);
    border-radius: 8px;
}

.qr-code-tip {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-top: 1rem;
    font-style: italic;
}

.result-content h3 {
    color: var(--primary-color);
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    font-size: 1.2rem;
}

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

.result-content p {
    margin-bottom: 1rem;
    text-align: justify;
}

.result-content pre {
    background: var(--bg-color);
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 1rem 0;
    border: 1px solid var(--border-color);
}

.result-content ul,
.result-content ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.result-content li {
    margin-bottom: 0.5rem;
}

.error-container {
    margin-top: 1rem;
}

.error-message {
    background: #fee2e2;
    color: var(--error-color);
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid var(--error-color);
    animation: slideIn 0.3s ease;
}

.footer {
    text-align: center;
    color: white;
    opacity: 0.8;
    font-size: 0.9rem;
}

/* 模态弹窗样式 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal-content {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 2.5rem;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.3s ease;
}

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

.modal-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.modal-header h3 {
    color: var(--primary-color);
    font-size: 1.5rem;
    margin: 0;
}

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

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.modal-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
}

.modal-btn-cancel {
    background: var(--bg-color);
    color: var(--text-color);
    border: 2px solid var(--border-color);
}

.modal-btn-cancel:hover {
    background: var(--border-color);
}

.modal-btn-confirm {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

.modal-btn-confirm:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.loading-spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto 1.5rem;
    border: 4px solid var(--bg-color);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.modal-message {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.modal-submessage {
    font-size: 0.9rem;
    color: var(--text-light);
    margin: 0;
}

/* 响应式设计 - 手机横屏/小平板 */
@media (max-width: 768px) {
    html, body {
        overflow-x: hidden;
        max-width: 100vw;
    }
    .container {
        padding: 1rem;
        overflow-x: hidden;
    }

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

    .main-content {
        padding: 1.5rem;
        overflow-x: hidden;
    }

    .result-container {
        padding: 1.5rem;
    }
    
    /* 移动端日期时间选择器强制垂直堆叠，占满宽度 */
    .datetime-wrapper {
        flex-direction: column;
        width: 100%;
        overflow: hidden;
    }
    .date-label,
    .time-label {
        flex: 1 1 100%;
        width: 100%;
        max-width: 100%;
    }
    .date-input,
    .time-input {
        width: 100% !important;
        width: -webkit-fill-available;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box;
    }
    .prediction-form {
        overflow-x: hidden;
        max-width: 100%;
    }
    
    /* 移动端地址选择器保持垂直布局 */
    .address-selector {
        grid-template-columns: 1fr;
    }

    /* 移动端输入框：16px 防止 iOS 自动缩放 */
    .date-input,
    .time-input {
        font-size: 16px;
        padding: 0.875rem 1rem;
        padding-right: 3rem;
    }
}

/* 响应式设计 - 小屏手机 */
@media (max-width: 480px) {
    .container {
        padding: 0.75rem;
        overflow-x: hidden;
    }

    .main-content {
        padding: 1rem;
        overflow-x: hidden;
    }

    .form-input {
        padding: 0.75rem 0.875rem;
    }

    /* 日期时间在小屏下确保可点击区域足够，并强制自适应宽度 */
    .date-label,
    .time-label {
        min-height: 44px;
        width: 100%;
        max-width: 100%;
    }

    .date-icon,
    .time-icon {
        right: 0.75rem;
        font-size: 1rem;
    }

    .date-input,
    .time-input {
        padding-right: 2.5rem;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
    }
}

/* 加载动画 */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-right: 8px;
}
