/**
 * 证件照压缩宝 - 样式表
 * 纯本地图片压缩工具样式
 */

/* ===== CSS变量定义 ===== */
:root {
    --primary-color: #3B82F6;
    --primary-hover: #2563EB;
    --primary-light: #EFF6FF;
    --success-color: #10B981;
    --success-light: #D1FAE5;
    --warning-color: #F59E0B;
    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --text-light: #9CA3AF;
    --border-color: #E5E7EB;
    --bg-color: #F9FAFB;
    --card-bg: #FFFFFF;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
}

/* ===== 基础重置 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    /* 使用系统字体栈，无需加载外部字体，100%可访问 */
    font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', 'Hiragino Sans GB', 'WenQuanYi Micro Hei', sans-serif;
    background: linear-gradient(135deg, #F0F9FF 0%, #E0F2FE 100%);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
}

/* ===== 用户协议弹窗 ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
    opacity: 1;
    transition: opacity 0.5s ease;
}

.modal-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

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

.modal-content {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    max-width: 560px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 20px 24px;
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
    color: white;
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    text-align: center;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-body p {
    margin-bottom: 12px;
    font-size: 0.9375rem;
    color: var(--text-secondary);
}

.modal-body ul {
    margin: 12px 0;
    padding-left: 20px;
}

.modal-body li {
    margin-bottom: 10px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.modal-body li strong {
    color: var(--text-primary);
}

.modal-body .warning-text {
    margin-top: 20px;
    padding: 12px;
    background: #FEF3C7;
    border-radius: var(--radius-sm);
    color: #92400E;
    font-weight: 500;
    text-align: center;
}

.modal-footer {
    padding: 16px 24px 24px;
    text-align: center;
}

.agree-btn {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.agree-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* ===== 容器布局 ===== */
.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px 16px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== 头部区域 ===== */
.header {
    text-align: center;
    margin-bottom: 32px;
}

.title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.subtitle::before,
.subtitle::after {
    content: '';
    width: 40px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-color), transparent);
}

/* ===== 上传区域 ===== */
.upload-section {
    margin-bottom: 24px;
}

.drop-zone {
    background: var(--card-bg);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 48px 24px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--primary-color);
    background: var(--primary-light);
}

.upload-icon {
    width: 64px;
    height: 64px;
    color: var(--text-light);
    margin-bottom: 16px;
}

.drop-text {
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.drop-hint {
    color: var(--text-light);
    font-size: 0.875rem;
    margin-bottom: 16px;
}

.select-btn {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    padding: 12px 32px;
    border-radius: var(--radius-full);
    font-size: 1rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.select-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

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

.format-hint {
    margin-top: 16px;
    font-size: 0.875rem;
    color: var(--text-light);
}

/* ===== 压缩控制区 ===== */
.control-section {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-lg);
}

.control-section.hidden {
    display: none;
}

/* ===== 图片对比区域 ===== */
.compare-container {
    margin-bottom: 24px;
}

.compare-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 16px;
}

.compare-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.compare-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.compare-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 4px 16px;
    background: var(--bg-color);
    border-radius: var(--radius-full);
}

.compare-compressed .compare-label {
    background: var(--primary-light);
    color: var(--primary-color);
}

.compare-image-box {
    width: 200px;
    height: 200px;
    background: var(--bg-color);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 3px solid var(--border-color);
    padding: 8px;
}

.compare-compressed .compare-image-box {
    border-color: var(--primary-color);
}

