/* 关键CSS - 确保页面基本布局在完整CSS加载前可见 */
.tool-content {
    display: none !important;
}
.tool-content.active {
    display: block !important;
}
.tool-button.active {
    background: linear-gradient(135deg, #24C6DC, #514A9D);
    color: white;
    box-shadow: 0 4px 12px rgba(36, 198, 220, 0.2);
}
/* 确保加权平均分默认显示 */
#weight-tool.active {
    display: block !important;
}

/* 从calculator.html的<style>标签中复制的样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', sans-serif;
    line-height: 1.6;
    background: linear-gradient(135deg, #f6f9fc 0%, #edf1f7 100%);
    color: #333;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    animation: fadeIn 0.5s ease;
}

header {
    background: linear-gradient(135deg, #24C6DC, #514A9D);
    padding: 20px 0;
    box-shadow: 0 4px 20px rgba(36, 198, 220, 0.2);
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 45%, rgba(255,255,255,0.1) 50%, transparent 55%);
    animation: shine 3s infinite;
}

@keyframes shine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.header-content {
    text-align: center;
}

.header-content h1 {
    color: white;
    font-size: 2.4em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    letter-spacing: 1px;
}

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

.calculator {
    background: #fff;
    padding: 32px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.calculator:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

.calculator-screen {
    width: 100%;
    height: 75px;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    text-align: right;
    padding: 18px;
    font-size: 30px;
    margin-bottom: 15px;
    color: #514A9D;
}

.calculator-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

.calculator button {
    padding: 20px;
    font-size: 22px;
    border: none;
    background: #f8f9fa;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #514A9D;
    font-weight: 500;
}

.calculator button:hover {
    background: #e9ecef;
    transform: translateY(-2px);
}

.calculator .operator {
    background: linear-gradient(135deg, #24C6DC, #514A9D);
    color: white;
}

.calculator .operator:hover {
    background: linear-gradient(135deg, #514A9D, #24C6DC);
}

.back-link {
    position: absolute;
    top: 20px;
    left: 20px;
    display: inline-flex;
    align-items: center;
    color: #fff;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    font-size: 15px;
    z-index: 1;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.back-link:hover {
    color: #fff;
    transform: translateX(-5px);
    background: rgba(255, 255, 255, 0.25);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.back-link::before {
    content: '←';
    margin-right: 8px;
    transition: transform 0.3s ease;
    display: inline-block;
}

.back-link:hover::before {
    transform: translateX(-5px);
}

.tools-nav {
    background: white;
    padding: 12px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.tool-button {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    background: #f8f9fa;
    color: #514A9D;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 15px;
    white-space: nowrap;
    min-width: 100px;
    position: relative;
    overflow: hidden;
}

.tool-button::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.8) 0%, transparent 80%);
    transform: translate(-50%, -50%) scale(0);
    opacity: 0;
    transition: transform 0.5s, opacity 0.3s;
}

.tool-button:active::after {
    transform: translate(-50%, -50%) scale(2);
    opacity: 1;
}

.tool-button.active {
    background: linear-gradient(135deg, #24C6DC, #514A9D);
    color: white;
    box-shadow: 0 4px 12px rgba(36, 198, 220, 0.2);
}

.tool-content {
    display: none;
    animation: fadeSlideUp 0.5s ease;
}

@keyframes fadeSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tool-content.active {
    display: block;
}

/* 加权平均分计算器样式更新 */
.weight-calculator {
    background: #fff;
    padding: 32px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    max-width: 550px;
    margin: 0 auto;
}

.weight-calculator:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

/* 分数和权重输入框样式更新 */
.weight-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    align-items: center;
}

.weight-row input {
    padding: 10px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-size: 15px;
}

/* 分数输入框样式 */
.weight-row .score-input {
    flex: 3;
    max-width: 250px;
}

/* 权重输入框样式 */
.weight-row .weight-input {
    flex: 2;
    max-width: 170px;
}

.weight-row input::placeholder {
    color: #adb5bd;
}

.weight-row input:focus {
    border-color: #24C6DC;
    outline: none;
    box-shadow: 0 0 0 3px rgba(36, 198, 220, 0.1);
}

/* 删除按钮样式更新 */
.delete-row-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: #ff4d4d;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.3s ease;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(255, 77, 77, 0.2);
}

.delete-row-btn:hover {
    background: #ff3333;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(255, 77, 77, 0.3);
}

/* 添加按钮样式更新 */
.add-row-btn {
    width: 100%;  /* 占满整行 */
    background: #fff;
    color: #514A9D;
    border: 2px dashed #514A9D;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.add-row-btn:hover {
    background: rgba(81, 74, 157, 0.05);
    transform: translateY(-2px);
}

.add-icon {
    width: 24px;
    height: 24px;
    background: #514A9D;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    transition: transform 0.3s ease;
}

.add-row-btn:hover .add-icon {
    transform: scale(1.1);
}

