/* 全局重置与基础样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #f0f7ff, #e3f2fd);
    color: #333;
    min-height: 100vh;
    padding: 20px;
    line-height: 1.5;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* 头部样式 */
header {
    text-align: center;
    margin-bottom: 28px;
}

header h1 {
    font-size: 2.2rem;
    color: #3498db;
    margin-bottom: 8px;
}

header p {
    color: #95a5a6;
    font-size: 1rem;
}

/* 主内容布局 */
.main-content {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
}

/* 面板通用样式 */
.panel {
    flex: 1;
    min-width: 320px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.12);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #eef4ff;
}

.panel:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(52, 152, 219, 0.2);
}

/* 面板头部 */
.panel-header {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    padding: 12px 25px;
    text-align: center;
}

.panel-header h2 {
    font-size: 1.4rem;
    font-weight: 600;
}

.divider {
    width: 40px;
    height: 3px;
    background: rgba(255, 255, 255, 0.7);
    margin: 4px auto;
    border-radius: 2px;
}

.panel-content {
    padding: 25px;
}

/* 上传区域 */
.upload-area {
    border: 2px dashed #d6eaf8;
    border-radius: 14px;
    padding: 36px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s ease;
    background-color: #f8fbff;
}

.upload-area:hover {
    border-color: #3498db;
    background-color: #f0f7ff;
}

.upload-icon {
    font-size: 2.8rem;
    margin-bottom: 12px;
    display: block;
    color: #3498db;
}

.upload-area p {
    color: #5d8aa8;
    font-size: 0.95rem;
}

/* 输入与输出区域标题 */
.panel-content h3 {
    color: #2c3e50;
    margin-bottom: 14px;
    font-size: 1.15rem;
    font-weight: 600;
}

footer {
    text-align: center;
    margin-top: 20px;
    color: #666;
    font-size: 0.9rem;
}

footer a,
footer a:visited,
footer a:hover,
footer a:active {
    color: #666;
    text-decoration: none;
}

/* 图片预览 */
#imagePreview {
    max-width: 100%;
    max-height: 180px;
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.06);
    display: block;
    margin: 0 auto;
    border: 1px solid #eef4ff;
}

/* Base64 输出区域 */
.copy-container {
    display: flex;
    gap: 12px;
}

#base64Output {
    flex: 1;
    min-height: 110px;
    padding: 14px;
    border: 1px solid #dce9f7;
    border-radius: 10px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.5;
    resize: vertical;
    background-color: #fafcff;
    color: #2c3e50;
    transition: border-color 0.2s;
}

#base64Output:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
}

.copy-btn {
    background: linear-gradient(to bottom, #3498db, #2980b9);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 14px 18px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 76px;
    box-shadow: 0 3px 8px rgba(52, 152, 219, 0.3);
}

.copy-btn:hover {
    background: linear-gradient(to bottom, #2980b9, #1f618d);
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(52, 152, 219, 0.4);
}

.copy-btn:active {
    transform: translateY(0);
}

.copy-icon {
    font-size: 1.25rem;
    margin-bottom: 4px;
}

/* Base64 输入区域 */
#base64Input {
    width: 100%;
    min-height: 110px;
    padding: 14px;
    border: 1px solid #dce9f7;
    border-radius: 10px;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.5;
    resize: vertical;
    margin-bottom: 16px;
    background-color: #fafcff;
    color: #2c3e50;
    transition: border-color 0.2s;
}

#base64Input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
}

.convert-btn {
    background: linear-gradient(to bottom, #3498db, #2980b9);
    color: white;
    border: none;
    border-radius: 10px;
    padding: 12px 20px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.2s ease;
    width: 100%;
    box-shadow: 0 3px 8px rgba(52, 152, 219, 0.3);
}

.convert-btn:hover {
    background: linear-gradient(to bottom, #2980b9, #1f618d);
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(52, 152, 219, 0.4);
}

.convert-btn:active {
    transform: translateY(0);
}

/* 解码图片区域 */
.image-container {
    text-align: center;
    padding: 12px;
    background-color: #f8fbff;
    border-radius: 10px;
    border: 1px solid #eef4ff;
}

#decodedImage {
    max-width: 100%;
    max-height: 280px;
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.06);
    display: block;
    margin: 0 auto;
}

/* 消息提示 */
.success-message {
    background: #e8f4fc;
    color: #2980b9;
    padding: 10px;
    border-radius: 8px;
    margin-top: 12px;
    text-align: center;
    font-weight: 600;
    border: 1px solid #c2e0f7;
}

.error-message {
    background: #fdf2f2;
    color: #e74c3c;
    padding: 10px;
    border-radius: 8px;
    margin-top: 12px;
    text-align: center;
    font-weight: 600;
    border: 1px solid #f5c6c6;
}

/* 隐藏/显示控制 */
.hidden {
    display: none !important;
}

/* 响应式优化 */
@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }

    header h1 {
        font-size: 2rem;
    }

    .copy-container {
        flex-direction: column;
    }

    .copy-btn {
        min-width: auto;
        padding: 12px;
    }
}