/**
 * 分数计算器样式
 */

.pwt-fraction-calculator-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    max-width: 100%;
    margin-bottom: 20px;
}

/* 文本输入区域样式 */
.pwt-fraction-input-area {
    margin-bottom: 15px;
}

.pwt-fraction-input-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.pwt-fraction-input-header label {
    font-weight: 500;
    margin: 0;
}

.pwt-fraction-help-btn {
    padding: 4px 10px;
    border-radius: 4px;
    background-color: #007bff;
    color: white;
    border: none;
    font-weight: 500;
    cursor: pointer;
    font-size: 13px;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.pwt-fraction-help-btn:hover {
    background-color: #0056b3;
}

.pwt-fraction-input {
    width: 100%;
    height: 80px;
    padding: 5px;
    font-size: 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: vertical;
    font-family: monospace;
}

.pwt-fraction-input.has-error {
    border-color: #dc3545;
    background-color: rgba(220, 53, 69, 0.05);
}

/* 帮助模态窗口样式 */
.pwt-fraction-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}

.pwt-fraction-modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 20px;
    border: 1px solid #ddd;
    border-radius: 5px;
    width: 80%;
    max-width: 800px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.pwt-fraction-modal-close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.pwt-fraction-modal-close:hover,
.pwt-fraction-modal-close:focus {
    color: #333;
    text-decoration: none;
}

.pwt-fraction-help-section {
    margin-bottom: 20px;
}

.pwt-fraction-help-section h4 {
    margin-bottom: 10px;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.pwt-fraction-help-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 10px;
}

.pwt-fraction-help-table th,
.pwt-fraction-help-table td {
    padding: 8px;
    text-align: left;
    border: 1px solid #ddd;
}

.pwt-fraction-help-table th {
    background-color: #f5f5f5;
}

.pwt-fraction-help-notes {
    padding-left: 20px;
    margin: 10px 0;
}

.pwt-fraction-help-notes li {
    margin-bottom: 5px;
}

/* 可视化预览区域样式 */
.pwt-fraction-preview-area {
    margin-bottom: 15px;
}

