/* PDF旋转工具样式 */
.pdf-rotate-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px;
    animation: fadeIn 0.4s ease;
}

/* 错误消息 */
.error-message {
    display: none;
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border: 1px solid #f87171;
    border-left: 4px solid #dc2626;
    color: #991b1b;
    padding: 10px 14px;
    margin-bottom: 12px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.5;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.1);
    animation: slideInDown 0.3s ease;
}

.error-message.show {
    display: block;
}

@keyframes slideInDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* 步骤区域 */
.step-section {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
}

.step-section:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.step-hidden {
    display: none;
}

.step-header {
    display: flex;
    align-items: center;
    margin-bottom: 16px;
    gap: 12px;
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border-radius: 50%;
    font-weight: bold;
    font-size: 15px;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.step-header h3 {
    margin: 0;
    font-size: 17px;
    color: #1f2937;
    font-weight: 600;
}

/* 文件上传区域 */
.file-upload-area {
    position: relative;
    border: 2px dashed #d1d5db;
    border-radius: 10px;
    padding: 32px;
    text-align: center;
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    cursor: pointer;
    transition: all 0.3s ease;
}

.file-upload-area:hover {
    border-color: #3b82f6;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.file-upload-area.drag-over {
    border-color: #2563eb;
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    transform: scale(1.02);
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 12px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.upload-text {
    color: #6b7280;
    font-size: 13px;
    line-height: 1.6;
}

.upload-text strong {
    color: #3b82f6;
    font-size: 14px;
}

.upload-hint {
    font-size: 12px;
    color: #9ca3af;
}

.file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-info {
    display: none;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 1px solid #86efac;
    border-radius: 8px;
    padding: 12px 16px;
    margin-top: 12px;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.1);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.file-info.show {
    display: flex;
}

.file-name {
    color: #065f46;
    font-size: 13px;
    font-weight: 600;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
}

.file-name::before {
    content: '📄';
    font-size: 16px;
}

.file-remove {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.2);
}

.file-remove:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3);
}

.file-remove:active {
    transform: translateY(0);
}

/* 旋转角度选择器 */
.rotation-selector {
    margin-bottom: 16px;
}

.rotation-label {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.rotation-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.rotation-btn {
    flex: 1;
    min-width: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 14px 18px;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.25s ease;
    font-size: 13px;
    color: #374151;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.rotation-btn:hover {
    border-color: #3b82f6;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.rotation-btn.active {
    border-color: #2563eb;
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    color: #1e40af;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
    transform: scale(1.02);
}

.rotation-icon {
    font-size: 28px;
    transition: transform 0.3s ease;
}

.rotation-btn:hover .rotation-icon {
    transform: rotate(15deg);
}

.rotation-btn.active .rotation-icon {
    transform: rotate(360deg);
}

/* 页面工具栏 */
.page-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    padding: 12px;
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    border-radius: 8px;
    flex-wrap: wrap;
    gap: 12px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.03);
}

.page-selection-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-small {
    padding: 7px 14px;
    font-size: 12px;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    color: #374151;
    font-weight: 500;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.btn-small:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-small:active {
    transform: translateY(0);
}

.btn-ai {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    border-color: #f59e0b;
    color: white;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.2);
}

.btn-ai:hover {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    box-shadow: 0 4px 8px rgba(245, 158, 11, 0.3);
}

.page-info-text {
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
}

.page-info-text strong {
    color: #1f2937;
    font-size: 14px;
    font-weight: 700;
}

.page-info-separator {
    margin-left: 16px;
}

/* 页面网格 */
.page-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.page-item {
    position: relative;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.page-item:hover {
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
    transform: translateY(-3px);
}

.page-item.selected {
    border-color: #2563eb;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
    transform: scale(1.02);
}

.page-checkbox {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 20px;
    height: 20px;
    cursor: pointer;
    z-index: 10;
    accent-color: #3b82f6;
}

.page-preview {
    width: 100%;
    height: 180px;
    background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}

.page-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.page-item:hover .page-preview img {
    transform: scale(1.05);
}

.page-preview-placeholder {
    font-size: 42px;
    color: #d1d5db;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.page-number {
    font-size: 13px;
    color: #6b7280;
    font-weight: 600;
}

/* 操作按钮 */
.action-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 4px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn span {
    font-size: 18px;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

.btn-secondary {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: white;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    box-shadow: 0 6px 16px rgba(124, 58, 237, 0.35);
}

.btn-reset {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.btn-reset:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.35);
}

.btn-download {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    text-decoration: none;
}

.btn-download:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.35);
}

