/* PDF to Image Specific Styles */

/* Radio Button Styling */
.radio-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 2px solid var(--card-border);
    border-radius: 8px;
    background: var(--card-bg);
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 8px;
    position: relative;
}

.radio-option:hover {
    border-color: #7953db;
    background: rgba(121, 83, 219, 0.05);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(121, 83, 219, 0.15);
}

.radio-option input[type="radio"] {
    width: 20px;
    height: 20px;
    border: 2px solid var(--card-border);
    border-radius: 50%;
    background: var(--card-bg);
    cursor: pointer;
    position: relative;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.radio-option input[type="radio"]:checked {
    border-color: #7953db;
    background: #7953db;
    box-shadow: 0 0 0 3px rgba(121, 83, 219, 0.2);
}

.radio-option input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: white;
}

.radio-option input[type="radio"]:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(121, 83, 219, 0.3);
}

.radio-option:has(input[type="radio"]:checked) {
    border-color: #7953db;
    background: rgba(121, 83, 219, 0.1);
    box-shadow: 0 2px 12px rgba(121, 83, 219, 0.2);
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color);
    cursor: pointer;
    flex: 1;
}

.radio-label i {
    color: #7953db;
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.radio-option:has(input[type="radio"]:checked) .radio-label {
    color: #7953db;
    font-weight: 600;
}

/* Page Selection Controls */
.page-selection-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

/* Image Generation Progress */
.image-generation-progress {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--card-bg);
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    text-align: center;
    min-width: 300px;
    border: 1px solid var(--card-border);
}

.image-generation-progress h3 {
    margin: 0 0 20px 0;
    color: var(--text-color);
    font-size: 18px;
    font-weight: 600;
}

.image-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--card-border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 15px;
}

.image-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #7953db, #9d6dff);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 4px;
}

.image-progress-text {
    color: var(--tool-description-color);
    font-size: 14px;
    margin-bottom: 10px;
}

.image-progress-percentage {
    color: var(--text-color);
    font-weight: 600;
    font-size: 16px;
}

/* PDF Page Selection Styles */
.page-selector {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--background-color);
    border-radius: 12px;
    padding: 20px;
}

.page-selector-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 15px;
    padding: 0 10px;
}

.page-selector-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-selector-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-select-all-btn {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-color);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}

.page-select-all-btn:hover {
    background: #7953db;
    color: white;
    border-color: #7953db;
}

.page-count-info {
    font-size: 12px;
    color: var(--tool-description-color);
    margin: 0 10px;
}

.page-grid-container {
    flex: 1;
    width: 100%;
    overflow-y: auto;
    border-radius: 8px;
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 15px;
}

.page-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    align-content: start;
}

.page-thumbnail {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: white;
    border: 2px solid var(--card-border);
    cursor: pointer;
    transition: all 0.3s ease;
    aspect-ratio: 3/4;
}

.page-thumbnail:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-color: #7953db;
}

.page-thumbnail.selected {
    border-color: #7953db;
    background-color: rgba(121, 83, 219, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(121, 83, 219, 0.3);
}

.page-thumbnail canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.page-thumbnail .page-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: 600;
}

.page-thumbnail.selected .page-overlay {
    display: flex;
}

.page-thumbnail .page-number {
    position: absolute;
    bottom: 4px;
    left: 4px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 500;
}

.page-thumbnail .select-indicator {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s ease;
}

.page-thumbnail:hover .select-indicator,
.page-thumbnail.selected .select-indicator {
    opacity: 1;
}

.page-thumbnail.selected .select-indicator {
    background: #7953db;
    border-color: #7953db;
    color: white;
}

/* Image Preview Modal */
.image-preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
}

.image-preview-modal.active {
    display: flex;
}

.image-preview-modal-content {
    background: var(--card-bg);
    border-radius: 12px;
    max-width: 90vw;
    max-height: 90vh;
    width: 800px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--card-border);
    overflow: hidden;
}

.image-preview-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 25px;
    border-bottom: 1px solid var(--card-border);
    background: linear-gradient(135deg, var(--card-bg) 0%, rgba(121, 83, 219, 0.02) 100%);
}

.image-preview-modal-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.image-preview-modal-title i {
    color: #7953db;
    font-size: 22px;
}

