/* 确保整个页面使用 flex 布局 */
html, body {
    height: 100%;  /* 确保页面高度占满浏览器窗口 */
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

/* 头部样式，悬浮置顶，缩小高度 */
header {
    background-color: #3f51b5;
    color: white;
    padding: 15px 0;  /* 缩小高度 */
    position: sticky;  /* 设置为悬浮置顶 */
    top: 0;
    z-index: 1000;
}

h1 {
    margin: 0;
    font-size: 28px;  /* 调整标题字体大小 */
    font-weight: bold;
    text-align: center;
}

.header-subtitle {
    margin: 8px 0 0 0;
    font-size: 16px;
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
    font-weight: normal;
}

/* 密码生成器卡片样式 - 增大卡片整体 */
.password-generator-card {
    margin: 40px auto;
    width: 95%;  /* 增加卡片宽度 */
    max-width: 700px;  /* 控制最大宽度 */
    background-color: white;
    padding: 40px;  /* 增加内边距 */
    border-radius: 10px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.1);  /* 加深阴影 */
}

/* 密码显示区域 */
.password-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    border-radius: 10px;
    background-color: #f1f3f4;
    font-family: monospace;
    font-size: 26px;  /* 增大密码显示的字体 */
    color: #333;
}

#generated-password {
    width: 85%;
    border: none;
    background: none;
    text-align: center;
    color: #333;
    font-size: 26px;  /* 增大字体 */
}

.controls {
    display: flex;
    gap: 15px;
}

/* Password Strength Guide */
.strength-guide {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.strength-guide h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
    color: #333;
}

.strength-guide ul {
    margin: 0;
    padding-left: 20px;
}

.strength-guide li {
    margin-bottom: 5px;
    font-size: 14px;
}

.strength-weak {
    color: #f44336;
    font-weight: bold;
}

.strength-medium {
    color: #ff9800;
    font-weight: bold;
}

.strength-strong {
    color: #4caf50;
    font-weight: bold;
}

/* 控制按钮的图片尺寸 */
.controls button {
    background: none;
    border: none;
    cursor: pointer;
}

.controls img {
    width: 26px;  /* 增大按钮图标 */
    height: 26px;
}

/* 自定义密码区域 */
.customize-section {
    margin: 30px 0;  /* 增加上下间距 */
}

.customize-section h2 {
    font-size: 20px;  /* 增大标题字体 */
    font-weight: bold;
    margin-bottom: 20px;
}

/* 密码长度滑块和输入框 */
.length-slider {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 25px;
    gap: 15px; /* 增加输入框和滑块之间的间距 */
}

#password-length {
    width: 60px;  /* 调整输入框宽度 */
    text-align: center;
    font-size: 20px;  /* 增大字体 */
}

#password-length-range {
    width: 100%;  /* 滑块拉长，占用整个可用宽度 */
    max-width: 350px;  /* 控制滑块的最大宽度 */
}

/* 选项设置 */
.options {
    display: flex;
    justify-content: space-around;
    margin-bottom: 25px;
}

.options label {
    font-size: 18px;  /* 增大选项字体 */
    color: #333;
}

/* 左对齐 additional-options */
.additional-options {
    margin-top: 20px;
    display: flex;
    flex-direction: column;  /* 选项堆叠成一列 */
    text-align: left;  /* 左对齐 */
}

.additional-options label {
    display: block;
    font-size: 18px;  /* 调整字体大小 */
    color: #333;
    margin-bottom: 10px;  /* 增加选项间距 */
}

/* 生成密码按钮居中对齐，并调整布局以容纳其他按钮 */
.generate-btn-container {
    display: flex;
    justify-content: center;  /* 保持左右居中 */
    align-items: center;  /* 垂直居中对齐 */
    gap: 10px;  /* 控制按钮之间的间距 */
    margin-top: 20px;
}

/* 确保“Generate Password”按钮和控制按钮之间有间距 */
.generate-btn {
    width: auto;  /* 自动调整按钮宽度 */
    padding: 16px;
    font-size: 18px;  /* 调整按钮字体大小 */
    background-color: #ff5722;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.generate-btn:hover {
    background-color: #e64a19;
}

