/* 仿微信小程序的UI样式 */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f8f8f8;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

#banner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: rgba(7, 193, 96, 0.9); /* 半透明绿色 */
    color: #fff;
    text-align: center;
    padding: 10px;
    font-size: 16px;
    z-index: 1000;
}

.container {
    background-color: #fff;
    width: 100%;
    max-width: 400px;
    border-radius: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 20px;
    box-sizing: border-box;
    margin-top: 50px; /* 避免被横幅遮挡 */
}

.title-wrapper {
    text-align: center;
    margin-bottom: 20px;
}

.subtitle {
    display: inline-block;
    padding: 5px 10px;
    background-color: #f1f1f1;
    border-radius: 8px;
    font-size: 12px;
    color: #666;
    margin-bottom: 5px;
}

h1 {
    font-size: 24px;
    color: #333;
    margin: 0;
    background: linear-gradient(90deg, #ff7e5f, #feb47b, #ff7e5f);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shine 3s linear infinite;
}

@keyframes shine {
    to {
        background-position: 200% center;
    }
}

.material-item {
    margin-bottom: 15px;
    padding: 10px;
    background-color: #f9f9f9;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    opacity: 1;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.material-item.fade-out {
    opacity: 0;
    transform: translateX(-20px);
}

.material-item .material-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.material-item .material-header label {
    font-size: 14px;
    color: #666;
}

.material-item .material-header .btn-group {
    display: flex;
    gap: 5px;
}

.material-item .material-header .edit-btn,
.material-item .material-header .delete-btn,
.material-item .material-header .clear-btn {
    background-color: #ffc107;
    color: #333;
    border: none;
    border-radius: 5px;
    padding: 5px 10px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.material-item .material-header .delete-btn {
    background-color: #dc3545;
    color: #fff;
}

.material-item .material-header .clear-btn {
    background-color: #17a2b8;
    color: #fff;
}

.material-item .material-header .edit-btn:hover {
    background-color: #e0a800;
}

.material-item .material-header .delete-btn:hover {
    background-color: #c82333;
}

.material-item .material-header .clear-btn:hover {
    background-color: #138496;
}

.material-item .input-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.material-item input,
.material-item select {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    box-sizing: border-box;
    transition: border-color 0.3s ease;
}

.material-item input:focus,
.material-item select:focus {
    border-color: #07c160;
    outline: none;
}

.material-item .result {
    font-size: 14px;
    color: #555; /* 调整为深灰色 */
    font-weight: bold;
    margin-top: 10px;
}

.button-group {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.button-group button {
    flex: 1;
    padding: 12px;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#add-material-btn {
    background-color: #07c160;
}

#clear-all-btn {
    background-color: #dc3545;
}

#calculate-btn {
    background-color: #6c757d;
}

#help-btn {
    background-color: #17a2b8;
}

#refresh-btn {
    background-color: #ffc107;
}

#add-material-btn:hover {
    background-color: #06ad56;
}

#clear-all-btn:hover {
    background-color: #c82333;
}

#calculate-btn:hover {
    background-color: #5a6268;
}

#help-btn:hover {
    background-color: #138496;
}

#refresh-btn:hover {
    background-color: #e0a800;
}

#result {
    margin-top: 20px;
    font-size: 14px;
    color: #555; /* 调整为深灰色 */
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

#result table {
    width: 100%;
    border-collapse: collapse;
}

#result th,
#result td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

#result th {
    background-color: #f1f1f1;
}

#toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 10px 20px;
    border-radius: 5px;
    font-size: 14px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#toast.show {
    opacity: 1;
    visibility: visible;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #fff;
    padding: 20px;
    border-radius: 10px;
    max-width: 400px;
    width: 90%;
    position: relative;
}

.modal-content .close {
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 20px;
    cursor: pointer;
}

.modal-content h2 {
    margin-top: 0;
}

.modal-content ul {
    padding-left: 20px;
}

.modal-content li {
    margin-bottom: 10px;
}