.image-preview-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--tool-description-color);
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: all 0.2s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-preview-modal-close:hover {
    background: var(--card-border);
    color: var(--text-color);
    transform: scale(1.1);
}

.image-preview-modal-body {
    flex: 1;
    padding: 25px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.image-preview-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding: 12px 16px;
    background: rgba(121, 83, 219, 0.05);
    border-radius: 8px;
    border-left: 4px solid #7953db;
}

.image-preview-info span {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color);
}

.image-preview-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.image-nav-btn {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-color);
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 36px;
}

.image-nav-btn:hover:not(:disabled) {
    background: #7953db;
    color: white;
    border-color: #7953db;
    transform: translateY(-1px);
}

.image-nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.image-preview-canvas-container {
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    overflow: auto;
    min-height: 400px;
    max-height: 600px;
    border: 2px dashed var(--card-border);
}

.image-preview-canvas-container canvas {
    max-width: 100%;
    height: auto !important;
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    background: white;
    display: block;
}

.image-preview-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 25px;
    border-top: 1px solid var(--card-border);
    background: var(--background-color);
    gap: 15px;
}

.image-preview-modal-footer button {
    padding: 12px 24px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.image-preview-modal-footer .primary-btn {
    background: #7953db;
    color: white;
    flex: 1;
}

.image-preview-modal-footer .primary-btn:hover {
    background: #6a44cc;
    transform: translateY(-1px);
}

.image-preview-modal-footer .secondary-btn {
    background: transparent;
    border: 1px solid var(--card-border);
    color: var(--text-color);
}

.image-preview-modal-footer .secondary-btn:hover {
    background: var(--card-border);
    transform: translateY(-1px);
}

/* Format Selection Styles */
.format-selector {
    display: flex;
    gap: 12px;
    margin-top: 10px;
}

.format-option {
    flex: 1;
    padding: 12px;
    border: 2px solid var(--card-border);
    border-radius: 8px;
    background: var(--card-bg);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.format-option:hover {
    border-color: #7953db;
    background: rgba(121, 83, 219, 0.05);
}

.format-option.selected {
    border-color: #7953db;
    background: rgba(121, 83, 219, 0.1);
}

.format-option .format-icon {
    font-size: 24px;
    margin-bottom: 8px;
    color: #7953db;
}

.format-option .format-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 4px;
}

.format-option .format-desc {
    font-size: 12px;
    color: var(--tool-description-color);
}

/* Quality Indicator */
.quality-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.quality-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ddd;
}

.quality-dot.active {
    background: #7953db;
}

.quality-label {
    font-size: 11px;
    color: var(--tool-description-color);
    margin-left: 5px;
}

/* Resolution Indicator */
.resolution-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding: 10px;
    background: rgba(121, 83, 219, 0.05);
    border-radius: 6px;
    border-left: 3px solid #7953db;
}

.resolution-icon {
    width: 30px;
    height: 30px;
    border: 2px solid #7953db;
    border-radius: 4px;
    position: relative;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: #7953db;
    font-weight: 600;
}

.resolution-info {
    flex: 1;
}

.resolution-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 2px;
}

.resolution-desc {
    font-size: 12px;
    color: var(--tool-description-color);
}

/* Loading States */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    z-index: 100;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--card-border);
    border-top: 4px solid #7953db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error States */
.error-message {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    background: rgba(231, 76, 60, 0.1);
    border: 1px solid rgba(231, 76, 60, 0.3);
    border-radius: 8px;
    color: #e74c3c;
    font-size: 14px;
    margin-top: 10px;
}

.error-message i {
    font-size: 16px;
}

/* Success States */
.success-message {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    background: rgba(46, 204, 113, 0.1);
    border: 1px solid rgba(46, 204, 113, 0.3);
    border-radius: 8px;
    color: #2ecc71;
    font-size: 14px;
    margin-top: 10px;
}

.success-message i {
    font-size: 16px;
}

/* Download Progress */
.download-progress {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--card-bg);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    min-width: 300px;
    border: 1px solid var(--card-border);
}

.download-progress h4 {
    margin: 0 0 10px 0;
    color: var(--text-color);
    font-size: 16px;
    font-weight: 600;
}

.download-progress-bar {
    width: 100%;
    height: 6px;
    background: var(--card-border);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 10px;
}

.download-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #7953db, #9d6dff);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 3px;
}