/* Security Tips Section */
.security-tips {
    margin: 40px auto;
    width: 90%;
    max-width: 1200px;
}

.security-tips h2 {
    font-size: 22px;
    margin-bottom: 30px;
    text-align: center;
    color: #333;
}

.security-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

@media (max-width: 1200px) {
    .security-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .security-grid {
        grid-template-columns: 1fr;
    }
}

.security-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #3f51b5;
}

.security-card h3 {
    font-size: 18px;
    margin-bottom: 10px;
    color: #3f51b5;
}

.security-card p {
    font-size: 14px;
    line-height: 1.5;
    color: #555;
    margin: 0;
}

/* FAQ 样式（内容显示，无卡片样式） */
.faq {
    margin: 40px auto;
    width: 90%;
    max-width: 700px;
}

.faq h2 {
    font-size: 22px;
    margin-bottom: 20px;
}

/* 提问部分样式 */
.qa-question {
    font-weight: bold;
    font-size: 18px; /* 单独调整提问的字体大小 */
}

/* 回答部分样式 */
.qa-answer {
    font-size: 16px; /* 单独调整回答的字体大小 */
    line-height: 1.6;
}

.qa {
    margin-bottom: 20px;
}

/* 页脚样式，固定在页面底部 */
footer {
    padding: 10px;
    background-color: #e0e0e0; /* 更柔和的背景色 */
    color: #666666; /* 更柔和的文本颜色 */
    font-size: 12px; /* 较小的字体 */
    text-align: center;
    width: 100%;  /* 占据全宽 */
    position: relative;  /* 保证它在内容较多时不会覆盖 */
    bottom: 0;  /* 确保它位于底部 */
}

footer p {
    margin: 5px 0; /* 缩小 margin 以减小间距 */
    opacity: 0.7; /* 更弱的文本不透明度 */
}

/* 强度指示器样式 */
#strength-indicator {
    font-size: 16px;
    font-weight: bold;
    margin-top: 10px;
    color: #333; /* 默认颜色 */
}

/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Toast 提示样式 */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 24px;
    border-radius: 8px;
    color: white;
    font-weight: bold;
    z-index: 10000;
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    max-width: 300px;
    word-wrap: break-word;
}

.toast.show {
    transform: translateX(0);
}

.toast-success {
    background-color: #4caf50;
}

.toast-error {
    background-color: #f44336;
}

.toast-warning {
    background-color: #ff9800;
}

/* Related Tools Section */
.related-tools {
    margin: 60px auto;
    width: 95%;
    max-width: 1200px;
    padding: 0 20px;
}

.related-tools h2 {
    text-align: center;
    color: #333;
    margin-bottom: 40px;
    font-size: 28px;
    font-weight: 600;
}

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

.tool-card {
    background: white;
    border-radius: 12px;
    padding: 30px 25px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    text-align: center;
    transition: all 0.3s ease;
    border: 1px solid #f0f0f0;
}

.tool-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    border-color: #3f51b5;
}

.tool-icon {
    font-size: 48px;
    margin-bottom: 20px;
    display: block;
}

.tool-card h3 {
    color: #333;
    margin: 0 0 15px 0;
    font-size: 20px;
    font-weight: 600;
}

.tool-card p {
    color: #666;
    line-height: 1.6;
    margin: 0 0 25px 0;
    font-size: 14px;
}

.tool-link {
    display: inline-block;
    background: linear-gradient(135deg, #3f51b5, #5c6bc0);
    color: white;
    text-decoration: none;
    padding: 12px 24px;
    border-radius: 25px;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.tool-link:hover {
    background: linear-gradient(135deg, #303f9f, #3f51b5);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(63, 81, 181, 0.3);
}

/* Responsive design for related tools */
@media (max-width: 768px) {
    .tools-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .tool-card {
        padding: 25px 20px;
    }
    
    .related-tools {
        margin: 40px auto;
    }
    
    .related-tools h2 {
        font-size: 24px;
        margin-bottom: 30px;
    }
}