/* style.css - 只固定预览区版本 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f8f9fa;
    min-height: 100vh;
    padding-top: 200px; /* 为固定预览区留出空间 */
}

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

/* 页面标题 */
.page-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}

.page-title {
    color: #2c3e50;
    font-size: 28px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-title i {
    color: #667eea;
}

.sub-title {
    font-size: 16px;
    color: #7f8c8d;
    font-weight: normal;
    margin-left: 10px;
}

.page-tips {
    background: #e3f2fd;
    color: #1976d2;
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 固定预览区 */
.fixed-preview-section {
    position: fixed;
    top: 60px; /* 导航栏高度 */
    left: 0;
    right: 0;
    z-index: 100;
    background: white;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    height: 220px; /* 固定高度 */
    transition: none !important; /* 禁止过渡动画，防止闪烁 */
}

.preview-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 15px 20px;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-shrink: 0;
}

.preview-header h3 {
    color: #2c3e50;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.preview-header h3 i {
    color: #667eea;
}

.preview-status {
    background: #f0f4ff;
    color: #667eea;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

/* 预览显示区 */
.preview-display {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed #e0e0e0;
    border-radius: 10px;
    background: #fafafa;
    margin-bottom: 10px;
    overflow: hidden;
    min-height: 120px;
}

.preview-placeholder {
    text-align: center;
    color: #bdc3c7;
    padding: 15px;
}

.placeholder-icon {
    margin-bottom: 10px;
}

.preview-placeholder i {
    font-size: 40px;
    color: #e0e0e0;
}

.preview-placeholder p {
    font-size: 14px;
    margin: 0;
}

/* 图片预览 */
.preview-image-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.image-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: white;
}

.preview-image {
    max-width: 100%;
    max-height: 100%;
    transition: transform 0.3s ease;
}

.image-controls {
    padding: 10px;
    display: flex;
    justify-content: center;
    gap: 8px;
    background: #fafafa;
    border-top: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.control-btn {
    width: 36px;
    height: 36px;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: all 0.3s ease;
    font-size: 14px;
}

.control-btn:hover {
    background: #f8f9fa;
    color: #667eea;
    border-color: #667eea;
}

.control-btn.download {
    background: #28a745;
    color: white;
    border-color: #28a745;
}

.control-btn.download:hover {
    background: #218838;
    border-color: #218838;
}

.control-btn.download:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #6c757d;
    border-color: #6c757d;
}

.control-btn.copy {
    background: #17a2b8;
    color: white;
    border-color: #17a2b8;
}

.control-btn.copy:hover {
    background: #138496;
    border-color: #138496;
}

.control-btn.copy:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #6c757d;
    border-color: #6c757d;
}

/* 预览信息 */
.preview-info {
    padding: 10px 0;
    flex-shrink: 0;
}

.info-row {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.info-label {
    font-size: 13px;
    color: #7f8c8d;
}

.info-value {
    font-size: 13px;
    color: #333;
    font-weight: 500;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 滚动内容区域 */
.scroll-content {
    margin-top: 20px;
    position: relative;
    z-index: 1;
}

/* 功能区域 */
.function-section {
    margin-bottom: 30px;
}

.function-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.function-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.05);
}

.function-card h4 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.function-card h4 i {
    color: #667eea;
}

/* 输入区域 */
.input-area {
    margin-top: 10px;
}

.form-textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    resize: vertical;
    min-height: 80px;
    line-height: 1.5;
    transition: all 0.3s ease;
    font-family: inherit;
}

.form-textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    font-size: 13px;
}

.char-count {
    color: #7f8c8d;
}

.clear-btn {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    font-size: 14px;
    padding: 5px 10px;
    border-radius: 4px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

.clear-btn:hover {
    background: #f8d7da;
}

/* 字体选择 */
.font-select-area {
    margin-top: 10px;
}

.form-select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23667eea' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px;
}