.calculate-btn {
    width: 100%;  /* 占满整行 */
    background: linear-gradient(135deg, #24C6DC, #514A9D);
    color: white;
    border: none;
    padding: 15px 25px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.calculate-btn:hover {
    background: linear-gradient(135deg, #514A9D, #24C6DC);
    transform: translateY(-2px);
}

#weight-result {
    background: linear-gradient(135deg, #24C6DC, #514A9D);
    color: white;
    padding: 20px;
    border-radius: 8px;
    font-size: 20px;
    text-align: center;
    margin-bottom: 25px;
    display: none;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 修改添加按钮样式 */
.add-row-btn {
    flex: 1;
    background: #fff;
    color: #2196F3;
    border: 2px dashed #2196F3;
    padding: 12px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.add-row-btn:hover {
    background: #f8f9fa;
    transform: translateY(-2px);
}

/* 添加按钮的加号图标 */
.add-icon {
    width: 24px;
    height: 24px;
    background: #2196F3;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    transition: transform 0.3s ease;
}

.add-row-btn:hover .add-icon {
    transform: scale(1.1);
}

/* 删除按钮样式 */
.delete-row-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: #ff4d4d;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.delete-row-btn:hover {
    background: #ff3333;
    transform: scale(1.1);
}

/* 确保至少有一行时隐藏删除按钮 */
.weight-rows.single-row .delete-row-btn {
    display: none;
}

/* 进制转换器样式更新 */
.base-converter {
    background: #fff;
    padding: 32px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    max-width: 550px;
    margin: 0 auto;
}

.base-converter:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

.base-input-group {
    margin-bottom: 20px;
    position: relative;
    transition: all 0.3s ease;
    max-width: none;
}

.base-input-group:last-child {
    margin-bottom: 0;
}

.base-label {
    display: block;
    margin-bottom: 8px;
    color: #514A9D;
    font-weight: 500;
    font-size: 15px;
    transition: all 0.3s ease;
}

.base-converter input {
    width: 100%;
    padding: 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 16px;
    color: #333;
    background: #f8f9fa;
    transition: all 0.3s ease;
}

.base-converter input:focus {
    outline: none;
    border-color: #24C6DC;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(36, 198, 220, 0.1);
}

.base-converter input::placeholder {
    color: #adb5bd;
}

/* 添加进制标识 */
.base-input-group::after {
    position: absolute;
    right: 12px;
    top: 38px;
    font-size: 14px;
    color: #adb5bd;
    font-weight: 500;
}

.base-input-group.decimal::after {
    content: "(10)";
}

.base-input-group.binary::after {
    content: "(2)";
}

.base-input-group.octal::after {
    content: "(8)";
}

.base-input-group.hexadecimal::after {
    content: "(16)";
}

/* 添加输入框图标 */
.base-converter input {
    padding-right: 45px; /* 为进制标识留出空间 */
}

/* 输入时的动画效果 */
.base-input-group.active .base-label {
    color: #24C6DC;
}

.base-input-group.active input {
    border-color: #24C6DC;
    background: #fff;
}

/* 错误状态样式 */
.base-input-group.error input {
    border-color: #ff4d4d;
    background: #fff8f8;
}

.base-input-group.error .base-label {
    color: #ff4d4d;
}

/* 加权平均分按钮样式更新 */
.weight-buttons {
    display: flex;
    flex-direction: column;  /* 改为垂直排列 */
    gap: 12px;
    margin: 20px 0;
}

/* 在大屏幕上使用横向布局 */
@media screen and (min-width: 768px) {
    .weight-buttons {
        flex-direction: row;  /* 横向排列 */
    }
    
    .add-row-btn,
    .calculate-btn {
        flex: 1;  /* 平均分配空间 */
    }

    .tools-nav {
        gap: 15px;
    }
    
    .tool-button {
        padding: 12px 25px;
        font-size: 16px;
    }
}

/* 移动端适配 */
@media screen and (max-width: 480px) {
    .container {
        padding: 10px;  /* 减小外层容器的内边距 */
    }

    .calculator-container,
    .weight-calculator,
    .base-converter {
        padding: 0 10px;
        max-width: 100%;
    }

    .calculator,
    .weight-calculator,
    .base-converter {
        padding: 20px;
    }

    .back-link {
        top: 15px;
        left: 15px;
        padding: 8px 16px;
        font-size: 14px;
    }

    .calculator-screen {
        height: 70px;
        font-size: 28px;
        padding: 15px;
    }

    .calculator button {
        padding: 18px;
        font-size: 20px;
    }

    .calculator-buttons {
        gap: 12px;
    }

    .weight-row .score-input {
        flex: 3;
        max-width: 160px;  /* 增加移动端宽度 */
    }
    
    .weight-row .weight-input {
        flex: 2;
        max-width: 120px;  /* 增加移动端宽度 */
    }

    .delete-row-btn {
        width: 28px;  /* 减小删除按钮大小 */
        height: 28px;
        font-size: 14px;
    }

    header {
        padding: 15px 0;  /* 移动端更小的内边距 */
        margin-bottom: 15px;  /* 移动端更小的底部间距 */
    }

    .header-content h1 {
        font-size: 2em;
    }

    .tool-button {
        padding: 10px 15px;
        min-width: 90px;
        font-size: 14px;
    }

    .email-section {
        margin-top: 12px;
    }

    .email-input {
        padding: 10px 12px;
        font-size: 14px;
    }

    .send-email-btn {
        padding: 10px 15px;
        font-size: 14px;
    }
}

/* 更小屏幕的优化 */
@media screen and (max-width: 360px) {
    .calculator-container {
        padding: 0 5px;  /* 更小屏幕上进一步减小内边距 */
    }

    .calculator,
    .weight-calculator,
    .base-converter {
        padding: 12px;  /* 更小屏幕上进一步减小卡片内边距 */
    }

    .weight-row .score-input {
        max-width: 130px;  /* 增加小屏幕宽度 */
    }
    
    .weight-row .weight-input {
        max-width: 90px;  /* 增加小屏幕宽度 */
    }
}

/* 添加页面过渡效果 */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 优化滚动行为 */
html {
    scroll-behavior: smooth;
}

/* 添加页面加载动画 */
.page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: white;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s;
}

.page-loader.hidden {
    opacity: 0;
    pointer-events: none;
}

/* 邮箱发送部分样式 */
#email-section {
    margin: 15px 0;
    padding: 15px;
    border-top: 1px solid #eee;
}

.save-hint {
    text-align: center;
    color: #666;
    margin-bottom: 10px;
    font-size: 14px;
}

.send-email-btn {
    padding: 12px 20px;
    background: linear-gradient(135deg, #514A9D, #24C6DC);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

.send-email-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(36, 198, 220, 0.2);
}

.send-email-btn i {
    font-size: 16px;
}

/* 邮箱对话框样式 */
.email-dialog {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.email-dialog-content {
    background: white;
    padding: 30px;
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.3s ease;
    overflow: hidden;
}

@keyframes slideIn {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.dialog-header {
    background: linear-gradient(135deg, #24C6DC, #514A9D);
    padding: 20px;
    color: white;
    text-align: center;
}

.dialog-header h3 {
    color: white;
    margin: 0;
    font-size: 20px;
    font-weight: 500;
}

.dialog-body {
    padding: 25px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    color: #666;
    margin-bottom: 8px;
    font-size: 14px;
}

.email-dialog input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s ease;
}

.dialog-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 20px;
    background: #f8f9fa;
    border-top: 1px solid #eee;
}

.dialog-buttons button {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 80px;
}

.cancel-btn {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    color: #495057;
    font-weight: 500;
}

.confirm-btn {
    background: linear-gradient(135deg, #24C6DC, #514A9D);
    border: none;
    color: white;
    font-weight: 500;
}

.cancel-btn:hover {
    background: #e9ecef;
}

.confirm-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(36, 198, 220, 0.2);
}

/* 提示框样式 */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 2000;
    transform: translate(-50%, -50%) translateY(30px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.toast.show {
    transform: translate(-50%, -50%);
    opacity: 1;
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-radius: 12px;
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 280px;
    max-width: 90%;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.95);
}

.toast-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.toast-icon::before {
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    font-size: 14px;
}

.toast.success .toast-content {
    border-left: 4px solid #10b981;
}

.toast.success .toast-icon {
    background: #10b981;
    color: white;
}

.toast.success .toast-icon::before {
    content: "\f00c";
}

.toast.error .toast-content {
    border-left: 4px solid #ef4444;
}

.toast.error .toast-icon {
    background: #ef4444;
    color: white;
}

.toast.error .toast-icon::before {
    content: "\f00d";
}

.toast.info .toast-content {
    border-left: 4px solid #3b82f6;
}

.toast.info .toast-icon {
    background: #3b82f6;
    color: white;
}

.toast.info .toast-icon::before {
    content: "\f129";
}

.toast-message {
    color: #333;
    font-size: 14px;
}

@media (max-width: 480px) {
    .toast {
        width: 90%;
    }
    
    .toast-content {
        min-width: 0;
        width: 100%;
    }
}

/* 密码输入弹窗样式 */
.password-dialog {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.password-dialog-content {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.3s ease;
    overflow: hidden;
}

.password-dialog .dialog-header {
    background: linear-gradient(135deg, #24C6DC, #514A9D);
    padding: 20px;
    color: white;
    text-align: center;
}

.password-dialog .dialog-header h3 {
    color: white;
    margin: 0;
    font-size: 20px;
    font-weight: 500;
}

.password-dialog .dialog-body {
    padding: 25px;
}

.lock-message {
    color: #666;
    margin-bottom: 20px;
    text-align: center;
    font-size: 14px;
}

.password-dialog .input-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s ease;
}

.password-dialog .input-group input:focus {
    outline: none;
    border-color: #24C6DC;
    box-shadow: 0 0 0 3px rgba(36, 198, 220, 0.1);
}