/* Images to PDF Specific Styles */

/* Main Container */
.img2pdf-main-container {
    min-height: calc(100vh - var(--nav-height) - 60px);
    background: #f8fafc;
    padding-bottom: 80px;
}

/* Upload View - Clean Minimal Design (Sejda-style) */
.img2pdf-upload-container {
    min-height: auto;
    padding: 40px 20px 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    background: #faf8f3;
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* Background Pattern - Sejda Style */
.img2pdf-upload-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background-image: url('/static/assets/bg-pattern-editor-sejda.svg');
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
    opacity: 0.7;
    pointer-events: none;
    z-index: 0;
}

.img2pdf-upload-card,
.img-upload-card {
    width: 100%;
    max-width: 650px;
    text-align: center;
    margin-bottom: 40px;
}

.img2pdf-hero-title {
    font-size: 2.5rem;
    color: #2d3748;
    margin-bottom: 12px;
    font-weight: 600;
}

.img2pdf-hero-subtitle {
    font-size: 1.1rem;
    color: #2563eb;
    margin-bottom: 40px;
    line-height: 1.6;
}

/* Upload Box */
.btn-upload-img2pdf {
    background: var(--primary);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    padding: 14px 28px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.btn-upload-img2pdf:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.upload-helper-text {
    color: #a0aec0;
    font-size: 0.9rem;
    margin-top: 16px;
    margin-bottom: 8px;
}

.upload-privacy-text {
    color: #718096;
    font-size: 0.85rem;
}

/* Features Section */
.img2pdf-features {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 40px;
    margin-top: 20px;
    width: 100%;
    max-width: 1000px;
}

.img2pdf-feature-item {
    background: white;
    padding: 32px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    transition: transform 0.3s, box-shadow 0.3s;
    border: 1px solid #f1f5f9;
}

.img2pdf-feature-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.img2pdf-feature-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    color: var(--primary);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    margin: 0 auto 24px;
}

.img2pdf-feature-item h4 {
    color: #0f172a;
    margin-bottom: 12px;
    font-weight: 700;
    font-size: 1.1rem;
}

.img2pdf-feature-item p {
    color: #64748b;
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Workspace Layout */
.img2pdf-workspace-container {
    display: flex;
    max-width: 98%;
    margin: 40px auto;
    gap: 40px;
    padding: 0 40px;
    align-items: flex-start;
}

/* Sidebar */
.img2pdf-sidebar {
    width: 340px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    position: sticky;
    top: calc(var(--nav-height) + 40px);
    border: 1px solid #e2e8f0;
    overflow: hidden;
    flex-shrink: 0;
}

.sidebar-header {
    background: white;
    padding: 24px;
    border-bottom: 1px solid #f1f5f9;
}

.sidebar-header h2 {
    font-size: 1.25rem;
    color: #0f172a;
    margin: 0;
    font-weight: 700;
}

.sidebar-content {
    padding: 24px;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    color: #1e293b;
    transition: all 0.2s;
    outline: none;
    background: #f8fafc;
    box-sizing: border-box;
}

.form-input:focus {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.input-suffix {
    display: block;
    text-align: right;
    font-size: 0.85rem;
    color: #94a3b8;
    margin-top: 6px;
    font-weight: 500;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    font-size: 1rem;
    color: #64748b;
    padding: 12px 0;
    border-top: 1px solid #f1f5f9;
}

.sidebar-actions {
    padding: 24px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.btn-block {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 14px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    background: linear-gradient(135deg, var(--primary) 0%, #1d4ed8 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.3);
}

.btn-block:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(37, 99, 235, 0.4);
}

.btn-block:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-block.btn-secondary {
    background: white;
    color: #64748b;
    border: 1px solid #cbd5e1;
    box-shadow: none;
}

.btn-block.btn-secondary:hover {
    background: #f1f5f9;
    color: #0f172a;
    border-color: #94a3b8;
    transform: none;
}

/* Content Area */
.img2pdf-content-area {
    flex-grow: 1;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    min-height: 600px;
    padding: 40px;
    border: 1px solid #e2e8f0;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.content-header h3 {
    font-size: 1.5rem;
    color: #0f172a;
    display: flex;
    gap: 12px;
    align-items: center;
    font-weight: 700;
    margin: 0;
}

.btn-small {
    padding: 10px 20px;
    background: #eff6ff;
    color: var(--primary);
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-small:hover {
    background: #dbeafe;
    color: #1e3a8a;
}

.drag-hint {
    text-align: center;
    color: #64748b;
    font-size: 0.95rem;
    margin-bottom: 24px;
    background: #f8fafc;
    padding: 12px;
    border-radius: 8px;
    border: 1px dashed #cbd5e1;
}

/* Image List & Cards */
.image-list-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 24px;
    padding: 4px;
}

.image-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 24px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    cursor: grab;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    height: 100%;
}

.image-card:hover {
    border-color: var(--primary);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    transform: translateY(-4px);
}

.image-thumbnail {
    width: 100%;
    height: 180px;
    background: #f8fafc;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 0 20px 0;
    overflow: hidden;
    border: 1px solid #f1f5f9;
    position: relative;
}

.image-thumbnail img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transition: transform 0.3s;
}

.image-card:hover .image-thumbnail img {
    transform: scale(1.05);
}

/* Action Toolbar */
.image-actions {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 8px;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.2s;
    border-bottom: 1px solid #e2e8f0;
    z-index: 10;
}

.image-card:hover .image-actions {
    opacity: 1;
    transform: translateY(0);
}

.action-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: #64748b;
    padding: 6px 10px;
    border-radius: 6px;
    transition: all 0.2s;
    font-size: 0.95rem;
}

