/* 全局样式 */
:root {
    /* 紫色系主题配色方案 */
    --primary-color: #667eea;
    --primary-dark: #5a67d8;
    --primary-light: #7f9cf5;
    --secondary-color: #764ba2;
    --text-color: #f8fafc;
    --text-light: #cbd5e1;
    --bg-color: rgba(15, 23, 42, 0.8);
    --bg-secondary: rgba(30, 41, 59, 0.6);
    --border-color: rgba(255, 255, 255, 0.1);
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
    --radius-sm: 0.25rem;
    --radius-md: 0.5rem;
    --radius-lg: 1rem;
    --gradient-primary: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    background-image: url('https://picsum.photos/id/1036/1920/1080');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 导航区样式 */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    margin-bottom: 2rem;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: 1rem 1.5rem;
    transition: all 0.3s ease;
}

.header:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo span {
    font-weight: 800;
}

.nav {
    display: flex;
    gap: 0.5rem;
}

.nav-btn {
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    border-color: rgba(255, 255, 255, 0.2);
}

.nav-btn.active {
    background: var(--gradient-primary);
    color: white;
    border-color: transparent;
    box-shadow: 0 0 15px rgba(102, 126, 234, 0.5);
}

/* 主内容区样式 */
.main-content {
    position: relative;
}

.section {
    display: none;
    animation: fadeIn 0.3s ease;
}

.section.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 加密模块样式 */
.input-area, .preview-area, .result-area {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}

.input-area:hover, .preview-area:hover, .result-area:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.input-group, .settings-group, .upload-group {
    margin-bottom: 1.5rem;
}

.input-group label, .settings-group label, .upload-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-color);
}

textarea, input[type="text"], input[type="number"] {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s ease;
    resize: vertical;
    min-height: 100px;
}

textarea:focus, input[type="text"]:focus, input[type="number"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3);
}

input[type="number"] {
    min-height: auto;
    width: 120px;
}

.input-actions, .preview-actions, .result-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.setting-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.unit {
    color: var(--text-light);
}

/* 按钮样式 */
.primary-btn, .secondary-btn, .action-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.primary-btn {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-sm);
    border: none;
}

.primary-btn:hover:not(:disabled) {
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.6);
    transform: translateY(-2px);
}

.secondary-btn {
    background: rgba(255, 255, 255, 0.05);
    color: var(--primary-light);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.secondary-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 15px rgba(102, 126, 234, 0.4);
    border-color: rgba(102, 126, 234, 0.3);
    transform: translateY(-2px);
}

.action-btn {
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-light);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.875rem;
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.action-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    border-color: var(--primary-light);
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.3);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 预览区样式 */
.preview-container, .result-container {
    position: relative;
    width: 100%;
    min-height: 200px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

#preview-canvas {
    max-width: 100%;
    max-height: 500px;
    display: none;
}

.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: var(--text-light);
    text-align: center;
    padding: 1rem;
}

#decrypted-text {
    width: 100%;
    height: 100%;
    min-height: 200px;
    display: none;
}

/* 上传区域样式 */
.upload-container {
    position: relative;
    width: 100%;
    height: 200px;
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-container:hover {
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
    transform: translateY(-2px);
}

#image-upload {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.upload-placeholder {
    text-align: center;
    color: var(--text-light);
}

.hint {
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

/* 帮助模块样式 */
.help-content {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
}

.help-content:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.help-section {
    margin-bottom: 2rem;
}

.help-section h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.help-section ol, .help-section ul {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.help-section li {
    margin-bottom: 0.5rem;
}

/* 状态提示样式 */
.status-message {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    opacity: 0;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.status-message.show {
    opacity: 1;
}

.status-message.success {
    background-color: var(--success-color);
    color: white;
}

.status-message.error {
    background-color: var(--error-color);
    color: white;
}

.status-message.warning {
    background-color: var(--warning-color);
    color: white;
}

/* 加载动画样式 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
    box-shadow: 0 0 30px rgba(102, 126, 234, 0.6);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay.hidden {
    display: none;
}

/* 响应式设计 */
@media (min-width: 768px) {
    #encrypt-section, #decrypt-section {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1.5rem;
    }
    
    #encrypt-section.active, #decrypt-section.active {
        display: grid;
    }
    
    .input-area, .preview-area, .result-area {
        margin-bottom: 0;
    }
}

@media (max-width: 767px) {
    .header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .nav {
        width: 100%;
        justify-content: space-between;
    }
    
    .nav-btn {
        flex: 1;
        text-align: center;
    }
    
    .setting-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    input[type="number"] {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0.75rem;
    }
    
    .input-area, .preview-area, .result-area, .help-content {
        padding: 1rem;
    }
    
    .primary-btn, .secondary-btn {
        width: 100%;
    }
    
    .input-actions, .preview-actions, .result-actions {
        flex-direction: column;
    }
    
    .action-btn {
        width: 100%;
    }
}