/* --- 全域與基本設定 --- */
body {
    background: #f7f7f7;
    font-family: "Microsoft JhengHei", "PingFang TC", Arial, sans-serif;
    color: #333;
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

.container {
    max-width: 900px;
    margin: 40px auto;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 6px 36px rgba(0, 0, 0, 0.1);
    padding: 38px 28px;
}

/* --- 頁首 --- */
.header {
    text-align: center;
    margin-bottom: 26px;
    border-bottom: 1.5px solid #f0e9e9;
    padding-bottom: 20px;
}

.header h1 {
    font-size: 2.1rem;
    color: #a02c2c;
    letter-spacing: 2px;
    margin: 0 0 10px 0;
}

.header p {
    color: #666;
    font-size: 1.08rem;
    margin: 0;
}

/* --- 卡片與區塊 --- */
.card {
    background: #faf6f2;
    border-radius: 12px;
    padding: 30px 22px;
    margin-bottom: 30px;
}

.form-section, .analysis-section, .loading-section {
    display: none; /* 預設隱藏 */
}

/* --- 選項按鈕 --- */
.options {
    display: flex;
    gap: 30px;
    justify-content: center;
    margin-bottom: 20px;
}

.option {
    background: #fff;
    border: 2px solid #e7d7d7;
    border-radius: 10px;
    flex: 1 1 0;
    min-width: 210px;
    max-width: 300px;
    text-align: center;
    padding: 25px 12px;
    cursor: pointer;
    transition: box-shadow 0.3s, border-color 0.3s, transform 0.3s;
}

.option:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(160, 44, 44, 0.12);
    border-color: #a02c2c;
}

.option-icon {
    font-size: 2.8rem;
    margin-bottom: 14px;
    color: #a02c2c;
}

/* --- 表單元素 --- */
.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.form-group {
    flex: 1 1 0;
    min-width: 180px;
    margin-bottom: 10px;
}

