/**
 * 下载功能样式
 */

/* 下载对话框 */
.download-dialog {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.download-dialog.active {
    opacity: 1;
    visibility: visible;
}

.download-dialog-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.download-dialog-content {
    position: relative;
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.download-dialog.active .download-dialog-content {
    transform: scale(1);
}

/* 对话框头部 */
.download-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 32px;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-radius: 20px 20px 0 0;
}

.download-dialog-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
}

.download-dialog-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.download-dialog-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* 对话框主体 */
.download-dialog-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px 32px;
}

/* 模型信息 */
.download-model-info {
    display: flex;
    gap: 20px;
    margin-bottom: 24px;
    padding: 20px;
    background: #f9fafb;
    border-radius: 12px;
}

.download-model-preview {
    width: 120px;
    height: 120px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: white;
}

.download-model-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.download-no-preview {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e5e7eb 0%, #d1d5db 100%);
    color: #9ca3af;
    font-size: 32px;
}

.download-model-details h4 {
    margin: 0 0 12px 0;
    font-size: 18px;
    font-weight: 600;
    color: #111827;
}

.download-model-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 13px;
    color: #6b7280;
}

.download-model-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* 格式选择 */
.download-formats {
    margin-bottom: 20px;
}

.download-formats h4 {
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 600;
    color: #111827;
}

.download-format-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
}

.download-format-option {
    cursor: pointer;
}

.download-format-option input[type="radio"] {
    display: none;
}

.format-card {
    padding: 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    text-align: center;
    transition: all 0.3s ease;
    background: white;
}

.download-format-option input[type="radio"]:checked + .format-card {
    border-color: #10b981;
    background: rgba(16, 185, 129, 0.05);
}

.format-card:hover {
    border-color: #10b981;
    transform: translateY(-2px);
}

.format-card i {
    font-size: 32px;
    color: #10b981;
    margin-bottom: 8px;
}

.format-name {
    display: block;
    font-weight: 600;
    color: #111827;
    margin-bottom: 4px;
}

.format-desc {
    display: block;
    font-size: 12px;
    color: #6b7280;
}

/* 下载选项 */
.download-options {
    margin-bottom: 20px;
    padding: 16px;
    background: #f9fafb;
    border-radius: 12px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    cursor: pointer;
    font-size: 14px;
    color: #374151;
}

.checkbox-label:last-child {
    margin-bottom: 0;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* 下载信息 */
.download-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(59, 130, 246, 0.1);
    border-left: 4px solid #3b82f6;
    border-radius: 8px;
    font-size: 13px;
    color: #1e40af;
}

.download-info i {
    font-size: 16px;
}

/* 对话框底部 */
.download-dialog-footer {
    border-top: 1px solid #e5e7eb;
    padding: 20px 32px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* 下载进度提示 */
.download-progress-toast {
    position: fixed;
    bottom: 32px;
    right: 32px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    padding: 16px 20px;
    z-index: 10002;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.download-progress-toast.active {
    opacity: 1;
    transform: translateY(0);
}

.download-progress-content {
    display: flex;
    align-items: center;
    gap: 16px;
}

.download-progress-content i {
    font-size: 24px;
    color: #10b981;
}

.download-progress-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.download-progress-title {
    font-weight: 600;
    color: #111827;
    font-size: 14px;
}

.download-progress-model {
    font-size: 13px;
    color: #6b7280;
}

/* 购买对话框 */
.purchase-dialog {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.purchase-dialog.active {
    opacity: 1;
    visibility: visible;
}

.purchase-dialog-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.purchase-dialog-content {
    position: relative;
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.purchase-dialog.active .purchase-dialog-content {
    transform: scale(1);
}

.purchase-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border-radius: 20px 20px 0 0;
}

.purchase-dialog-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
}

.purchase-dialog-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.purchase-dialog-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.purchase-dialog-body {
    padding: 24px;
}

.purchase-model-info {
    text-align: center;
    margin-bottom: 20px;
}

.purchase-model-info h4 {
    margin: 0 0 16px 0;
    font-size: 20px;
    font-weight: 700;
    color: #111827;
}

.purchase-price {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.price-label {
    font-size: 14px;
    color: #6b7280;
}

.price-value {
    font-size: 32px;
    font-weight: 700;
    color: #f59e0b;
}

.purchase-notice {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px;
    background: rgba(249, 115, 22, 0.1);
    border-left: 4px solid #f59e0b;
    border-radius: 8px;
    font-size: 14px;
    color: #92400e;
    margin: 0;
}

.purchase-dialog-footer {
    border-top: 1px solid #e5e7eb;
    padding: 20px 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* 下载历史 */
.download-history-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.download-history-modal.active {
    opacity: 1;
    visibility: visible;
}

.download-history-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.download-history-content {
    position: relative;
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.download-history-modal.active .download-history-content {
    transform: scale(1);
}

.download-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 32px;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    border-radius: 20px 20px 0 0;
}

.download-history-header h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: white;
    display: flex;
    align-items: center;
    gap: 12px;
}

.download-history-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.download-history-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.download-history-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px 32px;
}

.download-history-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    color: #9ca3af;
}

.download-history-empty i {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.download-history-empty p {
    font-size: 18px;
    color: #6b7280;
}

.download-history-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.download-history-item {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.download-history-item:hover {
    border-color: #6366f1;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.1);
}

.download-history-preview {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: #f3f4f6;
}

.download-history-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.download-history-info {
    flex: 1;
}

.download-history-info h4 {
    margin: 0 0 10px 0;
    font-size: 16px;
    font-weight: 600;
    color: #111827;
}

.download-history-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 13px;
    color: #6b7280;
}

.download-history-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.download-history-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-icon-small {
    width: 36px;
    height: 36px;
    border: none;
    background: #f3f4f6;
    color: #6b7280;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.btn-icon-small:hover {
    background: #10b981;
    color: white;
}

.download-history-footer {
    border-top: 1px solid #e5e7eb;
    padding: 20px 32px;
    display: flex;
    justify-content: flex-end;
}

/* 响应式 */
@media (max-width: 768px) {
    .download-dialog-content,
    .purchase-dialog-content,
    .download-history-content {
        width: 95%;
        max-height: 90vh;
    }

    .download-dialog-header,
    .download-dialog-body,
    .download-dialog-footer {
        padding: 20px;
    }

    .download-model-info {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .download-format-options {
        grid-template-columns: 1fr;
    }

    .download-history-item {
        flex-direction: column;
    }

    .download-history-preview {
        width: 100%;
        height: 150px;
    }
}
