﻿/* 鍏ㄥ眬璁剧疆 */
* {
    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: nowrap;
    width: 80%;
    max-width: 1200px;
    height: 69vh;
    max-height: 69vh; /* 闄愬埗鏈€澶ч珮搴?*/
    background-color: #242424;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    overflow-y: hidden;
}
/* 淇敼涓昏鍐呭鍖哄煙甯冨眬 */
.main-content {
    display: grid;
    grid-template-columns: 360px minmax(0, 1fr) minmax(0, 1fr);
    width: 100%;
    flex: 1;
    min-width: 0;
}
/* 宸︿晶璁剧疆鍖哄煙 */
.settings {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    min-width: 0;
    border-right: 1px solid #333;  /* 娣诲姞鍒嗛殧绾?*/
}
/* 涓棿缁撴灉鏄剧ず鍖哄煙 */
.result {
    flex: 1 1 0;
    padding: 20px;
    min-width: 0;
    border-right: 1px solid #333;  /* 娣诲姞鍒嗛殧绾?*/
}
/* 鍙充晶鍘嗗彶璁板綍鍖哄煙 */
.password-history {
    flex: 1 1 0;
    padding: 20px;
    min-width: 0;
    height: 100%; /* 璁剧疆楂樺害涓?00% */
    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;
}

#generateBtn {
    margin-top: auto;
}

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

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

.result-header h2 {
    margin-bottom: 0;
}

.password-output {
    position: relative;
    padding: 20px;
    border: 1px solid #333;
    border-radius: 8px;
    background-color: #333;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}
.output-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.copy-btn {
    position: static;
    transform: none;
    width: auto;
    padding: 8px 16px;
    margin: 0;
    background-color: #444;
}

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

.icon-btn {
    background: transparent;
    border: 1px solid #555;
    color: #e1e1e1;
    padding: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    width: auto;
    height: 38px;
    margin: 0;
    transition: all 0.2s;
}

.icon-btn:hover {
    background-color: #444;
    border-color: #666;
}

.icon-btn svg {
    display: block;
}
.password-history {
    flex: 1 1 0;
    padding: 20px;
    border-top: none;
}

.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;
        display: block;
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
    }
    .password-history {
        padding: 10px;
    }
    .history-item {
        flex-direction: column;
        gap: 10px;
    }
    .history-item button {
        width: 100%;
    }
    .container {
        width: 100%;
        height: auto;
        max-height: none;
        border-radius: 0;
        min-height: 100vh;
        overflow-y: auto;
    }
    .main-content {
        display: flex;
        flex-direction: column;
    }
    .settings, .result, .password-history {
        flex: none;
        width: 100%;
        min-width: 100%;
        border-right: none;
        border-bottom: 1px solid #333;
    }

    /* 绉诲姩绔繚鎸佺旱鍚戞祦寮忓竷灞€ */
    .settings {
        display: block;
    }

    #generateBtn {
        margin-top: 20px;
    }

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

    /* 纭繚瀹藉害鍏呰冻鏃讹紝input-group鍗犳嵁涓€鏁磋 */
    .input-group input {
        width: 100%; 
    }
    
  /* 璁╃涓€涓?input-group 鐙崰涓€琛?*/
  .settings > .input-group:first-child {
  flex-basis: auto;
  margin-bottom: 20px;
  }

  /* 璋冩暣绗簩涓?input-group 鐨勫搴︼紝浣垮叾濉厖鍓╀綑绌洪棿 */
  .settings > .input-group:nth-child(2) {
  flex-basis: auto;
  }

  .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;
    }
}
}


