/* 表单相关 CSS 样式 */

/* 八字起名表单样式 */
.naming-form-card {
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    padding: 24px;
    margin-bottom: 20px;
    border: 1px solid #f0e6d2;
    width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.naming-form-header {
    color: #8c6d31;
    font-size: 1.4rem;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px dashed #e0d6c2;
    display: flex;
    align-items: center;
}

.naming-form-header i {
    margin-right: 10px;
    font-size: 1.6rem;
}

.form-group {
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-group label {
    display: inline-block;
    margin-bottom: 0;
    color: #8c6d31;
    font-weight: 500;
    font-size: 0.95rem;
    white-space: nowrap;
    min-width: 19px;
    flex-shrink: 0;
}

.form-group .radio-group {
    display: flex;
    gap: 6px; /* 原来为12px，缩小50% */
    flex: 1;
}

.form-group .radio-item {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.form-group .radio-item input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #8c6d31;
}

.form-group .radio-item label {
    margin-bottom: 0;
    cursor: pointer;
    color: #555;
    font-weight: normal;
    white-space: nowrap;
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group select {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #e0d6c2;
    border-radius: 6px;
    font-size: 0.95rem;
    color: #333;
    background-color: #fff;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-group input[type="text"]:focus,
.form-group input[type="date"]:focus,
.form-group select:focus {
    outline: none;
    border-color: #8c6d31;
    box-shadow: 0 0 0 3px rgba(140, 109, 49, 0.1);
}

.form-group input[type="text"]::placeholder {
    color: #999;
}

/* 覆盖浏览器自动填充的背景色 */
.form-group input[type="text"]:-webkit-autofill,
.form-group input[type="text"]:-webkit-autofill:hover,
.form-group input[type="text"]:-webkit-autofill:focus,
.form-group input[type="text"]:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px #fff inset !important;
    box-shadow: 0 0 0 30px #fff inset !important;
    -webkit-text-fill-color: #333 !important;
    background-color: #fff !important;
}

.form-group select {
    cursor: pointer;
}

.form-group.hidden {
    display: none;
}

.submit-btn {
    width: 100%;
    padding: 12px 24px;
    background-color: #8c6d31;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    margin-top: 10px;
}

.submit-btn:hover {
    background-color: #7a5d28;
    transform: translateY(-2px);
}

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

/* 出生日期滚轮选择器样式（参照日历选择器.html） */
.date-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
}

.date-input {
    width: 100%;
    padding: 10px 36px 10px 10px;
    border: 1px solid #e0d6c2;
    border-radius: 6px;
    font-size: 0.95rem;
    color: #333;
    background-color: #fff;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.date-input::placeholder {
    color: #999;
}

.date-input:focus {
    outline: none;
    border-color: #8c6d31;
    box-shadow: 0 0 0 3px rgba(140, 109, 49, 0.1);
}

/* 覆盖浏览器自动填充的背景色 */
.date-input:-webkit-autofill,
.date-input:-webkit-autofill:hover,
.date-input:-webkit-autofill:focus,
.date-input:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 30px #fff inset !important;
    box-shadow: 0 0 0 30px #fff inset !important;
    -webkit-text-fill-color: #333 !important;
    background-color: #fff !important;
}

.calendar-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    cursor: pointer;
    color: #8c6d31;
}

.picker-modal {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    background-color: #fff;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
}

.picker-modal.active {
    transform: translateY(0);
}

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.45);
    z-index: 999;
    display: none;
    backdrop-filter: blur(2px);
}

.modal-backdrop.active {
    display: block;
}

/* 加载等待模态框样式 */
#loadingModal {
    z-index: 2000;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    cursor: default;
}

#loadingModal.active {
    display: flex;
}

.modal-content {
    background: #fff;
    border-radius: 12px;
    padding: 40px 50px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    min-width: 280px;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    margin: 0 auto 20px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #8c6d31;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-text {
    color: #666;
    font-size: 1rem;
    margin: 0;
}