.action-btn:hover {
    background: #eff6ff;
    color: var(--primary);
    transform: scale(1.1);
}

.action-btn.delete-btn:hover {
    background: #fef2f2;
    color: #ef4444;
}

.image-name {
    font-weight: 600;
    color: #334155;
    margin-bottom: 8px;
    font-size: 0.9rem;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-all;
    width: 100%;
}

/* Crop Modal */
.crop-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    backdrop-filter: blur(5px);
}

.crop-modal-content {
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    background: white;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.crop-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
}

.crop-modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: #0f172a;
    font-weight: 700;
}

.crop-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #64748b;
    line-height: 1;
}

.crop-modal-close:hover {
    color: #ef4444;
}

.crop-container {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #1e293b;
    max-height: 60vh;
    overflow: hidden;
}

.crop-container img {
    display: block;
    max-width: 100%;
}

.crop-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid #e2e8f0;
}

.crop-modal-actions .btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}

.crop-modal-actions .btn-secondary {
    background: white;
    color: #64748b;
    border: 1px solid #cbd5e1;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}

/* Loading Overlay */
.img2pdf-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.82);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
}

.img2pdf-loading-overlay .spinner {
    width: 54px;
    height: 54px;
    border: 4px solid rgba(255, 255, 255, 0.15);
    border-top: 4px solid #2563eb;
    border-radius: 50%;
    animation: img2pdf-spin 0.9s linear infinite;
    margin-bottom: 20px;
}

@keyframes img2pdf-spin {
    to {
        transform: rotate(360deg);
    }
}

.img2pdf-loading-overlay p {
    color: white;
    font-size: 1.1rem;
    font-weight: 500;
    text-align: center;
    margin: 0;
    letter-spacing: 0.01em;
}

/* View Modal */
.pdf-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    backdrop-filter: blur(5px);
}

.pdf-modal-content {
    width: 90%;
    height: 90%;
    background: #1e293b;
    border-radius: 16px;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pdf-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: #ef4444;
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    z-index: 3001;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: transform 0.2s, background 0.2s;
}

.pdf-modal-close:hover {
    background: #dc2626;
    transform: scale(1.1);
}

.pdf-frame-container {
    flex-grow: 1;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

#view-modal img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
}

/* Sortable ghost */
.sortable-ghost {
    background: #f0f9ff;
    border: 2px dashed var(--primary);
    opacity: 0.6;
}

/* Hidden */
.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 1024px) {
    .img2pdf-workspace-container {
        flex-direction: column;
        padding: 0 20px;
        gap: 20px;
    }

    .img2pdf-sidebar {
        width: 100%;
        position: static;
        order: 2;
    }

    .img2pdf-content-area {
        width: 100%;
        order: 1;
        min-height: auto;
    }
}

@media (max-width: 768px) {
    .img2pdf-features {
        grid-template-columns: 1fr;
    }

    .image-list-container {
        grid-template-columns: 1fr;
    }
}