/**
 * 小数转分数转换器的样式 - 现代化UI
 */

.pwt-decimal-to-fraction-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    background-color: #ffffff;
}

/* 转换模式选择区域 - 现代化设计 */
.pwt-conversion-mode {
    margin-bottom: 25px;
    padding: 0;
    border-radius: 8px;
}

/* 现代化单选框组 */
.pwt-radio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    background-color: #f0f4f8;
    border-radius: 8px;
    padding: 4px;
    position: relative;
}

/* 自定义单选框标签 */
.pwt-radio-label {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    padding: 12px 15px;
    border-radius: 6px;
    transition: all 0.3s ease;
    text-align: center;
    font-weight: 500;
    z-index: 1;
    margin: 0!important;
}

/* 隐藏原生单选框 */
.pwt-radio-label input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

/* 选中状态样式 */
.pwt-radio-label input[type="radio"]:checked + span {
    color: #4a90e2;
    font-weight: 600;
}

/* 单选框文本 */
.pwt-radio-label span.pwt-radio-text {
    display: inline-block;
    transition: all 0.3s ease;
}

/* 选中状态的背景 */
.pwt-radio-label input[type="radio"]:checked ~ .pwt-radio-background {
    opacity: 1;
}

/* 单选框背景 */
.pwt-radio-background {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ffffff;
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
    z-index: -1;
    opacity: 0;
    transition: all 0.3s ease;
}

/* 工具提示 */
.pwt-tooltip {
    display: none;
    position: absolute;
    background: #333;
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    width: 220px;
    z-index: 20;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

/* 工具提示箭头 */
.pwt-tooltip:after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -8px;
    border-width: 8px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

.pwt-radio-label:hover .pwt-tooltip {
    display: block;
    opacity: 1;
}

/* 输入区域 */
.pwt-input-section {
    margin-bottom: 25px;
    background-color: #ffffff;
    border-radius: 8px;
}

.pwt-form-group {
    margin-bottom: 20px;
    position: relative;
}

.pwt-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
    font-size: 15px;
}

.pwt-input {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #dce1e6;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 15px;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.pwt-input:focus {
    border-color: #4a90e2;
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
    outline: none;
}

.pwt-help-text {
    margin-top: 8px;
    font-size: 13px;
    color: #666;
    line-height: 1.5;
}

/* 滑块样式 */
.pwt-slider {
    width: 100%;
    margin: 15px 0;
    -webkit-appearance: none;
    height: 6px;
    background: #e0e7ee;
    border-radius: 3px;
    outline: none;
}

.pwt-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #4a90e2;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.pwt-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #4a90e2;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    border: none;
}

.pwt-slider::-webkit-slider-thumb:hover {
    background: #3a7bc2;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.pwt-slider::-moz-range-thumb:hover {
    background: #3a7bc2;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.pwt-slider-value-container {
    text-align: center;
    margin-top: 10px;
    position: relative;
}

.pwt-slider-input {
    width: 60px;
    padding: 5px;
    text-align: center;
    font-weight: 500;
    border: 1px solid #dce1e6;
    border-radius: 4px;
    font-size: 14px;
}

.pwt-slider-input:focus {
    border-color: #4a90e2;
    outline: none;
}

/* 渐进分数控制区域 */
.pwt-convergents-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 15px;
    background-color: #f9fafc;
    border-radius: 8px;
    border: 1px solid #eaeef2;
}

/* 按钮区域 */
.pwt-form-buttons {
    display: flex;
    gap: 15px;
    margin-top: 25px;
}

.pwt-button {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #4a90e2;
    color: white;
    box-shadow: 0 2px 5px rgba(74, 144, 226, 0.3);
}

.pwt-button:hover {
    background-color: #3a7bc2;
    box-shadow: 0 4px 8px rgba(74, 144, 226, 0.4);
    transform: translateY(-1px);
}

.pwt-button:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(74, 144, 226, 0.3);
}