/* 模态框打开时禁止页面滚动 */
body.modal-open {
    overflow: hidden !important;
    position: fixed !important;
    width: 100% !important;
    height: 100% !important;
}

/* 移动端加载模态框样式 */
@media (max-width: 768px) {
    .modal-content {
        padding: 30px 30px;
        min-width: 240px;
    }

    .loading-spinner {
        width: 40px;
        height: 40px;
        border-width: 3px;
        margin-bottom: 16px;
    }

    .loading-text {
        font-size: 0.9rem;
    }
}

.picker-header {
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee2cf;
}

.picker-title {
    font-size: 16px;
    font-weight: 600;
    color: #8c6d31;
}

.picker-actions {
    display: flex;
    gap: 8px;
}

.picker-btn {
    padding: 6px 14px;
    border-radius: 6px;
    border: none;
    font-size: 0.9rem;
    cursor: pointer;
}

.picker-cancel {
    background: #f5f5f5;
    color: #666;
}

.picker-confirm {
    background: #8c6d31;
    color: #fff;
}

.calendar-info {
    padding: 10px 16px;
    text-align: center;
    font-size: 0.95rem;
    color: #555;
    border-bottom: 1px solid #eee2cf;
}

.wheel-wrapper {
    display: flex;
    height: 220px;
    position: relative;
    overflow: hidden;
    padding: 0 6px 10px;
}

.wheel-column {
    flex: 1;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}

.wheel-scroll {
    list-style: none;
    position: absolute;
    width: 100%;
    top: 90px;
    transition: transform 0.1s ease-out;
    padding: 0;
    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}

.wheel-item {
    height: 36px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.95rem;
    color: #888;
    -webkit-user-select: none;
    user-select: none;
    pointer-events: none;
}

.wheel-item.active {
    color: #8c6d31;
    font-weight: 600;
}

.wheel-mask {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 100%;
    pointer-events: none;
    background: linear-gradient(to bottom,
        rgba(255,255,255,0.9) 0%,
        rgba(255,255,255,0) 25%,
        rgba(255,255,255,0) 75%,
        rgba(255,255,255,0.9) 100%);
    z-index: 10;
}

.wheel-highlight {
    position: absolute;
    top: 90px;
    left: 6px;
    right: 6px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid rgba(140, 109, 49, 0.35);
    background: rgba(242, 232, 211, 0.4);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    pointer-events: none;
    z-index: 11;
}

/* 移动端响应式样式 */
@media (max-width: 768px) {
    .naming-form-card {
        width: 100%;
        padding: 18px;
    }

    .naming-form-header {
        font-size: 1.2rem;
    }

    /* 移动端表单字段保持一行显示，但调整间距 */
    .form-group {
        gap: 8px;
    }

    .form-group label {
        min-width: 19px;
        font-size: 0.9rem;
    }

    .picker-modal {
        max-width: 100%;
    }

    .wheel-column {
        min-width: 0;
    }
}

/* 起名分析相关样式 */
.card-body-content {
    line-height: 1.8;
    color: #555;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* 五行强弱分析条形图样式 */
.wuxing-chart {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 8px 0;
}

.wuxing-chart-item {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 32px;
}

.wuxing-label {
    display: inline-block;
    min-width: 32px;
    font-size: 1rem;
    font-weight: 500;
    color: #333;
    text-align: left;
    flex-shrink: 0;
}

.wuxing-bar-wrapper {
    flex: 1;
    height: 24px;
    background-color: #E0E0E0;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.wuxing-bar-fill {
    height: 100%;
    border-radius: 12px;
    transition: width 0.5s ease, background-color 0.3s ease;
    min-width: 0;
    background-color: transparent;
}

.wuxing-percentage {
    display: inline-block;
    min-width: 60px;
    font-size: 0.95rem;
    color: #555;
    text-align: right;
    flex-shrink: 0;
    font-weight: 500;
}

.naming-suggestions-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.naming-suggestion-item {
    background-color: #faf5eb;
    padding: 16px;
    border-radius: 8px;
    border: 1px solid #e0d6c2;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.naming-suggestion-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.suggestion-name-grid {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    justify-content: flex-start;
    align-items: flex-start;
}

.name-char-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
}

