/* --- 1. 全局变量与基础样式 --- */
:root {
    --primary-color: #c52833;
    --primary-color-dark: #9c242c;
    --background-color: #f3f4f6;
    --form-bg-color: #ffffff;
    --text-color: #374151;
    --label-color: #6b7280;
    --border-color: #d1d5db;
    --error-color: #ef4444;
    --disable-color: #e8858c;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
}

/* --- 2. 布局容器 --- */
.form-container,
.thank-you-container,
.download-container,
.message-container {
    background-color: var(--form-bg-color);
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    width: 100%;
    border: 2px solid color-mix(in srgb, var(--primary-color) 66%, transparent);
    max-width: 720px;
    text-align: center;
    box-sizing: border-box;
}

.thank-you-container,
.message-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 2rem;
}

.header-text {
    flex-grow: 1;
    min-width: 0;
}

/* --- 3. 标题与文本 --- */
h1 {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    text-align: left;
}

.subtitle {
    color: var(--label-color);
    margin-bottom: 2rem;
    text-align: left;
}

.subtitle-expo-event {
    color: var(--primary-color);
    margin-bottom: 2rem;
    text-align: left;
}

.header-text h1 {
    margin-top: 0;
    margin-bottom: 0.25rem;
    text-align: left;
}

.header-text p {
    margin: 0;
    text-align: left;
    color: var(--label-color);
    font-size: 0.9rem;
}

/* --- 4. 表单通用样式 --- */
.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--label-color);
}

.required {
    color: var(--error-color);
    margin-left: 2px;
}

.optional-text {
    color: var(--label-color);
    font-weight: normal;
    font-size: 0.8em;
    margin-left: 4px;
}

input[type="text"],
input[type="email"],
input[type="tel"],
textarea {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(109, 40, 217, 0.2);
}

input[readonly] {
    background-color: #f3f4f6;
    color: var(--label-color);
    cursor: default;
}

textarea {
    resize: vertical;
}

.submit-btn {
    width: 100%;
    padding: 0.9rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

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

.submit-btn:disabled {
    background-color: var(--disable-color);
    cursor: not-allowed;
}

/* --- 5. 表单组件样式 --- */

/* 5.1 表单分段 (Legend) */
.form-section {
    border: none;
    padding: 0;
    margin: 0;
}

/* 使用相邻兄弟选择器为非首个 section 添加上边距，形成段落间隔 */
.form-section + .form-section {
    margin-top: 2.5rem;
}

.form-section legend {
    padding: 0;
    font-size: 1.1rem;      /* 减小字号，更柔和 */
    font-weight: 500;       /* 降低字重 */
    color: var(--label-color);/* 使用浅色文字 */
    width: 100%;
}

/* 5.2 手机号与验证码 */
.phone-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.phone-group input {
    flex-grow: 1;
}

.send-code-btn {
    padding: 0.8rem 1rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

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

.send-code-btn:disabled {
    background-color: var(--disable-color);
    cursor: not-allowed;
}

/* 5.3 标签式选择项 (Radio/Checkbox) */
.choice-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.choice-group input[type="radio"],
.choice-group input[type="checkbox"] {
    display: none;
}

.choice-group label {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--label-color);
    background-color: #f9fafb;
    transition: all 0.2s ease-in-out;
    margin-bottom: 0;
}

.choice-group label:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.choice-group input[type="radio"]:checked+label,
.choice-group input[type="checkbox"]:checked+label {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 5.4 隐私政策 */
.privacy-consent {
    margin-top: 2rem;
    text-align: left;
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}

.privacy-consent input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 8px;
    cursor: pointer;
    flex-shrink: 0;
    accent-color: var(--primary-color);
}

.privacy-consent label {
    display: inline;
    margin-bottom: 0;
    font-size: 0.95rem;
    color: var(--text-color);
    cursor: pointer;
}

.privacy-statement {
    font-size: 0.8rem;
    color: var(--label-color);
    line-height: 1.5;
    margin-top: 0;
}

/* --- 6. 特殊组件 --- */

/* 6.1 Toast 通知 */
.toast-notification {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translate(-50%, -100px);
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1000;
    font-size: 0.95rem;
    font-weight: 500;
    opacity: 0;
    visibility: hidden;
    transition: transform 0.4s cubic-bezier(0.21, 1.02, 0.73, 1), opacity 0.4s ease, visibility 0.4s;
    max-width: 90%;
}

.toast-notification.show {
    transform: translate(-50%, 0);
    opacity: 1;
    visibility: visible;
}

.toast-icon {
    font-size: 1.2em;
}

.toast-notification.success {
    background-color: #22c55e;
    color: white;
}

.toast-notification.error {
    background-color: var(--error-color);
    color: white;
}

.toast-notification.info {
    background-color: #3b82f6;
    color: white;
}

/* 6.2 加载动画 (Spinner) */
.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border-left-color: var(--primary-color);
    margin-top: 1.5rem;
    animation: spin 1s ease infinite;
}

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