.pwt-fraction-preview-area label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.pwt-fraction-preview {
    min-height: 50px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #f9f9f9;
    overflow-x: auto;
    font-size: 16px;
    line-height: 1.6;
    white-space: nowrap;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

/* 分数表示样式 */
.pwt-fraction {
    display: inline-block;
    vertical-align: middle;
    text-align: center;
    margin: 0 2px;
}

.pwt-fraction.pwt-negative {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

.pwt-negative-sign {
    display: inline-block;
    vertical-align: middle;
    margin-right: 2px;
    white-space: nowrap;
    line-height: normal;
    font-weight: bold;
}

/* 针对不同情况下的负号样式调整 */
.pwt-fraction .pwt-negative-sign {
    position: relative;
    top: 0;
}

.pwt-mixed-number .pwt-negative-sign {
    position: relative;
    top: 0;
}

/* 确保负号垂直居中 */
.pwt-fraction.pwt-negative,
.pwt-mixed-number.pwt-negative {
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
}

.pwt-fraction-content {
    display: inline-block;
    text-align: center;
}

.pwt-fraction-numerator,
.pwt-fraction-denominator {
    display: block;
    text-align: center;
    line-height: normal;
}

.pwt-fraction-line {
    display: block;
    height: 1px;
    background-color: #000;
    margin: 1px 0;
}

.pwt-mixed-number {
    display: inline-flex;
    align-items: center;
    margin: 0 2px;
}

.pwt-mixed-number.pwt-negative {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

.pwt-mixed-number-content {
    display: inline-flex;
    align-items: center;
}

.pwt-mixed-number-whole {
    margin-right: 3px;
}

/* 按钮面板样式 */
.pwt-fraction-buttons {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.pwt-fraction-panel {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-bottom: 10px;
    background-color: #f9f9f9;
    border-radius: 6px;
    padding: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.pwt-fraction-button-row {
    display: flex;
    gap: 5px;
}

.pwt-fraction-button {
    flex: 1;
    padding: 10px;
    font-size: 16px;
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
    min-width: 40px;
    text-align: center;
    font-weight: 500;
}

.pwt-fraction-button:hover {
    background-color: #e0e0e0;
}

.pwt-fraction-button:active {
    background-color: #d0d0d0;
}

/* 数字区按钮样式 */
.pwt-fraction-number-panel .pwt-fraction-button {
    background-color: #ffffff;
    color: #333;
    font-weight: 600;
    font-size: 19px;
}

.pwt-fraction-button-space {
    font-size: 13px;
    color: #555;
    background-color: #f4f4f4;
}

.pwt-fraction-button-fraction-line {
    font-weight: bold;
    background-color: #e6f2ff;
    color: #0056b3;
}

/* 功能区按钮样式 */
.pwt-fraction-button-operator {
    background-color: #f0f8ff;
    color: #0066cc;
    font-weight: bold;
    font-size: 24px;
}

.pwt-fraction-button-division {
    background-color: #e6f7ff;
    color: #0066cc;
    font-weight: bold;
    font-size: 18px;
}

.pwt-fraction-button-bracket {
    background-color: #f5f5f5;
    color: #555;
}

.pwt-fraction-button-double {
    flex: 2;
}

.pwt-fraction-button-calculate {
    background-color: #4CAF50;
    color: white;
    font-weight: bold;
    font-size: 18px;
}

.pwt-fraction-button-calculate:hover {
    background-color: #45a049;
}

.pwt-fraction-button-clear {
    background-color: #ff9800;
    color: white;
    font-weight: bold;
}

.pwt-fraction-button-clear:hover {
    background-color: #e68a00;
}

/* 结果区域样式 */
.pwt-fraction-result-area {
    margin-bottom: 20px;
}

.pwt-fraction-result-area label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.pwt-fraction-result {
    min-height: 50px;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #f0f8ff;
    font-size: 18px;
    overflow-x: auto;
    display: flex;
    align-items: center;
    white-space: normal;
}

.pwt-fraction-result.error {
    color: #dc3545;
    background-color: rgba(220, 53, 69, 0.05);
}

/* 历史记录区域样式 */
.pwt-fraction-history-area {
    margin-top: 20px;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
}

.pwt-fraction-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.pwt-fraction-history-header label {
    font-weight: 500;
}

.pwt-fraction-button-clear-history {
    padding: 3px 8px;
    font-size: 12px;
    background-color: #dc3545;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}

.pwt-fraction-history {
    max-height: 300px;
    overflow-y: auto;
}

.pwt-fraction-history-item {
    padding: 10px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
}

.pwt-fraction-history-item:last-child {
    border-bottom: none;
}

.pwt-fraction-history-item:hover {
    background-color: #f5f5f5;
}

.pwt-fraction-history-expression {
    margin-bottom: 5px;
    font-size: 14px;
    color: #555;
    white-space: nowrap;
    overflow-x: auto;
}

.pwt-fraction-history-result {
    font-size: 16px;
    font-weight: 500;
    color: #007bff;
    overflow-x: auto;
    display: flex;
    align-items: center;
    white-space: normal;
    min-height: 30px;
}

/* 错误提示样式 */
.pwt-fraction-error {
    color: #dc3545;
    font-weight: 500;
    padding: 8px 12px;
    background-color: rgba(220, 53, 69, 0.1);
    border-left: 3px solid #dc3545;
    border-radius: 3px;
    margin: 10px 0;
    display: block;
    width: 100%;
    box-sizing: border-box;
}

.pwt-fraction-preview .pwt-fraction-error {
    margin: 0;
    line-height: 1.6;
    font-size: 15px;
}

/* 响应式布局调整 */
@media screen and (min-width: 769px) {
    .pwt-fraction-buttons {
        flex-direction: row;
    }
    
    .pwt-fraction-panel {
        flex: 1;
    }
}

@media screen and (max-width: 768px) {
    .pwt-fraction-panel {
        width: 100%;
    }
    
    .pwt-fraction-button {
        padding: 12px 5px;
        font-size: 18px;
        min-width: 30px;
    }
    
    .pwt-fraction-help-btn {
        font-size: 12px;
        padding: 3px 8px;
    }
}

@media screen and (max-width: 480px) {
    .pwt-fraction-button {
        min-width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0;
    }
    
    .pwt-fraction-panel {
        padding: 5px;
    }
    
    .pwt-fraction-button-row {
        gap: 3px;
    }
    
    .pwt-fraction-button-double {
        flex: 2;
    }
} 

/* 结果和历史记录中的负数显示优化 */
.pwt-fraction-result .pwt-negative-sign,
.pwt-fraction-history-result .pwt-negative-sign {
    font-size: 20px;
    line-height: 16px;
    position: relative;
    padding-right: 2px;
    top: -2px; /* 微调位置以垂直居中 */
}

/* 确保分数容器在所有设备上正确显示 */
.pwt-fraction-result,
.pwt-fraction-history-result,
.pwt-fraction-preview {
    overflow-x: auto;
    white-space: normal;
}

/* 内部包装元素确保不换行 */
.pwt-fraction-result > *,
.pwt-fraction-history-result > *,
.pwt-fraction-preview > * {
    white-space: nowrap;
    display: inline-block;
} 