/* 全局设置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #181818;
    color: #e1e1e1;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    padding: 20px;
    overflow: hidden;
}

canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    background-color: #181818;
}

.container {
    display: flex;
    flex-wrap: wrap;
    width: 80%;
    max-width: 1200px;
    max-height: 90vh; /* 限制最大高度 */
    background-color: #242424;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    overflow-y: auto; /* 添加垂直滚动条 */
}
/* 修改主要内容区域布局 */
.main-content {
    display: flex;
    width: 100%;
    flex: 1;
}
/* 左侧设置区域 */
.settings {
    flex: 1;
    padding: 20px;
    min-width: 300px;
    border-right: 1px solid #333;  /* 添加分隔线 */
}
/* 中间结果显示区域 */
.result {
    flex: 1;
    padding: 20px;
    min-width: 300px;
    border-right: 1px solid #333;  /* 添加分隔线 */
}
/* 右侧历史记录区域 */
.password-history {
    flex: 1;
    padding: 20px;
    min-width: 300px;
    height: 100%; /* 设置高度为100% */
    max-height: calc(90vh - 40px); /* 减去padding的高度 */
    overflow: hidden; /* 隐藏溢出 */
    display: flex;
    flex-direction: column;
}

/* 添加历史记录列表容器样式 */
#historyList {
    flex: 1;
    overflow-y: auto; /* 只在列表区域显示滚动条 */
    margin-right: -10px; /* 为滚动条预留空间 */
    padding-right: 10px;
}

/* 美化滚动条 */
#historyList::-webkit-scrollbar {
    width: 8px;
}

#historyList::-webkit-scrollbar-track {
    background: #2a2a2a;
    border-radius: 4px;
}

#historyList::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 4px;
}

#historyList::-webkit-scrollbar-thumb:hover {
    background: #555;
}

h1, h2 {
    margin-bottom: 20px;
    color: #ffffff;
}

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

label {
    font-size: 16px;
    color: #bbbbbb;
    display: block;
    margin-bottom: 5px;
}

input[type="number"], input[type="checkbox"] {
    padding: 10px;
    font-size: 16px;
    border: 1px solid #555;
    border-radius: 8px;
    background-color: #333;
    color: #e1e1e1;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 10px;
}

input[type="checkbox"] {
    width: auto;
    margin-left: 5px;
}

button {
    background-color: #0070f3;
    color: white;
    padding: 12px;
    font-size: 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s;
    width: 100%;
    margin-top: 20px;
}

button:hover {
    background-color: #005bb5;
}

.password-output {
    position: relative;
    margin-top: 20px;
    padding: 20px;
    border: 1px solid #333;
    border-radius: 8px;
    background-color: #333;
}
.copy-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: auto;
    padding: 8px 16px;
    margin: 0;
    background-color: #333;
}

.copy-btn:hover {
    background-color: #444;
}
.password-history {
    flex: 1 1 100%;
    padding: 20px;
    border-top: 1px solid #333;
}

.history-item {
    background: #2a2a2a;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
    transition: all 0.2s ease;
}

.history-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.history-item-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
}

.history-item .password {
    font-family: monospace;
    font-size: 14px;
    color: #fff;
}

.history-item .timestamp {
    font-size: 12px;
    color: #888;
}

.history-item .strength {
    font-size: 12px;
    color: #666;
}

.history-item button {
    width: auto;
    margin: 0;
    padding: 6px 12px;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
#passwordDisplay {
    font-size: 18px;
    word-wrap: break-word;
    color: #ffffff;
}

.password-strength {
    margin-top: 10px;
    font-size: 14px;
    color: #bbbbbb;
}

/* 移动设备全屏铺满，且模块竖直排列 */
@media (max-width: 768px) {
    body {
        padding: 0;
    }
    .password-history {
        padding: 10px;
    }
    .history-item {
        flex-direction: column;
        gap: 10px;
    }
    .history-item button {
        width: 100%;
    }
    .container {
        width: 100%;
        border-radius: 0;
        min-height: 100vh;
    }
    .main-content {
        flex-direction: column;
    }
    .settings, .result, .password-history {
        width: 100%;
        min-width: 100%;
        border-right: none;
        border-bottom: 1px solid #333;
    }

    /* 设置 input-group 横向排列 */
    .settings {
        display: flex;
        flex-wrap: wrap; /* 允许换行 */
        gap: 10px; /* 每个 input-group 之间的间距 */
    }

    .input-group {
        flex-basis: 48%; /* 让每个 input-group 占据 48%，确保两个一排 */
        margin-bottom: 10px; /* 下方留出空间，避免元素挤在一起 */
    }

    /* 确保宽度充足时，input-group占据一整行 */
    .input-group input {
        width: 100%; 
    }
    
  /* 让第一个 input-group 独占一行 */
  .settings > .input-group:first-child {
  flex-basis: 100%; /* 占据整行宽度 */
  margin-bottom: 20px; /* 增加第一个元素的底部间距 */
  }

  /* 调整第二个 input-group 的宽度，使其填充剩余空间 */
  .settings > .input-group:nth-child(2) {
  flex-basis: 50%; /* 占据剩余空间 */
  }

  .history-item-content {
        gap: 8px;
    }
    
    .history-item button {
        width: 100%;
        margin-top: 8px;
    }
}

/* 添加密码显示动画 */
#passwordDisplay {
    transition: opacity 0.2s ease;
}

.password-output {
    position: relative;
    overflow: hidden;
}

/* 添加生成按钮点击效果 */
#generateBtn {
    transition: transform 0.1s ease;
}

#generateBtn:active {
    transform: scale(0.98);
}

/* 添加密码强度指示器样式 */
.strength-meter {
    height: 4px;
    background: #333;
    margin-top: 10px;
    border-radius: 2px;
    overflow: hidden;
}

.strength-meter-fill {
    height: 100%;
    width: 0;
    transition: width 0.3s ease, background-color 0.3s ease;
}

.strength-1 { width: 20%; background: #ff4444; }
.strength-2 { width: 40%; background: #ffbb33; }
.strength-3 { width: 60%; background: #ffeb3b; }
.strength-4 { width: 80%; background: #00C851; }
.strength-5 { width: 100%; background: #007E33; }

/* 添加生成动画效果 */
@keyframes generateAnimation {
    0% { transform: scale(1); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

.generating {
    animation: generateAnimation 0.3s ease;
}

.password-output {
    transition: all 0.3s ease;
}

.password-output:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* 移动端适配 */
@media (max-width: 768px) {
    .password-history {
        max-height: 50vh; /* 在移动端限制历史记录区域高度 */
    }

/* 添加历史记录提示文本样式 */
.history-hint {
    font-size: 12px;
    color: #666;
    margin-bottom: 15px;
    font-style: italic;
}

/* 移动端适配时调整提示文本间距 */
@media (max-width: 768px) {
    .history-hint {
        margin-bottom: 10px;
    }
}
    
