/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部样式 */
header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.subtitle {
    font-size: 1.2em;
    opacity: 0.9;
}

/* 输入区域样式 */
.input-section {
    background: white;
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.matrix-input h3 {
    margin-bottom: 20px;
    color: #4a5568;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 10px;
}

.input-controls {
    display: flex;
    gap: 20px;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.input-controls label {
    font-weight: 600;
    color: #4a5568;
}

.input-controls input {
    padding: 8px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    width: 80px;
    transition: border-color 0.3s;
}

.input-controls input:focus {
    outline: none;
    border-color: #667eea;
}

button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s;
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

button:active {
    transform: translateY(0);
}

/* 矩阵输入表格样式 */
.matrix-table {
    margin: 20px 0;
    border-collapse: collapse;
}

.matrix-table input {
    width: 80px;
    padding: 8px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    text-align: center;
    font-size: 14px;
    transition: border-color 0.3s;
}

.matrix-table input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.matrix-table td {
    padding: 5px;
}

/* 示例按钮样式 */
.example-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.example-buttons button {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    font-size: 12px;
    padding: 8px 15px;
}

.example-buttons button:hover {
    box-shadow: 0 5px 15px rgba(72, 187, 120, 0.4);
}

/* 操作区域样式 */
.action-section {
    text-align: center;
    margin: 20px 0;
}

#calculate-btn {
    background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
    padding: 12px 30px;
    font-size: 16px;
    margin-right: 10px;
}

#calculate-btn:hover {
    box-shadow: 0 5px 15px rgba(237, 137, 54, 0.4);
}

/* 结果区域样式 */
.results-section {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.loading {
    text-align: center;
    font-size: 18px;
    color: #667eea;
    font-weight: 600;
}

.results h3 {
    margin-bottom: 25px;
    color: #4a5568;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 10px;
}

.result-group {
    margin-bottom: 30px;
    padding: 20px;
    background: #f7fafc;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.result-group h4 {
    margin-bottom: 15px;
    color: #4a5568;
    font-size: 1.1em;
}

/* 矩阵显示样式 */
.matrix-display {
    font-family: 'Courier New', monospace;
    background: white;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    overflow-x: auto;
}

.matrix-display table {
    border-collapse: collapse;
    margin: 0 auto;
}

.matrix-display td {
    padding: 8px 12px;
    text-align: center;
    border: 1px solid #e2e8f0;
    min-width: 60px;
}

.matrix-display .matrix-header {
    background: #667eea;
    color: white;
    font-weight: bold;
}

/* 数值显示样式 */
.values-display {
    margin-top: 10px;
    padding: 10px;
    background: #edf2f7;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
}

.values-display div {
    margin: 5px 0;
}

/* 属性显示样式 */
.properties-display {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.property-item {
    background: white;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.property-name {
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 5px;
}

.property-value {
    font-size: 1.2em;
    color: #667eea;
    font-weight: 600;
}

/* 错误和隐藏样式 */
.error {
    background: #fed7d7;
    color: #c53030;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #f56565;
    margin-top: 20px;
}

.hidden {
    display: none;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .input-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .input-controls label {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .example-buttons {
        flex-direction: column;
    }
    
    .matrix-table input {
        width: 60px;
    }
    
    .properties-display {
        grid-template-columns: 1fr;
    }
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.results {
    animation: fadeIn 0.5s ease-out;
}

.result-group {
    animation: fadeIn 0.5s ease-out;
}

/* 滚动条样式 */
.matrix-display::-webkit-scrollbar {
    height: 8px;
}

.matrix-display::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.matrix-display::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.matrix-display::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}