.pwt-button-secondary {
    background-color: #f0f4f8;
    color: #4a5568;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.pwt-button-secondary:hover {
    background-color: #e2e8f0;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* 结果区域 */
.pwt-result-container {
    margin-top: 30px;
    padding: 0;
    min-height: 50px;
    transition: all 0.3s ease;
}

/* 错误信息样式 */
.pwt-error-message {
    color: #e53e3e;
    background-color: #fff5f5;
    padding: 15px;
    border-radius: 6px;
    border-left: 4px solid #e53e3e;
    font-size: 14px;
    line-height: 1.5;
}

/* 分数显示样式 */
.pwt-fraction-result {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 10px;
    padding: 15px;
    background-color: #f9fafc;
    border-radius: 8px;
}

.pwt-fraction-container {
    display: inline-flex;
    flex-direction: column;
    text-align: center;
    margin: 0 5px;
}

.pwt-numerator {
    padding: 4px 8px;
    border-bottom: 2px solid #4a5568;
    min-width: 30px;
    text-align: center;
    font-weight: 600;
    font-size: 16px;
}

.pwt-denominator {
    padding: 4px 8px;
    min-width: 30px;
    text-align: center;
    font-weight: 600;
    font-size: 16px;
}

.pwt-integer {
    font-size: 1.3em;
    margin-right: 8px;
    font-weight: 600;
}

.pwt-mixed-fraction {
    display: flex;
    align-items: center;
}

.pwt-negative-sign {
    font-size: 1.3em;
    margin-right: 5px;
    font-weight: 600;
}

/* 转换误差显示 */
.pwt-conversion-error {
    margin-left: 15px;
    color: #718096;
    font-size: 0.9em;
}

/* 渐进分数列表样式 */
.pwt-convergents-results {
    margin-top: 25px;
    padding: 20px;
    background-color: #f9fafc;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.pwt-convergents-results h4 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 18px;
    color: #2d3748;
    padding-bottom: 10px;
    font-weight: 600;
    border-bottom: 1px solid #e2e8f0;
}

.pwt-convergents-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pwt-convergent-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    background-color: #ffffff;
    border: 1px solid #edf2f7;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.pwt-convergent-item:hover {
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.pwt-convergent-error {
    color: #718096;
    font-size: 16px;
    flex: 1;
}

/* 精确值显示区域 */
.pwt-exact-fraction {
    margin-bottom: 25px;
    padding: 20px;
    background-color: #ebf4ff;
    border-radius: 8px;
    border-left: 4px solid #4a90e2;
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.1);
}

.pwt-exact-fraction h4 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 18px;
    color: #2c5282;
    font-weight: 600!important;
}

.pwt-conversion-info.pwt-exact {
    color: #4a90e2;
    font-weight: 600;
    padding: 4px 10px;
    background-color: rgba(74, 144, 226, 0.1);
    border-radius: 4px;
    font-size: 16px;
}

/* 响应式设计 */
@media screen and (max-width: 768px) {
    .pwt-decimal-to-fraction-container {
        padding: 15px;
    }
    
    .pwt-radio-group {
        flex-direction: row;
    }
    
    .pwt-radio-label {
        padding: 10px;
        font-size: 14px;
    }
    
    .pwt-form-buttons {
        flex-direction: row;
    }
    
    .pwt-button {
        flex: 1;
        padding: 10px;
        font-size: 14px;
    }
    
    .pwt-tooltip {
        width: 180px;
    }
}

@media screen and (max-width: 480px) {
    .pwt-radio-group {
        flex-direction: column;
        padding: 3px;
    }
    
    .pwt-radio-label {
        padding: 10px;
        margin-bottom: 3px;
    }
    
    .pwt-form-buttons {
        flex-direction: column;
    }
    
    .pwt-button {
        width: 100%;
    }
    
    .pwt-convergent-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .pwt-fraction-result {
      
    }
    
    .pwt-conversion-error,
    .pwt-convergent-error {
        margin-left: 0;
        margin-top: 8px;
    }
} 

/* 交互状态类 */
.pwt-radio-selected {
    font-weight: 600;
    margin: 0!important;
}

.pwt-input-focused {
    position: relative;
}

.pwt-input-focused:after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: #4a90e2;
    transform: scaleX(0);
    animation: input-focus 0.3s forwards;
}

@keyframes input-focus {
    to {
        transform: scaleX(1);
    }
}

.pwt-button-active {
    transform: scale(0.97) !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
}

.pwt-item-hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
} 