.btn-disabled,
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
}

.btn-disabled:hover,
.btn:disabled:hover {
    transform: none !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
}

/* 加载状态 */
.loading {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    animation: fadeIn 0.2s ease;
}

.loading.show {
    display: flex;
}

.spinner {
    width: 56px;
    height: 56px;
    border: 5px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading p {
    color: white;
    margin-top: 20px;
    font-size: 15px;
    font-weight: 500;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* 成功消息 */
.success-message {
    display: flex;
    align-items: center;
    gap: 16px;
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    border: 1px solid #6ee7b7;
    border-left: 4px solid #10b981;
    border-radius: 10px;
    padding: 18px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.15);
    animation: slideInUp 0.4s ease;
}

@keyframes slideInUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.success-icon {
    font-size: 42px;
    animation: scaleIn 0.5s ease;
}

@keyframes scaleIn {
    from {
        transform: scale(0);
    }
    to {
        transform: scale(1);
    }
}

.success-text h4 {
    margin: 0 0 6px 0;
    color: #065f46;
    font-size: 16px;
    font-weight: 700;
}

.success-text p {
    margin: 0;
    color: #047857;
    font-size: 13px;
    line-height: 1.6;
}

.download-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.tips-text {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border: 1px solid #fde68a;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 13px;
    color: #92400e;
    line-height: 1.6;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.1);
}

/* 使用提示 */
.tips-section {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #bae6fd;
    border-left: 4px solid #0ea5e9;
    border-radius: 10px;
    padding: 16px 20px;
    margin-top: 16px;
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.1);
}

.tips-section-green {
    margin-top: 12px;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-left-color: #10b981;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.1);
}

.tips-section-blue {
    margin-top: 12px;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border-left-color: #3b82f6;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
}

.tips-section-yellow {
    margin-top: 12px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-left-color: #f59e0b;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.1);
}

.tips-section h4 {
    margin: 0 0 12px 0;
    color: #0c4a6e;
    font-size: 15px;
    font-weight: 700;
}

.tips-section ul {
    margin: 0;
    padding-left: 22px;
    color: #075985;
    font-size: 13px;
    line-height: 1.9;
}

.tips-section li {
    margin-bottom: 6px;
}

/* Toast消息 */
.toast-message {
    position: fixed;
    top: 24px;
    right: 24px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 14px 24px;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(16, 185, 129, 0.35);
    z-index: 10000;
    font-size: 14px;
    font-weight: 600;
    animation: slideInRight 0.4s ease;
    backdrop-filter: blur(8px);
}

/* 动画定义 */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .pdf-rotate-container {
        padding: 10px;
    }
    
    .page-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 12px;
    }
}

@media (max-width: 768px) {
    .pdf-rotate-container {
        padding: 8px;
    }
    
    .step-section {
        padding: 16px;
    }
    
    .rotation-buttons {
        flex-direction: column;
    }
    
    .rotation-btn {
        min-width: 100%;
    }
    
    .page-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .page-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
    }
    
    .page-preview {
        height: 150px;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .toast-message {
        left: 16px;
        right: 16px;
        top: 16px;
    }
}

@media (max-width: 640px) {
    .pdf-rotate-container {
        padding: 6px;
    }
    
    .step-section {
        padding: 12px;
        border-radius: 8px;
    }
    
    .file-upload-area {
        padding: 24px 16px;
    }
    
    .upload-icon {
        font-size: 40px;
    }
    
    .page-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 8px;
    }
    
    .page-preview {
        height: 120px;
    }
    
    .page-selection-buttons {
        width: 100%;
        justify-content: space-between;
    }
    
    .btn-small {
        flex: 1;
        min-width: 60px;
        padding: 6px 8px;
        font-size: 11px;
    }
    
    .page-info-text {
        width: 100%;
        display: flex;
        justify-content: space-between;
        margin-top: 8px;
    }
    
    .page-info-separator {
        margin-left: 0;
    }
    
    .btn {
        padding: 10px 18px;
        font-size: 13px;
    }
    
    .toast-message {
        left: 12px;
        right: 12px;
        top: 12px;
        padding: 12px 16px;
        font-size: 13px;
    }
}
