/* 
 * common.css - 通用样式
 * 包含全局样式、变量、导航、页脚等
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #ff4a4a;
    --secondary-color: #4CAF50;
    --text-color: #333;
    --light-text: #666;
    --border-color: #ddd;
    --light-bg: #f9f9f9;
    --border-radius: 8px;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --light-gray: #f8f9fa;
    --hover-color: #ff5252;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    margin: 0;
    padding: 0;
    background-color: #f8f9fa;
}

/* 页头样式 */
header {
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: var(--box-shadow);
    padding: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.logo h1 {
    font-size: 2.5rem;
    color: var(--text-color);
    text-align: center;
    margin-bottom: 1rem;
}

.logo h1 span {
    color: var(--primary-color);
    font-weight: bold;
}

.highlight {
    color: #ff6b6b;
    font-weight: bold;
    font-family: 'Courier New', monospace;
}

/* 导航样式 */
nav ul {
    display: flex;
    justify-content: center;
    list-style: none;
    margin-top: 1rem;
    gap: 2rem;
    flex-wrap: wrap;
}

nav ul li a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

nav ul li a:hover {
    background-color: var(--primary-color);
    color: white;
}

nav ul li a::before {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    background-size: contain;
    background-repeat: no-repeat;
}

nav ul li a.active {
    background-color: var(--primary-color);
    color: white;
}

/* 主要内容区域 */
main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

/* 汉堡菜单按钮 */
.menu-toggle {
    display: none; /* 默认隐藏 */
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    position: absolute;
    right: 1rem;
    top: 1rem;
    z-index: 200;
    color: var(--primary-color);
}

.menu-toggle:focus {
    outline: none;
}

.tool-section {
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: var(--border-radius);
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--box-shadow);
    backdrop-filter: blur(10px);
    transition: transform 0.3s ease;
}

.tool-section:hover {
    transform: translateY(-5px);
}

.tool-section h2 {
    margin-bottom: 1.5rem;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tool-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* 通用输入组样式 */
.input-group {
    display: flex;
    align-items: center;
    gap: 1rem;
    background-color: rgba(255, 255, 255, 0.8);
    padding: 1rem;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    margin-bottom: 15px;
}

.input-group label {
    min-width: 120px;
    font-weight: 500;
    color: var(--text-color);
    display: block;
    margin-bottom: 5px;
}

.input-group input {
    padding: 0.8rem;
    border: 2px solid #e9ecef;
    border-radius: var(--border-radius);
    flex: 1;
    transition: border-color 0.3s ease;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.input-group button {
    padding: 0.8rem 1.5rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.input-group button:hover {
    background-color: #ff5252;
    transform: translateY(-2px);
}

/* 页脚样式 */
footer {
    text-align: center;
    padding: 2rem;
    background-color: rgba(255, 255, 255, 0.95);
    margin-top: 2rem;
    box-shadow: 0 -2px 5px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
}

.footer-links {
    margin-top: 1rem;
}

.footer-links a {
    color: var(--text-color);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    transition: all 0.3s ease;
}

.footer-links a:hover {
    color: var(--primary-color);
    background-color: rgba(0, 0, 0, 0.05);
}

/* 通用信息区域样式 */
.info-section {
    margin-top: 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.info-card {
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--box-shadow);
    transition: transform 0.3s ease;
    backdrop-filter: blur(10px);
}

.info-card:hover {
    transform: translateY(-5px);
}

.info-card h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.info-card p {
    color: var(--text-color);
    line-height: 1.8;
    margin-bottom: 1rem;
}

.info-card p:last-child {
    margin-bottom: 0;
}

/* 通用按钮样式 */
.btn {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    text-align: center;
    display: inline-block;
    text-decoration: none;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--hover-color);
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: #45a049;
    transform: translateY(-2px);
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color);
}

.btn-outline:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* 通用表单元素样式 */
select, input, textarea, button {
    font-family: inherit;
    font-size: 1rem;
    padding: 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    transition: all 0.3s ease;
    outline: none;
}

select:focus, input:focus, textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(255, 74, 74, 0.1);
}

/* 通用结果区域样式 */
.result-area {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--light-gray);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.result-area pre {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-all;
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    line-height: 1.6;
}

/* 通用toast提示样式 */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.toast-message {
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 20px;
    border-radius: 4px;
    margin-bottom: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    font-size: 14px;
    max-width: 300px;
    animation: fadeIn 0.3s, fadeOut 0.3s 2.7s;
    animation-fill-mode: forwards;
    display: flex;
    align-items: center;
    opacity: 0;
}

.toast-message i {
    margin-right: 10px;
    font-size: 16px;
}

.toast-message.info {
    background-color: rgba(0, 0, 0, 0.8);
}

.toast-message.success {
    background-color: rgba(76, 175, 80, 0.9);
}

.toast-message.warning {
    background-color: rgba(255, 152, 0, 0.9);
}

.toast-message.error {
    background-color: rgba(244, 67, 54, 0.9);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-20px); }
}

/* 输入提示和验证样式 */
.input-error {
    border-color: #f44336 !important;
}

.input-hint {
    display: none;
    color: #666;
    font-size: 12px;
    margin-top: 5px;
    font-style: italic;
}

.input-group:hover .input-hint {
    display: block;
}

.input-error-message {
    display: none;
    color: #f44336;
    font-size: 12px;
    margin-top: 5px;
}

.input-error + .input-error-message {
    display: block;
}

/* 表单验证样式 */
input:focus:invalid {
    border-color: #f44336;
}

input:focus:valid {
    border-color: #4CAF50;
}

/* 工具提示样式 */
[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s;
    pointer-events: none;
    z-index: 10;
}

[data-tooltip]:hover::after {
    visibility: visible;
    opacity: 1;
}

/* 底部备案号链接样式 */
.beian-link {
    text-decoration: none;
    color: var(--text-color);
    transition: color 0.3s ease;
}

.beian-link:hover {
    color: var(--primary-color);
}

/* 响应式样式 */
@media (max-width: 768px) {
    .menu-toggle {
        display: block; /* 在移动端显示汉堡菜单按钮 */
    }
    
    header {
        position: relative; /* 在移动端移除固定定位 */
        padding-bottom: 0.5rem;
    }
    
    .logo h1 {
        font-size: 2rem;
        margin-bottom: 0.5rem;
        padding-right: 40px; /* 为汉堡菜单按钮留出空间 */
    }
    
    nav {
        height: 0;
        overflow: hidden;
        transition: height 0.3s ease;
    }
    
    nav.active {
        height: auto;
        overflow: visible;
    }
    
    nav ul {
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
        padding-bottom: 1rem;
    }
    
    nav ul li {
        width: 100%;
        text-align: center;
    }
    
    nav ul li a {
        width: 100%;
        justify-content: center;
    }
    
    .input-group {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .input-group label {
        min-width: auto;
    }
    
    .tool-section {
        padding: 1rem;
    }
    
    .tool-section h2 {
        font-size: 1.3rem;
    }
    
    .tool-container {
        gap: 1rem;
    }
    
    main {
        margin: 1rem auto;
    }
    
    .info-section {
        grid-template-columns: 1fr;
    }
    
    footer {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .logo h1 {
        font-size: 1.5rem;
    }
    
    .tool-section {
        padding: 0.8rem;
    }
    
    .input-group {
        padding: 0.8rem;
    }
    
    .input-group button {
        padding: 0.6rem 1rem;
        width: 100%;
    }
    
    .input-group input, .input-group select {
        padding: 0.6rem;
    }
} 