/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

/* 头部样式 */
.header {
    text-align: center;
    padding: 2rem 1rem;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.header h1 {
    font-size: 2.5rem;
    color: #4a5568;
    margin-bottom: 0.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header p {
    font-size: 1.1rem;
    color: #718096;
}

/* 主容器样式 */
.main-container {
    max-width: 1400px;
    margin: 0 auto;
}

/* 锚点导航样式 */
.anchor-navigation {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.anchor-link {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    text-decoration: none;
    color: inherit;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    overflow: hidden;
    position: relative;
    border: 2px solid transparent;
    display: flex;
    align-items: center;
    padding: 1.5rem;
    gap: 1.5rem;
    min-height: 120px;
}

.anchor-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #4299e1, #3182ce);
    transform: scaleX(0);
    transition: transform 0.3s ease;
    transform-origin: left;
}

.anchor-link:hover {
    transform: translateY(-8px);
    box-shadow: 0 16px 40px rgba(66, 153, 225, 0.25);
    border-color: rgba(66, 153, 225, 0.3);
}

.anchor-link:hover::before {
    transform: scaleX(1);
}

.anchor-link.active {
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    color: white;
    border-color: #2b6cb0;
    transform: translateY(-4px);
    box-shadow: 0 12px 30px rgba(66, 153, 225, 0.3);
}

.anchor-link.active::before {
    transform: scaleX(1);
}

.anchor-link.active:hover {
    transform: translateY(-8px);
}

.anchor-icon {
    flex-shrink: 0;
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.anchor-link:hover .anchor-icon {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.3);
}

.anchor-link.active .anchor-icon {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

.anchor-icon i {
    font-size: 2rem;
    color: white;
    transition: transform 0.3s ease;
}

.anchor-content {
    flex: 1;
    min-width: 0;
}

.anchor-content h3 {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #2d3748;
    transition: color 0.3s ease;
}

.anchor-link.active .anchor-content h3 {
    color: white;
}

.anchor-content p {
    font-size: 0.95rem;
    color: #718096;
    line-height: 1.4;
    transition: color 0.3s ease;
}

.anchor-link.active .anchor-content p {
    color: rgba(255, 255, 255, 0.9);
}

/* 标签页内容容器样式 */
.tab-content-container {
    background: none;
    min-height: 600px;
}

.tab-content {
    display: none;
    animation: fadeIn 0.4s ease;
}

.tab-content.active {
    display: block;
}

/* 模块样式 */
.module {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    margin-bottom: 2rem;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.module:hover {
    transform: translateY(-5px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.15);
}

/* 模块主体样式 */
.module-body {
    padding: 2rem;
}

/* 输入区域样式 */
.input-section {
    margin-bottom: 2rem;
}

/* 文件选择器样式 */
.file-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2.5rem;
    border: 3px dashed #cbd5e0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f8fafc;
    gap: 1rem;
}

.file-label:hover {
    border-color: #4299e1;
    background: #ebf8ff;
    transform: translateY(-5px);
}

.file-label i {
    font-size: 3rem;
    color: #718096;
}

.file-label span {
    font-size: 1.2rem;
    color: #4a5568;
    font-weight: 600;
}

.file-input {
    display: none;
}

/* Base64输入组样式 */
.base64-input-group {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.base64-input {
    width: 100%;
    height: 200px;
    padding: 1rem;
    border: 2px solid #cbd5e0;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: 'Courier New', Courier, monospace;
    resize: vertical;
    transition: all 0.3s ease;
    background: #f8fafc;
}

.base64-input:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 4px rgba(66, 153, 225, 0.1);
    background: white;
}

/* 按钮样式 */
.btn {
    padding: 0.875rem 1.75rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
}

.btn:active:not(:disabled) {
    transform: translateY(-1px);
}

/* 复制按钮样式 */
.btn-copy {
    background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
    color: white;
}

.btn-copy:hover:not(:disabled) {
    background: linear-gradient(135deg, #dd6b20 0%, #c05621 100%);
}

/* 下载按钮样式 */
.btn-download {
    background: linear-gradient(135deg, #9f7aea 0%, #805ad5 100%);
    color: white;
}

.btn-download:hover:not(:disabled) {
    background: linear-gradient(135deg, #805ad5 0%, #6b46c1 100%);
}

/* 按钮组样式 */
.button-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    width: 100%;
}

/* URL输入组样式 */
.url-input-group {
    display: flex;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
}

.url-input {
    flex: 1;
    padding: 1rem;
    border: 2px solid #cbd5e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #f8fafc;
    min-width: 0;
    /* 允许输入框收缩 */
}

.url-input:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 4px rgba(66, 153, 225, 0.1);
    background: white;
}

/* 转换按钮样式 */
.btn-convert {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
}

.btn-convert:hover:not(:disabled) {
    background: linear-gradient(135deg, #38a169 0%, #2f855a 100%);
}

/* 清空按钮样式 */
.btn-clear {
    background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
    color: white;
    margin-left: auto;
    /* 右对齐 */
}

.btn-clear:hover:not(:disabled) {
    background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%);
}

/* 状态区域样式 */
.status-section {
    margin-bottom: 1.5rem;
    min-height: 2.5rem;
}

.status {
    padding: 1rem;
    border-radius: 8px;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.status.success {
    background: linear-gradient(135deg, #c6f6d5, #9ae6b4);
    color: #22543d;
    border: 1px solid #9ae6b4;
}

.status.error {
    background: linear-gradient(135deg, #fed7d7, #feb2b2);
    color: #742a2a;
    border: 1px solid #feb2b2;
}

.status.loading {
    background: linear-gradient(135deg, #ebf8ff, #bee3f8);
    color: #2b6cb0;
    border: 1px solid #bee3f8;
}

/* 加载指示器样式 */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(43, 108, 176, 0.3);
    border-radius: 50%;
    border-top-color: #2b6cb0;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 文件信息样式 */
.file-info {
    background: linear-gradient(135deg, #f7fafc, #edf2f7);
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.file-info h4 {
    font-size: 1.2rem;
    color: #2d3748;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.file-info-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid #edf2f7;
}

.file-info-item:last-child {
    margin-bottom: 0;
    border-bottom: none;
}

.file-info-label {
    font-weight: 600;
    color: #4a5568;
}

.file-info-value {
    color: #2d3748;
    font-weight: 500;
    text-align: right;
    word-break: break-all;
}

/* 面板标题样式 */
.panel-title {
    font-size: 1.3rem;
    color: #2d3748;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #e2e8f0;
    font-weight: 600;
}

/* 标题容器样式 */
.title-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #e2e8f0;
}

/* 标题按钮样式 */
.title-btn {
    background: none;
    border: none;
    color: #2d3748;
    font-size: 1.3rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    margin: 0;
    border-radius: 0;
    transition: all 0.3s ease;
    font-family: inherit;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.title-btn:hover {
    color: #4299e1;
    transform: translateY(-2px);
}

.title-btn:active {
    transform: translateY(0);
}

/* 结果区域样式 */
.result-section {
    background: linear-gradient(135deg, #f7fafc, #edf2f7);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* 图片预览样式 */
.image-preview-section {
    background: linear-gradient(135deg, #f7fafc, #edf2f7);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.image-preview-section h3 {
    font-size: 1.3rem;
    color: #2d3748;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.image-preview {
    flex: 1;
    min-height: 300px;
    border: 2px dashed #cbd5e0;
    border-radius: 8px;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
    transition: all 0.3s ease;
}

.image-preview:hover {
    border-color: #4299e1;
}

.preview-placeholder {
    text-align: center;
    color: #718096;
    padding: 2rem;
}

.preview-placeholder i {
    font-size: 4rem;
    margin-bottom: 1rem;
    color: #cbd5e0;
}

.preview-placeholder p {
    font-size: 1.1rem;
    color: #718096;
}

#preview-image,
.preview-image {
    max-width: 100%;
    max-height: 400px;
    object-fit: contain;
    transition: transform 0.3s ease;
    border-radius: 4px;
}

#preview-image:hover,
.preview-image:hover {
    transform: scale(1.02);
}

/* 固定图片容器 */
.fixed-image-container {
    width: 100%;
    height: 250px;
    border: 2px dashed #cbd5e0;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.fixed-image-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

/* 结果文本域样式 */
.result-text {
    width: 100%;
    flex: 1;
    min-height: 300px;
    padding: 1rem;
    border: 2px solid #cbd5e0;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: 'Courier New', Courier, monospace;
    resize: vertical;
    background: #ffffff;
    overflow-y: auto;
    transition: all 0.3s ease;
}

.result-text:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 4px rgba(66, 153, 225, 0.1);
}

/* 下载组样式 */
.download-group {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.filename-input {
    padding: 0.875rem;
    border: 2px solid #cbd5e0;
    border-radius: 8px;
    font-size: 1rem;
    width: 200px;
    transition: all 0.3s ease;
    background: #ffffff;
}

.filename-input:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 4px rgba(66, 153, 225, 0.1);
}

/* 页脚样式 */
.footer {
    text-align: center;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.95);
    color: #718096;
    font-size: 1rem;
    margin-top: 2rem;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* 布局样式 */
.conversion-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

.left-panel,
.right-panel {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.left-panel>*,
.right-panel>* {
    flex: 1;
}

/* 统一高度处理 */
.left-panel>div,
.right-panel>div {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* 左右面板对齐优化 */
.left-panel {
    align-items: stretch;
}

.right-panel {
    align-items: stretch;
}

/* 面板标题样式 */
.panel-title {
    font-size: 1.3rem;
    color: #2d3748;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #e2e8f0;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .conversion-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .left-panel,
    .right-panel {
        gap: 1.5rem;
    }

    .anchor-navigation {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 1.25rem;
    }

    .left-panel>*,
    .right-panel>* {
        height: auto;
    }
}

@media (max-width: 768px) {
    body {
        padding: 15px;
    }

    .header {
        padding: 1.5rem 1rem;
    }

    .header h1 {
        font-size: 2rem;
    }

    .header p {
        font-size: 1rem;
    }

    .anchor-navigation {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .anchor-link {
        padding: 1.25rem;
        min-height: 100px;
        gap: 1rem;
    }

    .anchor-icon {
        width: 60px;
        height: 60px;
    }

    .anchor-icon i {
        font-size: 1.5rem;
    }

    .anchor-content h3 {
        font-size: 1.1rem;
    }

    .anchor-content p {
        font-size: 0.9rem;
    }

    .url-input-group {
        flex-direction: column;
    }

    .download-group {
        flex-direction: column;
        align-items: stretch;
    }

    .filename-input {
        width: 100%;
    }

    .module-body {
        padding: 1.5rem;
    }

    .file-label {
        padding: 1.5rem;
    }

    .btn {
        padding: 0.75rem 1.25rem;
        font-size: 0.9rem;
    }

    .result-text {
        min-height: 200px;
    }

    .fixed-image-container {
        height: 200px;
    }

    .image-preview {
        min-height: 200px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .header {
        padding: 1rem;
    }

    .header h1 {
        font-size: 1.8rem;
    }

    .module-body {
        padding: 1rem;
    }

    .file-label {
        padding: 1.25rem;
    }

    .file-label i {
        font-size: 2rem;
    }

    .file-label span {
        font-size: 1rem;
    }

    .url-input,
    .base64-input,
    .filename-input {
        padding: 0.75rem;
        font-size: 0.9rem;
    }

    .result-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .fixed-image-container {
        height: 150px;
    }

    .image-preview {
        min-height: 150px;
    }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #cbd5e0, #a0aec0);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #a0aec0, #718096);
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.status,
.file-info,
.result-section,
.image-preview-section {
    animation: fadeIn 0.4s ease;
}

/* 加载动画 */
.loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(10px);
}

.loader-spinner {
    width: 60px;
    height: 60px;
    border: 6px solid #f3f3f3;
    border-top: 6px solid #4299e1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}