.form-select:focus {
    outline: none;
    border-color: #667eea;
}

/* 设置面板 */
.settings-panel {
    margin-top: 10px;
}

.setting-item {
    margin-bottom: 20px;
}

.setting-item label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.setting-item label i {
    color: #667eea;
    width: 20px;
}

/* 大小控制 */
.size-control {
    display: flex;
    align-items: center;
    gap: 15px;
}

.size-slider {
    flex: 1;
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

.size-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
}

.size-display {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 50px;
}

.size-display span:first-child {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    min-width: 30px;
    text-align: center;
}

.unit {
    font-size: 14px;
    color: #7f8c8d;
}

/* 颜色设置 */
.color-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.color-control {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.color-control span {
    font-size: 13px;
    color: #666;
}

.color-picker-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-picker-group input[type="color"] {
    width: 40px;
    height: 40px;
    padding: 2px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    background: white;
}

.color-value {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #666;
    background: #f8f9fa;
    padding: 6px 10px;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

/* 选项 */
.options {
    margin-top: 25px;
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.option-label input {
    display: none;
}

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid #e0e0e0;
    border-radius: 4px;
    display: inline-block;
    position: relative;
    transition: all 0.3s ease;
}

.option-label input:checked + .checkmark {
    background: #667eea;
    border-color: #667eea;
}

.checkmark:after {
    content: '';
    position: absolute;
    display: none;
    left: 6px;
    top: 2px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.option-label input:checked + .checkmark:after {
    display: block;
}

.option-text {
    font-size: 14px;
    color: #333;
}

/* 操作按钮 */
.action-buttons {
    display: flex;
    gap: 15px;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #f0f0f0;
}

.btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #f8f9fa;
    color: #6c757d;
    border: 2px solid #e0e0e0;
}

.btn-secondary:hover {
    background: #e9ecef;
    transform: translateY(-2px);
}

/* 错误消息 */
.error-message {
    background: #fee;
    border: 2px solid #fcc;
    border-radius: 8px;
    padding: 12px 15px;
    margin-bottom: 15px;
    color: #c33;
    font-weight: 500;
    display: none;
}

/* 字体库区域 */
.font-library-section {
    margin-top: 40px;
}

/* 字体分类导航 */
.font-category-nav {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.05);
}

.category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.category-tab {
    padding: 10px 18px;
    background: #f8f9fa;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    color: #666;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-tab:hover {
    border-color: #667eea;
    color: #667eea;
}

.category-tab.active {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

/* 字体搜索 */
.font-search {
    position: relative;
    max-width: 400px;
}

.font-search i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}

.font-search input {
    width: 100%;
    padding: 12px 15px 12px 45px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s ease;
}

.font-search input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 16px;
    padding: 5px;
}

.search-clear:hover {
    color: #dc3545;
}

/* 字体网格容器 */
.font-grid-container {
    margin-bottom: 40px;
}

.font-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

.font-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
    cursor: pointer;
}

.font-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.15);
}

.card-img {
    position: relative;
    height: 140px;
    overflow: hidden;
    background: white;
}

.card-img img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 15px;
}