.download-progress-text {
    color: var(--tool-description-color);
    font-size: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.download-progress-close {
    background: none;
    border: none;
    color: var(--tool-description-color);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
    position: absolute;
    top: 8px;
    right: 8px;
}

.download-progress-close:hover {
    background: var(--card-border);
    color: var(--text-color);
}

/* ZIP Download Styles */
.zip-download-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: rgba(52, 152, 219, 0.1);
    border: 1px solid rgba(52, 152, 219, 0.3);
    border-radius: 8px;
    color: #3498db;
    font-size: 14px;
    margin-top: 10px;
}

.zip-download-info i {
    font-size: 16px;
}

/* Page Range Validation */
.page-range-validation, .page-specific-validation {
    font-size: 12px;
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.page-range-error, .page-specific-validation.page-range-error {
    color: #e74c3c;
    background-color: rgba(231, 76, 60, 0.1);
    border: 1px solid rgba(231, 76, 60, 0.3);
}

.page-range-error i {
    font-size: 14px;
}

.page-range-success, .page-specific-validation.page-range-success {
    color: #4CAF50;
    background-color: rgba(76, 175, 80, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.page-range-success i {
    font-size: 14px;
}

/* Loading state for preview */
.image-preview-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    color: var(--tool-description-color);
}

.image-preview-loading .loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--card-border);
    border-top: 4px solid #7953db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.image-preview-loading span {
    font-size: 14px;
    font-weight: 500;
}

/* PNG-specific styles */
.png-indicator {
    background-color: rgba(76, 175, 80, 0.1);
    color: #4CAF50;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-align: center;
    margin-top: 4px;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.png-format-badge {
    background-color: rgba(76, 175, 80, 0.1);
    color: #4CAF50;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    margin-left: 8px;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.png-file-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 10px;
    color: #4CAF50;
    margin-top: 4px;
    padding: 2px 6px;
    background-color: rgba(76, 175, 80, 0.1);
    border-radius: 4px;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.png-file-info i {
    font-size: 10px;
}

/* PNG thumbnails container styling */
.pdf-thumbnails-container .pdf-page-thumbnail {
    position: relative;
}

.pdf-thumbnails-container .pdf-page-thumbnail::after {
    content: 'PNG';
    position: absolute;
    top: 2px;
    left: 2px;
    background: rgba(76, 175, 80, 0.9);
    color: white;
    font-size: 8px;
    padding: 1px 3px;
    border-radius: 2px;
    font-weight: bold;
}

/* Progress bar for PNG conversion */
.progress-content {
    text-align: center;
}

.progress-message {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 15px;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--card-border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #66BB6A);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 4px;
}

.progress-percentage {
    color: var(--text-color);
    font-weight: 600;
    font-size: 14px;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .image-generation-progress {
        min-width: 280px;
        padding: 25px;
    }
    
    .image-preview-modal-content {
        width: 95vw;
        max-height: 95vh;
        margin: 20px;
    }
    
    .image-preview-modal-header,
    .image-preview-modal-body,
    .image-preview-modal-footer {
        padding: 15px 20px;
    }
    
    .image-preview-modal-title {
        font-size: 18px;
    }
    
    .image-preview-canvas-container {
        min-height: 300px;
        padding: 15px;
    }
    
    .image-preview-modal-footer {
        flex-direction: column;
        gap: 10px;
    }
    
    .image-preview-modal-footer button {
        width: 100%;
        justify-content: center;
    }
    
    .page-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 10px;
    }
    
    .format-selector {
        flex-direction: column;
        gap: 8px;
    }
    
    .resolution-preview {
        flex-direction: column;
        text-align: center;
        gap: 8px;
    }
    
    .download-progress {
        bottom: 10px;
        right: 10px;
        left: 10px;
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .image-generation-progress {
        min-width: 250px;
        padding: 20px;
    }
    
    .image-preview-modal-content {
        width: 98vw;
        margin: 10px;
    }
    
    .image-preview-info {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .image-preview-controls {
        justify-content: center;
    }
    
    .page-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
        gap: 8px;
    }
    
    .format-option {
        padding: 8px;
    }
    
    .format-option .format-icon {
        font-size: 20px;
        margin-bottom: 4px;
    }
    
    .format-option .format-name {
        font-size: 12px;
    }
    
    .format-option .format-desc {
        font-size: 10px;
    }
}