.name-pinyin {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 4px;
    font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
    height: 20px;
    line-height: 20px;
}

.name-char {
    width: 40px;
    height: 40px;
    border: 2px solid #d32f2f;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #333;
    font-weight: 500;
    position: relative;
}

.name-char::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Cdefs%3E%3Cpattern id='grid' width='40' height='40' patternUnits='userSpaceOnUse'%3E%3Cpath d='M 20 0 L 20 40' stroke='%23d32f2f' stroke-width='0.5' stroke-dasharray='1,1' fill='none'/%3E%3Cpath d='M 0 20 L 40 20' stroke='%23d32f2f' stroke-width='0.5' stroke-dasharray='1,1' fill='none'/%3E%3Cpath d='M 0 0 L 40 40' stroke='%23d32f2f' stroke-width='0.5' stroke-dasharray='1,1' fill='none' opacity='0.5'/%3E%3Cpath d='M 40 0 L 0 40' stroke='%23d32f2f' stroke-width='0.5' stroke-dasharray='1,1' fill='none' opacity='0.5'/%3E%3C/pattern%3E%3C/defs%3E%3Crect width='40' height='40' fill='url(%23grid)'/%3E%3C/svg%3E");
    pointer-events: none;
}

.suggestion-name {
    color: #8c6d31;
    font-size: 1.2rem;
    margin-bottom: 8px;
}

.suggestion-wuxing {
    color: #666;
    font-size: 0.95rem;
    margin-bottom: 6px;
}

.suggestion-meaning {
    color: #555;
    font-size: 0.9rem;
    line-height: 1.6;
}

.score-value {
    color: #d32f2f;
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 2px;
}

/* 起名方案每一行详细说明的行间距 */
.suggestion-line {
    margin: 4px 0;
}

@media (max-width: 768px) {
    .naming-suggestions-list {
        gap: 12px;
    }
    
    .naming-suggestion-item {
        padding: 12px;
    }
    
    .suggestion-name-grid {
        gap: 6px;
    }
    
    .name-char-box {
        min-width: 50px;
    }
    
    .name-pinyin {
        font-size: 0.75rem;
        height: 18px;
        line-height: 18px;
    }
    
    .name-char {
        width: 40px;
        height: 40px;
        font-size: 1.3rem;
        border-width: 1.5px;
    }
    
    .name-char::before {
        background-image: 
            url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Cdefs%3E%3Cpattern id='grid-mobile' width='40' height='40' patternUnits='userSpaceOnUse'%3E%3Cpath d='M 20 0 L 20 40' stroke='%23d32f2f' stroke-width='0.5' stroke-dasharray='1,1' fill='none'/%3E%3Cpath d='M 0 20 L 40 20' stroke='%23d32f2f' stroke-width='0.5' stroke-dasharray='1,1' fill='none'/%3E%3Cpath d='M 0 0 L 40 40' stroke='%23d32f2f' stroke-width='0.5' stroke-dasharray='1,1' fill='none' opacity='0.5'/%3E%3Cpath d='M 40 0 L 0 40' stroke='%23d32f2f' stroke-width='0.5' stroke-dasharray='1,1' fill='none' opacity='0.5'/%3E%3C/pattern%3E%3C/defs%3E%3Crect width='40' height='40' fill='url(%23grid-mobile)'/%3E%3C/svg%3E");
    }
    
    .suggestion-name {
        font-size: 1.1rem;
    }
    
    .wuxing-chart {
        gap: 12px;
    }
    
    .wuxing-chart-item {
        gap: 8px;
        min-height: 28px;
    }
    
    .wuxing-label {
        min-width: 28px;
        font-size: 0.95rem;
    }
    
    .wuxing-bar-wrapper {
        height: 20px;
    }
    
    .wuxing-percentage {
        min-width: 55px;
        font-size: 0.9rem;
    }
}
