/* Main container styles */
.pdf-crop-tool-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    color: #333;
}

/* Upload section styles */
.upload-section {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.pdf-upload-input {
    display: none;
}

.upload-label {
    padding: 10px 15px;
    background-color: #2271b1;
    color: white;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.upload-label:hover {
    background-color: #135e96;
}

.file-name {
    font-size: 0.9em;
    color: #666;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
    white-space: nowrap;
}

/* Controls section styles */
.controls-section {
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
}

.mode-selector {
    display: flex;
    gap: 15px;
}

.page-navigation {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-button {
    padding: 8px 12px;
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    min-width: 80px;
}

.nav-button:hover {
    background-color: #e0e0e0;
}

.nav-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.action-buttons {
    display: flex;
    gap: 10px;
    margin-left: auto;
    flex-wrap: wrap;
}

.action-button {
    padding: 8px 12px;
    background-color: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    min-width: 100px;
}

.action-button:hover {
    background-color: #e0e0e0;
}

.action-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.download-button {
    background-color: #4CAF50;
    color: white;
    border-color: #3d8b40;
}

.download-button:hover {
    background-color: #3d8b40;
}

/* Preview section styles */
.preview-section {
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.preview-container {
    position: relative;
    width: 100%;
    min-height: 500px;
    background-color: #f9f9f9;
    display: flex;
    justify-content: center;
    align-items: center;
}

.pdf-preview {
    max-width: 100%;
    max-height: 100%;
    overflow: auto;
    text-align: center;
    padding: 20px;
}

.pdf-preview canvas {
    max-width: 100%;
    height: auto;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
}

.crop-overlay {
    position: absolute;
    border: 2px dashed rgba(0, 0, 255, 0.5);
    background-color: rgba(0, 0, 255, 0.1);
    cursor: move;
    display: none;
}

/* Loading indicator */
.loading-indicator {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

.spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top: 4px solid #2271b1;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

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

/* Error message */
.error-message {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    color: #d63638;
    font-weight: bold;
    text-align: center;
    z-index: 10;
}

/* Responsive styles */
@media (max-width: 768px) {
    .controls-section {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .action-buttons {
        margin-left: 0;
        width: 100%;
        justify-content: space-between;
    }
    
    .preview-container {
        min-height: 300px;
    }
    
    .file-name {
        max-width: 200px;
    }
}

@media (max-width: 480px) {
    .upload-section {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .file-name {
        max-width: 100%;
    }
    
    .mode-selector {
        flex-direction: column;
        gap: 5px;
    }
    
    .action-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .action-button {
        width: 100%;
    }
}