.form-group label {
    display: block;
    margin-bottom: 7px;
    font-weight: 500;
    color: #a02c2c;
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1.5px solid #d8cfcf;
    border-radius: 7px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.form-group input:focus, .form-group select:focus {
    border-color: #a02c2c;
    box-shadow: 0 0 0 3px rgba(160, 44, 44, 0.1);
}

.form-tip {
    color: #a02c2c;
    font-size: 0.9em;
    margin-left: 8px;
}

.radio-group {
    display: flex;
    gap: 24px;
    align-items: center;
    margin-top: 10px;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 12px;
    border-radius: 6px;
    border: 1.5px solid #e7d7d7;
    background: #f7f2ed;
    transition: border-color 0.2s, background-color 0.2s;
    cursor: pointer;
    font-size: 1.02rem;
}

.radio-option input[type="radio"] {
    accent-color: #a02c2c;
    width: 18px;
    height: 18px;
}

.radio-option:hover, .radio-option input[type="radio"]:checked + span {
    border-color: #a02c2c;
    background: #fff7f0;
}

.calendar-tip {
    color: #888;
    font-size: 0.9rem;
    margin-top: 8px;
    padding-left: 3px;
}

.form-actions {
    text-align: right;
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* --- 按鈕 --- */
.btn {
    background: linear-gradient(90deg, #a02c2c 0%, #d88e4e 100%);
    color: #fff;
    border: none;
    border-radius: 7px;
    padding: 10px 30px;
    font-size: 1.08rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
}

.btn:hover {
    background: linear-gradient(90deg, #d88e4e 0%, #a02c2c 100%);
    transform: translateY(-2px);
}

.btn-secondary {
    background: #e9e4e0;
    color: #a02c2c;
}

.btn-print, .btn-image {
    background: #fff;
    color: #a02c2c;
    border: 2px solid #a02c2c;
    border-radius: 7px;
    padding: 8px 18px;
    font-size: 1.01rem;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.btn-print:hover, .btn-image:hover {
    background: #a02c2c;
    color: #fff;
}

/* --- 讀取中動畫 --- */
.loading-section {
    text-align: center;
    padding: 80px 0;
    color: #a02c2c;
}
.loading-section h2 {
    letter-spacing: 2px;
    font-size: 1.5rem;
}
.spinner {
    margin: 20px auto;
    border: 6px solid #f3f3f3;
    border-top: 6px solid #a02c2c;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1.5s linear infinite;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- 分析結果 --- */
.analysis-section {
    position: relative;
    border: 1px solid #e0d8d8;
}

.analysis-title {
    text-align: center;
    color: #8b0000;
    margin-bottom: 30px;
}

.analysis-content {
    display: flex;
    gap: 34px;
    flex-wrap: wrap;
}

.user-info, .analysis-result {
    flex: 1 1 0;
    min-width: 270px;
}

.user-info h3, .analysis-result h3 {
    color: #a02c2c;
    margin-top: 0;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #f0e6e6;
}

.info-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 1.01rem;
    padding: 5px 0;
    border-bottom: 1px dashed #e9e0e0;
}
.info-item span:first-child {
    font-weight: 500;
    color: #555;
}
.info-item span:last-child {
    color: #111;
}

.recommendation-box {
    background: #fdf8f0;
    padding: 15px;
    border-radius: 8px;
    margin: 20px 0;
    border-left: 4px solid #d88e4e;
}

.recommendation-title {
    color: #8b0000;
    margin: 20px 0 10px;
}
.recommendation-box .recommendation-title {
    margin-top: 0;
}

.materials {
    display: flex;
    gap: 16px;
    margin: 13px 0 20px 0;
    flex-wrap: wrap;
}

.material {
    background: #fff;
    border-radius: 8px;
    padding: 8px 18px;
    font-size: 1.05rem;
    color: #a02c2c;
    cursor: pointer;
    border: 2px solid #e3d6c8;
    transition: border-color 0.2s, background-color 0.2s, transform 0.2s;
}

.material:hover {
    border-color: #a02c2c;
    background: #fff7f0;
    transform: translateY(-2px);
}

.result-actions {
    text-align: right;
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

/* --- 頁尾 --- */
.contact-info {
    background: #fff;
    border-radius: 10px;
    padding: 25px 20px;
    font-size: 1.03rem;
    color: #444;
}

.contact-info h3 {
    color: #a02c2c;
    margin: 0 0 13px 0;
}
.contact-info p {
    margin: 5px 0;
}
.contact-info a {
    color: #d88e4e;
    text-decoration: none;
}
.contact-info a:hover {
    text-decoration: underline;
}

.payment-shipping {
    margin-top: 15px;
    font-size: 0.9rem;
    opacity: 0.8;
    border-top: 1px solid #eee;
    padding-top: 15px;
}

/* --- 列印與RWD --- */

/* --- MODIFIED: 更新列印浮水印 --- */
@media print {
    body * { visibility: hidden !important; }
    #analysisSection, #analysisSection * { visibility: visible !important; }
    #analysisSection {
        position: absolute !important;
        left: 0; top: 0;
        width: 100vw;
        background: #fff !important;
        box-shadow: none !important;
        z-index: 9999;
        margin: 0; padding: 20px;
        border: none !important;
    }
    .form-actions, .result-actions { display: none !important; }
    
    #analysisSection::after {
        /* 使用 \A 換行，並設定 white-space: pre-wrap */
        content: "好印相印章工作室\Ahttps://guoai888.com";
        white-space: pre-wrap; /* 讓換行符生效 */
        text-align: center;
        line-height: 1.4;
        position: fixed;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%) rotate(-20deg);
        color: rgba(160, 44, 44, 0.08); /* 顏色調淡避免干擾閱讀 */
        font-size: 3rem;
        font-weight: bold;
        pointer-events: none;
        user-select: none;
        z-index: -1;
        letter-spacing: 4px;
    }
}

@media (max-width: 900px) {
    .container { padding: 18px 4vw; margin: 20px auto; }
    .analysis-content { flex-direction: column; gap: 20px; }
}

@media (max-width: 600px) {
    .container { padding: 9px 1vw; }
    .card { padding: 20px 4vw; }
    .options { flex-direction: column; gap: 14px; align-items: center; }
    .form-row { flex-direction: column; gap: 10px; margin-bottom: 10px; }
    .form-actions { flex-direction: column-reverse; }
    .btn, .btn-secondary { width: 100%; text-align: center; }
}