/* main.css */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
    transition: background-color 0.3s, color 0.2s;
}

:root {
    --primary: #2c9a8a;
    --secondary: #f0f9f8;
    --accent: #3d7dca;
    --text: #1e3a5f;
    --light: #ffffff;
    --dark: #1a535c;
    --card-bg: #ffffff;
    --button-hover: #1a8c7a;
    --footer-bg: #1a535c;
    --footer-text: #ffffff;
}

.dark-mode {
    --primary: #2c9a8a;
    --secondary: #121f2b;
    --accent: #3d7dca;
    --text: #e0e0e0;
    --light: #1a2d3b;
    --dark: #353535;
    --dark-bg: #434343; /* 修改此值调整黑色深度 */
    --card-bg: #1a2d3b;
    --button-hover: #1a8c7a;
    --footer-bg: #0d1a26;
    --footer-text: #e0e0e0;
}

body {
    background: linear-gradient(135deg, var(--secondary) 0%, #e6f4f1 100%);
    color: var(--text);
    min-height: 100vh;
    padding: 0;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    overflow-y: hidden; /* 隐藏垂直滚动条 */
}

body.dark-mode {
    background: var(--dark-bg); /* 现在这行代码会正确生效 */
}

.header {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 10px rgba(26, 83, 92, 0.08);
    padding: 0.8rem 1rem;
    text-align: center;
    position: relative;
    z-index: 10;
    flex-shrink: 0;
}

.dark-mode .header {
    background: rgba(26, 45, 59, 0.95);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.3rem;
}

.logo {
    font-size: 1.8rem;
    color: var(--primary);
    margin-right: 10px;
}

.header h1 {
    color: var(--primary);
    font-size: 1.5rem;
    margin-bottom: 0.2rem;
}

.subtitle {
    color: #4a6b8a;
    font-size: 0.9rem;
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.4;
}

.dark-mode .subtitle {
    color: #a0b9d0;
}

.main-container {
    max-width: 1000px;
    margin: 10px auto; /* 减少上下间距 */
    padding: 0 15px;
    flex-grow: 1;
    width: 100%;
    position: relative;
    z-index: 2; /* 确保内容在景色之上 */
}

.tools-intro {
    text-align: center;
    margin-bottom: 15px; /* 减少间距 */
    color: #3a5a78;
    font-size: 0.95rem;
    line-height: 1.5;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 10px;
}

.dark-mode .tools-intro {
    color: #a0b9d0;
}

.tools-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.tool-card {
    background: var(--card-bg);
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(26, 83, 92, 0.1);
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    border: 1px solid #d0eae5;
    height: 150px; /* 减少高度 */
    display: flex;
    flex-direction: column;
}

.dark-mode .tool-card {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border: 1px solid #2a4d5a;
}

.tool-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(26, 83, 92, 0.15);
    border-color: var(--primary);
}