.card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(102, 126, 234, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.font-card:hover .card-overlay {
    opacity: 1;
}

.card-overlay i {
    font-size: 40px;
    margin-bottom: 10px;
}

.card-overlay span {
    font-size: 14px;
    font-weight: 500;
}

.card-info {
    padding: 15px;
    border-top: 1px solid #f0f0f0;
}

.card-info h4 {
    margin: 0 0 10px 0;
    color: #2c3e50;
    font-size: 16px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card-tags {
    display: flex;
    gap: 8px;
}

.card-tag {
    display: inline-block;
    padding: 4px 10px;
    background: #e3f2fd;
    color: #1976d2;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

/* 最近使用字体 */
.recent-fonts-section {
    margin-bottom: 40px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h3 {
    color: #2c3e50;
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-header h3 i {
    color: #667eea;
}

.clear-recent {
    background: none;
    border: 2px solid #f8d7da;
    color: #dc3545;
    padding: 8px 15px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.clear-recent:hover {
    background: #f8d7da;
}

.recent-fonts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
}

.recent-font-card {
    background: white;
    border-radius: 10px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid #f0f0f0;
}

.recent-font-card:hover {
    border-color: #667eea;
    transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.1);
}

.recent-font-icon {
    width: 45px;
    height: 45px;
    background: #f0f4ff;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #667eea;
    font-size: 20px;
    flex-shrink: 0;
}

.recent-font-info {
    flex: 1;
    min-width: 0;
}

.recent-font-info h5 {
    margin: 0 0 5px 0;
    color: #333;
    font-size: 15px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.recent-font-time {
    font-size: 12px;
    color: #7f8c8d;
}

.empty-recent {
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    color: #bdc3c7;
}

.empty-recent i {
    font-size: 50px;
    margin-bottom: 15px;
    opacity: 0.5;
}

.empty-recent p {
    font-size: 16px;
    margin: 0;
}

/* 版权声明 */
.copyright-notice {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin-top: 40px;
    border-left: 5px solid #667eea;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.05);
}

.notice-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
}

.notice-header i {
    color: #667eea;
    font-size: 24px;
}

.notice-header h4 {
    color: #2c3e50;
    margin: 0;
    font-size: 18px;
}

.copyright-notice p {
    color: #666;
    line-height: 1.7;
    margin-bottom: 15px;
}

.copyright-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #1976d2;
    text-decoration: none;
    font-weight: 500;
    padding: 10px 18px;
    background: #f0f8ff;
    border-radius: 8px;
    border: 1px solid #bbdefb;
    transition: all 0.3s ease;
}

.copyright-link:hover {
    background: #e3f2fd;
    transform: translateX(5px);
}

/* 加载遮罩层 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    display: none;
}

.loading-content {
    text-align: center;
}

.spinner {
    border: 5px solid #f3f3f3;
    border-top: 5px solid #667eea;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-content p {
    color: #667eea;
    font-size: 18px;
    font-weight: 500;
}

/* Toast消息 */
.toast-message {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s ease;
}

.toast-message.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .font-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
}

@media (max-width: 992px) {
    .function-grid {
        grid-template-columns: 1fr;
    }
    
    .category-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 10px;
    }
    
    .category-tab {
        flex-shrink: 0;
    }
    
    body {
        padding-top: 250px; /* 在平板设备上增加一点顶部间距 */
    }
    
    .fixed-preview-section {
        height: 240px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    .page-title {
        font-size: 22px;
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .sub-title {
        margin-left: 0;
        font-size: 15px;
    }
    
    .page-tips {
        font-size: 13px;
        padding: 8px 12px;
    }
    
    .fixed-preview-section {
        height: 260px; /* 在手机设备上增加高度 */
    }
    
    .preview-container {
        padding: 12px 15px;
    }
    
    .image-controls {
        padding: 8px;
        gap: 6px;
    }
    
    .control-btn {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
    
    .font-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .font-category-nav {
        padding: 15px;
    }
    
    .recent-fonts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    body {
        padding-top: 280px; /* 在手机设备上增加更多顶部间距 */
    }
}

@media (max-width: 576px) {
    .page-title {
        font-size: 20px;
    }
    
    .fixed-preview-section {
        height: 280px; /* 在小手机上增加更多高度 */
    }
    
    .preview-display {
        min-height: 140px;
    }
    
    .function-card {
        padding: 15px;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .font-grid {
        grid-template-columns: 1fr;
    }
    
    .recent-fonts-grid {
        grid-template-columns: 1fr;
    }
    
    .copyright-notice {
        padding: 20px;
    }
    
    body {
        padding-top: 300px; /* 在小手机上增加更多顶部间距 */
    }
}