* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f0f2f5;
    color: #333;
    line-height: 1.6;
}

header {
    background-color: #2c3e50;
    color: white;
    padding: 15px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

header h1 {
    text-align: center;
    font-size: 28px;
    margin: 0;
}

nav {
    background-color: #34495e;
    padding: 10px 0;
    overflow-x: auto;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    gap: 15px;
    padding: 0 20px;
    flex-wrap: wrap;
}

.nav-btn {
    background-color: transparent;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease;
    white-space: nowrap;
    text-decoration: none;
    display: inline-block;
}

.nav-btn:hover, .nav-btn.active {
    background-color: #007bff;
}

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

.tool-panel {
    background-color: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.tool-panel h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 24px;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 10px;
}

.tool-panel h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 20px;
}

.input-section {
    margin-bottom: 30px;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

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

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #495057;
}

.input-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.ip-input {
    display: flex;
    gap: 5px;
    flex: 1;
}

.ip-input input {
    width: 80px;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    text-align: center;
    font-size: 16px;
}

.ip-input span {
    line-height: 40px;
    color: #6c757d;
}

.subnet-input {
    display: flex;
    gap: 15px;
    align-items: center;
    flex: 1;
    flex-wrap: wrap;
}

.subnet-option {
    display: flex;
    align-items: center;
    gap: 5px;
}

select, button, input[type="number"], input[type="text"] {
    padding: 10px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

select {
    background-color: white;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236c757d' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
    padding-right: 30px;
    appearance: none;
}

select:hover {
    border-color: #007bff;
}

input[type="number"], input[type="text"] {
    cursor: text;
}

input[type="number"]:focus, input[type="text"]:focus, select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

button {
    background-color: #007bff;
    color: white;
    border: none;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

button:hover {
    background-color: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 添加工具提示样式 */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #2c3e50;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 14px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}

/* 添加结果卡片的动画效果 */
.result-card {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
    animation: fadeInUp 0.5s ease;
}

.result-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* 添加转换组的动画效果 */
.conversion-group {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
}

.conversion-group:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

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

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

/* 添加清空按钮样式 */
.clear-btn {
    background-color: #6c757d;
    margin-left: 10px;
}

.clear-btn:hover {
    background-color: #5a6268;
}

/* 添加复制按钮样式 */
.copy-btn {
    background-color: #28a745;
    padding: 6px 12px;
    font-size: 14px;
    margin-left: 10px;
}

.copy-btn:hover {
    background-color: #218838;
}

/* 添加历史记录样式 */
.history-section {
    margin-top: 30px;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    margin-bottom: 10px;
    background-color: white;
    border-radius: 6px;
    border: 1px solid #e9ecef;
}

.history-item:hover {
    background-color: #f0f0f0;
}

/* 添加输入框错误样式 */
.input-error {
    border-color: #dc3545 !important;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1) !important;
}

/* 添加结果高亮样式 */
.result-highlight {
    color: #007bff;
    font-weight: bold;
}

/* 添加单位标签样式 */
.unit-label {
    font-size: 14px;
    color: #6c757d;
    margin-left: 5px;
}

.result-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.result-card {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.result-card h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 18px;
}

.result-item {
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.result-label {
    font-weight: 500;
    color: #6c757d;
}

.result-value {
    color: #2c3e50;
    font-weight: 600;
    font-family: 'Courier New', Courier, monospace;
}

.conversion-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.conversion-group {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.conversion-input {
    width: 100%;
    margin-bottom: 10px;
}

.subnetting-result {
    margin-top: 20px;
}

.subnet-row {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    margin-bottom: 10px;
}

.subnet-row h4 {
    color: #2c3e50;
    margin-bottom: 10px;
}

.subnet-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    background-color: white;
}

.data-table th, .data-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.data-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
}

.data-table tr:hover {
    background-color: #f8f9fa;
}

.search-box {
    margin-bottom: 20px;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.search-box input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 16px;
}

.command-section {
    margin-bottom: 20px;
}

.command-item {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    margin-bottom: 15px;
}

.command-item h4 {
    color: #2c3e50;
    margin-bottom: 5px;
}

.command-item .usage {
    color: #007bff;
    font-family: 'Courier New', Courier, monospace;
    margin-bottom: 10px;
}

.command-item .description {
    color: #6c757d;
    margin-bottom: 10px;
}

.command-item .example {
    background-color: #e9ecef;
    padding: 10px;
    border-radius: 4px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
}

.error, .success {
    margin-top: 10px;
    font-size: 14px;
}

.error {
    color: #dc3545;
}

.success {
    color: #28a745;
}

/* 主页面样式 */
.main-content {
    text-align: center;
    padding: 40px 20px;
}

.main-content h2 {
    margin-bottom: 20px;
    color: #2c3e50;
}

.main-content p {
    margin-bottom: 30px;
    color: #6c757d;
    font-size: 18px;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 40px;
}

.tool-card {
    background-color: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    text-decoration: none;
    color: #333;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.tool-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

.tool-card h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 20px;
}

.tool-card p {
    color: #6c757d;
    font-size: 14px;
    margin: 0;
}

@media (max-width: 768px) {
    .nav-container {
        padding: 0 10px;
        gap: 5px;
    }
    
    .nav-btn {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .container {
        padding: 0 10px;
    }
    
    .tool-panel {
        padding: 15px;
    }
    
    .input-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .ip-input {
        min-width: auto;
    }
    
    .result-section {
        grid-template-columns: 1fr;
    }
    
    .conversion-section {
        grid-template-columns: 1fr;
    }
    
    .tools-grid {
        grid-template-columns: 1fr;
    }
}