.compare-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.compare-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.compare-size {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.compare-kb {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.compare-arrow {
    font-size: 2rem;
    color: var(--primary-color);
    font-weight: 600;
}

/* ===== 控制面板 ===== */

/* ===== 控制面板 ===== */
.controls {
    position: relative;
}

.control-group {
    margin-bottom: 24px;
}

.control-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.value-badge {
    background: var(--primary-light);
    color: var(--primary-color);
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 600;
}

/* ===== 压缩模式切换 ===== */
.mode-switch {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.mode-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.25s ease;
}

.mode-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.mode-btn.active {
    background: var(--primary-light);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.mode-icon {
    width: 20px;
    height: 20px;
}

.mode-hint {
    font-size: 0.8125rem;
    color: var(--text-light);
    margin-top: 4px;
}

/* ===== 预估大小 ===== */
.estimated-hint {
    font-size: 0.9375rem;
    color: var(--text-primary);
    margin-top: 12px;
    text-align: center;
    font-weight: 500;
    background: linear-gradient(135deg, var(--primary-light) 0%, #F0F9FF 100%);
    padding: 10px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--primary-color);
}

.estimated-hint strong {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 1.125rem;
}

/* ===== 尺寸优先模式 ===== */
.preset-hint {
    font-size: 0.8125rem;
    color: var(--text-light);
    margin-top: 8px;
}

.scale-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}

.scale-input-group label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ===== 滑动条 ===== */
.slider {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--border-color);
    border-radius: var(--radius-full);
    outline: none;
    cursor: pointer;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: transform 0.2s ease;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: var(--shadow-md);
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 0.75rem;
    color: var(--text-light);
}

/* ===== 目标大小按钮 ===== */
.hint-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* ===== 尺寸按钮 ===== */
.size-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.size-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.size-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.size-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* ===== 自定义尺寸面板 ===== */
.custom-size-panel {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    margin-top: 12px;
    padding: 16px;
    background: var(--bg-color);
    border-radius: var(--radius-md);
}

.custom-size-panel.hidden {
    display: none;
}

.size-input-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.size-input-group label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.size-input {
    width: 100px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.2s ease;
}

.size-input:focus {
    border-color: var(--primary-color);
}

.size-unit {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.size-separator {
    font-size: 1.25rem;
    color: var(--text-light);
    padding-bottom: 8px;
}

.apply-btn {
    padding: 8px 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

.apply-btn:hover {
    background: var(--primary-hover);
}

/* ===== 压缩按钮 ===== */
.compress-btn {
    width: 100%;
    padding: 16px 32px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
}

.compress-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.compress-btn:disabled {
    background: var(--border-color);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-icon {
    width: 20px;
    height: 20px;
}

/* ===== 加载状态 ===== */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

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

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ===== 结果信息 ===== */
.result-info {
    margin-top: 24px;
    padding: 20px;
    background: var(--bg-color);
    border-radius: var(--radius-md);
}

.result-info.hidden {
    display: none;
}

.result-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 16px;
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-value.highlight {
    color: var(--primary-color);
}

.stat-value.success {
    color: var(--success-color);
}

.stat-arrow {
    font-size: 1.5rem;
    color: var(--text-light);
}

/* ===== 下载区域 ===== */
.download-section {
    margin-top: 24px;
    text-align: center;
}

.download-section.hidden {
    display: none;
}

.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 16px 48px;
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: var(--radius-full);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.download-hint {
    margin-top: 12px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ===== 页脚 ===== */
.footer {
    margin-top: auto;
    padding-top: 32px;
    text-align: center;
}

.privacy-note {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    padding: 16px 28px;
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.shield-icon {
    width: 18px;
    height: 18px;
    color: var(--success-color);
}

/* ===== 页脚 ===== */
.footer {
    text-align: center;
    padding: 20px;
    margin-top: auto;
}

.footer-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin: 12px 0;
}

.footer-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s ease;
}

.footer-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.footer-divider {
    color: var(--text-light);
    margin: 0 10px;
    opacity: 0.5;
}

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

.copyright {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.disclaimer {
    color: var(--text-light);
    font-size: 0.75rem;
    margin-top: 8px;
}

.beian {
    margin-top: 10px;
    font-size: 0.75rem;
    color: var(--text-light);
}

.beian a {
    color: var(--text-light);
    text-decoration: none;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.beian a:hover {
    opacity: 1;
    text-decoration: underline;
}

/* ===== 联系我们弹窗 ===== */
.contact-modal {
    text-align: center;
    padding: 40px 32px;
    max-width: 400px;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary);
}

.contact-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    background: var(--primary-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.contact-icon svg {
    width: 32px;
    height: 32px;
    color: var(--primary-color);
}

.contact-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.contact-email {
    font-size: 1.25rem;
    color: var(--primary-color);
    font-weight: 500;
    word-break: break-all;
    margin-bottom: 12px;
}

.contact-hint {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* ===== 隐藏类 ===== */
.hidden {
    display: none !important;
}

/* ===== 错误提示 ===== */
.error-message {
    padding: 12px 16px;
    background: #FEE2E2;
    color: #DC2626;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    margin-top: 12px;
    display: none;
}

.error-message.show {
    display: block;
}

/* ===== 统计信息栏 ===== */
.stats-bar {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-bottom: 24px;
    padding: 12px 20px;
    background: var(--card-bg);
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-sm);
}

.stats-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.stats-item em {
    font-style: normal;
    color: var(--primary-color);
    font-weight: 600;
}

.stats-icon {
    width: 18px;
    height: 18px;
    color: var(--text-light);
}

/* ===== 响应式设计 ===== */
@media (max-width: 768px) {
    .container {
        padding: 16px 12px;
    }

    .title {
        font-size: 1.5rem;
    }

    .subtitle {
        font-size: 0.875rem;
        flex-direction: column;
        gap: 4px;
    }

    .subtitle::before,
    .subtitle::after {
        display: none;
    }

    .drop-zone {
        padding: 32px 16px;
    }

    .upload-icon {
        width: 48px;
        height: 48px;
    }

    .control-section {
        padding: 16px;
    }

    .preview-container {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .preview-wrapper {
        min-height: 150px;
    }

    .preview-image {
        max-height: 200px;
    }

    .size-buttons {
        justify-content: center;
    }

    .custom-size-panel {
        flex-wrap: wrap;
        justify-content: center;
    }

    .result-stats {
        flex-direction: column;
    }

    .stat-arrow {
        transform: rotate(90deg);
    }

    .compress-btn,
    .download-btn {
        padding: 14px 24px;
        font-size: 1rem;
    }

    .privacy-note {
        font-size: 0.75rem;
        padding: 10px 16px;
    }

    .footer-links {
        gap: 8px;
        font-size: 0.75rem;
    }

    .copyright {
        font-size: 0.7rem;
    }
}

@media (max-width: 480px) {
    .title {
        font-size: 1.25rem;
    }

    .drop-text {
        font-size: 1rem;
    }

    .control-label {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .value-badge {
        margin-left: auto;
    }

    .size-btn {
        padding: 6px 12px;
        font-size: 0.8125rem;
    }
}

/* ===== 更新日志弹窗 ===== */
.changelog-modal {
    max-width: 480px;
    max-height: 70vh;
    overflow-y: auto;
    text-align: left;
    padding: 32px;
}

.changelog-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 24px;
    text-align: center;
}

.changelog-content {
    font-size: 0.9rem;
    line-height: 1.6;
}

.changelog-version {
    font-weight: 600;
    color: var(--primary-color);
    margin: 16px 0 8px 0;
}

.changelog-date {
    font-weight: 400;
    font-size: 0.8rem;
    color: var(--text-light);
    margin-left: 8px;
}

.changelog-list {
    margin: 0;
    padding-left: 20px;
    color: var(--text-secondary);
}

.changelog-list li {
    margin: 6px 0;
}