.dark-mode .tool-card:hover {
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.tool-header {
    background: linear-gradient(to right, var(--primary), #2a8f7f);
    color: white;
    padding: 10px; /* 减少内边距 */
    font-size: 0.95rem; /* 减小字体 */
    font-weight: 600;
    text-align: center;
    letter-spacing: 0.3px;
    flex-shrink: 0;
}

.tool-body {
    padding: 10px; /* 减少内边距 */
    line-height: 1.4;
    color: var(--text);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-grow: 1;
}

.tool-icon {
    font-size: 2rem; /* 减小图标 */
    text-align: center;
    margin-bottom: 5px; /* 减少间距 */
    color: var(--primary);
}

.tool-description {
    font-size: 0.8rem; /* 减小字体 */
    color: #4a6b8a;
    text-align: center;
    line-height: 1.3;
}

.dark-mode .tool-description {
    color: #a0b9d0;
}

.footer {
    background: var(--footer-bg);
    color: var(--footer-text);
    text-align: center;
    padding: 8px 0; /* 减少内边距 */
    font-size: 0.75rem;
    z-index: 10;
    flex-shrink: 0;
    width: 100%;
}

.footer-content {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.copyright {
    margin-bottom: 5px;
}

.beian-links {
    display: flex;
    gap: 15px;
    margin-bottom: 5px;
}

.beian-link {
    color: #b2e4dc;
    text-decoration: none;
    display: flex;
    align-items: center;
    font-size: 0.7rem;
}

.beian-link i {
    margin-right: 4px;
    font-size: 0.7rem;
}

.beian-link:hover {
    text-decoration: underline;
    color: white;
}

.dark-mode .beian-link {
    color: #7db1c9;
}

.setup-link {
    color: #b2e4dc;
    text-decoration: none;
    display: flex;
    align-items: center;
    font-size: 0.75rem;
    margin-top: 5px;
}

.setup-link i {
    margin-right: 5px;
}

.setup-link:hover {
    text-decoration: underline;
    color: white;
}

@media (max-width: 900px) {
    .tools-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .tools-container {
        grid-template-columns: 1fr;
    }
    
    .beian-links {
        flex-direction: column;
        gap: 4px;
    }
    
    .header h1 {
        font-size: 1.4rem;
    }
    
    .logo {
        font-size: 1.6rem;
    }
    
    .tools-intro {
        font-size: 0.9rem;
    }
    
    .tool-card {
        height: 130px; /* 进一步减少高度 */
    }
    
    .tool-header {
        padding: 8px;
        font-size: 0.9rem;
    }
    
    .tool-body {
        padding: 8px;
    }
    
    .tool-icon {
        font-size: 1.8rem;
        margin-bottom: 4px;
    }
}

.watermark {
    position: absolute;
    bottom: 10px;
    right: 10px;
    font-size: 0.7rem;
    color: rgba(26, 83, 92, 0.15);
    z-index: 0;
}

.dark-mode .watermark {
    color: rgba(160, 185, 208, 0.1);
}

.tool-number {
    position: absolute;
    top: 5px;
    left: 5px;
    background: var(--accent);
    color: white;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
}

/* 隐藏右下角的深色模式切换按钮 */
.dark-mode-toggle {
    display: none !important;
}

/* 新增模态框样式 */
.modal {
    display: flex;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: linear-gradient(135deg, #f8f9f7 0%, #f0f9f8 100%);
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    position: relative;
    width: 90%;
    max-width: 600px;
    padding: 30px 25px;
    text-align: center;
    border: 1px solid rgba(44, 154, 138, 0.2);
    
    /* 调整位置的关键参数 */
    /* 通过调整 translateY 的百分比值来改变垂直位置 */
    /* 当前设置为 -10% 表示向上移动10%的高度 */
    /* 数值越大向上移动越多，数值越小越靠近中心 */
    transform: translateY(-10%); 
    animation: slideUp 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.dark-mode .modal-content {
    background: linear-gradient(135deg, #1a2d3b 0%, #0d1e26 100%);
    border: 1px solid rgba(61, 125, 202, 0.3);
}

@keyframes slideUp {
    from { transform: translateY(30px) translateY(-10%); opacity: 0; }
    to { transform: translateY(0) translateY(-10%); opacity: 1; }
}

.modal-header {
    margin-bottom: 20px;
}

.modal-header h3 {
    color: #2c9a8a;
    font-size: 1.8rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.dark-mode .modal-header h3 {
    color: #3d7dca;
}

.modal-body {
    padding: 10px 0;
    margin-bottom: 25px;
}

.modal-icon {
    font-size: 3.5rem;
    color: #2c9a8a;
    margin-bottom: 15px;
    animation: pulse 2s infinite;
}

.dark-mode .modal-icon {
    color: #3d7dca;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.modal-body p {
    color: #1e3a5f;
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 15px;
    padding: 0 10px;
}

.dark-mode .modal-body p {
    color: #e0e0e0;
}

.modal-footer {
    margin-top: 15px;
}

.modal-btn {
    background: #2c9a8a;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    min-width: 180px;
}

.dark-mode .modal-btn {
    background: #3d7dca;
}

.modal-btn:disabled {
    background: #b0d5cf;
    cursor: not-allowed;
}

.dark-mode .modal-btn:disabled {
    background: #1a535c;
}

.modal-btn:hover:not(:disabled) {
    background: #1a8c7a;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.dark-mode .modal-btn:hover:not(:disabled) {
    background: #2c5aa0;
}

.modal-flower {
    position: absolute;
    font-size: 1.8rem;
    color: rgba(44, 154, 138, 0.3);
    z-index: -1;
    animation: float 8s infinite ease-in-out;
}

.dark-mode .modal-flower {
    color: rgba(61, 125, 202, 0.3);
}

.top-left {
    top: 15px;
    left: 15px;
    animation-delay: 0s;
}

.top-right {
    top: 15px;
    right: 15px;
    animation-delay: 1s;
}

.bottom-left {
    bottom: 15px;
    left: 15px;
    animation-delay: 2s;
}

.bottom-right {
    bottom: 15px;
    right: 15px;
    animation-delay: 3s;
}

@keyframes float {
    0% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(5deg); }
    100% { transform: translateY(0) rotate(0deg); }
}