/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 基础样式 */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
        sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

/* 容器样式 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 20px;
}

/* 头部样式 */
.header {
    text-align: center;
    color: white;
    margin-bottom: 20px;
}

.title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
}

/* 主内容区域 */
.main-content {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 30px;
    align-items: start;
}

/* 加密部分 */
.encryption-section {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.encryption-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

/* 输入组样式 */
.input-group,
.algorithm-group,
.result-group {
    margin-bottom: 25px;
}

.label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
    font-size: 0.95rem;
}

.input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background-color: #f9fafb;
}

.input:focus {
    outline: none;
    border-color: #667eea;
    background-color: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.input::placeholder {
    color: #aaa;
}

/* 密码输入包装器 */
.password-input-wrapper,
.result-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

/* 密码可见性切换按钮 */
.visibility-toggle,
.copy-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #666;
    font-size: 1rem;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.visibility-toggle:hover,
.copy-btn:hover:not(:disabled) {
    color: #667eea;
    background-color: rgba(102, 126, 234, 0.1);
}

.copy-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 密码强度指示器 */
.password-strength {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    font-size: 0.9rem;
}

.strength-label {
    font-weight: 600;
    color: #555;
    min-width: 80px;
}

.strength-meter {
    flex: 1;
    height: 8px;
    background-color: #e1e5e9;
    border-radius: 4px;
    overflow: hidden;
}

.strength-bar {
    height: 100%;
    width: 0%;
    transition: all 0.3s ease;
    border-radius: 4px;
}

/* 不同强度的颜色 */
.strength-bar.weak {
    width: 25%;
    background-color: #e74c3c;
}

.strength-bar.medium {
    width: 50%;
    background-color: #f39c12;
}

.strength-bar.strong {
    width: 75%;
    background-color: #3498db;
}

.strength-bar.very-strong {
    width: 100%;
    background-color: #2ecc71;
}

.strength-text {
    min-width: 100px;
    font-weight: 600;
}

.strength-text.weak {
    color: #e74c3c;
}

.strength-text.medium {
    color: #f39c12;
}

.strength-text.strong {
    color: #3498db;
}

.strength-text.very-strong {
    color: #2ecc71;
}

/* 算法选择 */
.select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 1rem;
    background-color: #f9fafb;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

.select:focus {
    outline: none;
    border-color: #667eea;
    background-color: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* 按钮组 */
.button-group {
    display: flex;
    gap: 12px;
    margin-bottom: 25px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 120px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background-color: #f1f5f9;
    color: #555;
    border: 2px solid #e1e5e9;
}

.btn-secondary:hover {
    background-color: #e2e8f0;
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

/* 结果样式 */
.result {
    background-color: #f0f4f8;
    font-family: 'Courier New', Courier, monospace;
    word-break: break-all;
}

/* 历史记录区域 */
.history-section {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.section-title {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: #555;
    font-weight: 600;
}

.history-list {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 5px;
}

.history-item {
    background-color: #f9fafb;
    border: 1px solid #e1e5e9;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 10px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.history-item:hover {
    background-color: #f0f4f8;
    border-color: #cbd5e1;
    transform: translateX(5px);
}

.history-item:last-child {
    margin-bottom: 0;
}

.history-item .original {
    font-weight: 600;
    color: #667eea;
    margin-bottom: 4px;
}

.history-item .encrypted {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 4px;
    word-break: break-all;
}

.history-item .algorithm {
    font-size: 0.8rem;
    color: #999;
    font-style: italic;
}

.no-history {
    color: #999;
    text-align: center;
    padding: 20px 0;
    font-style: italic;
}

/* 安全提示区域 */
.security-tips {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.tips-title {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: #555;
    font-weight: 600;
}

.tips-list {
    list-style: none;
}

.tips-list li {
    margin-bottom: 12px;
    padding-left: 25px;
    position: relative;
    color: #666;
    font-size: 0.95rem;
    line-height: 1.5;
}

.tips-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.8rem;
}

.tips-list li i {
    position: absolute;
    left: 3px;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 0.8rem;
}

/* Toast 提示 */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: #333;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    transform: translateX(400px);
    transition: transform 0.3s ease;
    font-size: 0.95rem;
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    background-color: #2ecc71;
}

.toast.error {
    background-color: #e74c3c;
}

.toast.info {
    background-color: #3498db;
}

/* 响应式设计 */
@media (max-width: 992px) {
    .main-content {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .security-tips {
        order: -1;
    }
    
    .title {
        font-size: 2rem;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .encryption-section,
    .history-section,
    .security-tips {
        padding: 20px;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .password-strength {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .strength-label,
    .strength-text {
        min-width: auto;
    }
    
    .title {
        font-size: 1.8rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .encryption-section,
    .history-section,
    .security-tips {
        padding: 15px;
    }
    
    .input,
    .select,
    .btn {
        padding: 10px 14px;
        font-size: 0.95rem;
    }
    
    .title {
        font-size: 1.5rem;
    }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.encryption-section,
.history-section,
.security-tips {
    animation: fadeIn 0.6s ease-out;
}

.history-item {
    animation: fadeIn 0.4s ease-out;
}

/* 加载状态 */
.loading {
    opacity: 0.7;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 无障碍设计 */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* 焦点样式 */
button:focus,
input:focus,
select:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* 禁用状态 */
:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}