/* 6.3 抽奖按钮 (展会限定) */
.lottery-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.8rem 1.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    text-decoration: none;
    background: linear-gradient(to bottom, var(--primary-color), var(--primary-color-dark));
    border: 1px solid var(--primary-color-dark);
    border-bottom: 4px solid #801c23;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: transform 0.15s ease-out, box-shadow 0.15s ease-out, filter 0.15s, padding 0.2s, font-size 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.lottery-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 7px 14px rgba(0, 0, 0, 0.12), 0 3px 6px rgba(0, 0, 0, 0.08);
    filter: brightness(1.1);
}

.lottery-btn:active {
    transform: translateY(2px);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    border-bottom-width: 2px;
}

.lottery-btn .fa-gift {
    font-size: 1.2em;
}

/* 6.4 页脚 */
footer {
    background-color: transparent;
    color: #bbb;
    padding: 0px 0;
    text-align: center;
    font-size: 0.4em;
    margin-top: 2rem; /* 与上方元素增加间距 */
}

footer p {
    margin: 0;
}

footer a {
    color: #bbb;
    text-decoration: none;
}

/* --- 7. 下载页面专属样式 --- */
.download-container {
    width: 100%;
    max-width: 1200px;
    min-height: calc(100vh - 40px);
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
}

.file-browser {
    margin-top: 2rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    width: 100%;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.file-browser-header,
.file-item {
    display: flex;
    align-items: center;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.file-browser-header {
    background-color: #f9fafb;
    font-weight: 500;
    color: var(--label-color);
    font-size: 0.9rem;
    flex-shrink: 0;
}

#file-list {
    list-style: none;
    padding: 0;
    margin: 0;
    flex-grow: 1;
    overflow-y: auto;
}

#file-list .file-item:last-child {
    border-bottom: none;
}

.file-item {
    text-decoration: none;
    color: var(--text-color);
    transition: background-color 0.2s;
}

a.file-item:hover {
    background-color: #f3f4f6;
}

.file-icon {
    width: 40px;
    text-align: center;
    font-size: 1.4rem;
    color: #9ca3af;
    flex-shrink: 0;
}

.fa-folder { color: #facc15; }
.fa-file-pdf { color: #f43f5e; }
.fa-file-word { color: #3b82f6; }
.fa-file-excel { color: #22c55e; }
.fa-file-image { color: #84cc16; }
.fa-file-video { color: #ec4899; }
.fa-file-code { color: #60a5fa; }
.fa-file { color: #9ca3af; }
.fa-arrow-turn-up { color: #6b7280; }

.file-name {
    flex: 1;
    padding-left: 1rem;
    word-break: break-word;
}

.file-size {
    width: 100px;
    text-align: right;
    color: var(--label-color);
    font-size: 0.9rem;
    flex-shrink: 0;
}

.file-action {
    width: 60px;
    text-align: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.download-link {
    color: var(--label-color);
    transition: color 0.2s;
}

.download-link:hover {
    color: var(--primary-color);
}

.spinner-container {
    display: flex;
    justify-content: center;
    padding: 2rem;
}

/* --- 8. 响应式设计 --- */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .form-container,
    .thank-you-container,
    .download-container,
    .message-container {
        padding: 1.5rem;
        margin-top: 10px;
        margin-bottom: 10px;
        min-height: calc(100vh - 20px);
    }

    .header-container {
        gap: 1rem;
    }

    .lottery-btn {
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
        gap: 0.4rem;
    }

    .file-size {
        display: none;
    }

    .file-name {
        padding-right: 0.5rem;
    }

    .file-icon {
        font-size: 0.9rem;
        width: 30px;
    }

    .file-action {
        width: 40px;
        font-size: 1rem;
    }

    .file-browser-header,
    .file-item {
        padding: 0.6rem 0.8rem;
    }
}
