/* PDF Crop Tool - Minimal Styles */

/* PDF Container */
#pdf-container {
    position: relative;
}

/* Mode Selector */
.mode-selector {
    background: var(--card-bg, #1e2130);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

.mode-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.mode-btn {
    flex: 1;
    min-width: 140px;
    max-width: 200px;
    padding: 1rem;
    background: var(--card-hover-bg, #252837);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-color);
}

.mode-btn i {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.mode-btn span {
    font-weight: 600;
}

.mode-btn small {
    font-size: 0.75rem;
    color: var(--light-text);
}

.mode-btn:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.mode-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.mode-btn.active i,
.mode-btn.active small {
    color: white;
}

/* Page Navigation */
.page-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--card-bg, #1e2130);
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.page-nav .nav-btn {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--card-hover-bg, #252837);
    color: var(--text-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.page-nav .nav-btn:hover:not(:disabled) {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

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

.page-nav .page-info {
    font-weight: 500;
}

.page-nav .page-info span {
    white-space: nowrap;
}

/* PDF Canvas Wrapper */
.pdf-canvas-wrapper {
    position: relative;
    display: inline-block;
    overflow: hidden;
    margin: 0 auto;
    touch-action: none;
}

/* Uses preview-container from styles.css for checkered background */
.pdf-preview-container {
    border-radius: 0;
    padding: 0;
    text-align: center;
    min-height: 0;
}

#pdf-canvas {
    display: block;
    max-width: 100%;
    height: auto;
    position: relative;
    z-index: 1;
    touch-action: none;
}

/* Crop Overlay */
#crop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    display: none;
    pointer-events: none;
    z-index: 5;
}

/* Crop Area */
#crop-area {
    position: absolute;
    border: 2px solid var(--primary-color);
    background: rgba(91, 141, 239, 0.1);
    cursor: move;
    pointer-events: auto;
    box-shadow: 0 0 0 9999px var(--overlay-black-50);
    z-index: 10;
    min-width: 50px;
    min-height: 50px;
    touch-action: none;
}

#crop-area.dragging {
    cursor: grabbing;
}

/* Crop Handles */
.crop-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--primary-color);
    border: 2px solid white;
    border-radius: 2px;
    pointer-events: auto;
    z-index: 20;
    box-shadow: 0 2px 4px var(--overlay-black-20);
    touch-action: none;
}

.crop-handle.nw { top: -6px; left: -6px; cursor: nw-resize; }
.crop-handle.ne { top: -6px; right: -6px; cursor: ne-resize; }
.crop-handle.sw { bottom: -6px; left: -6px; cursor: sw-resize; }
.crop-handle.se { bottom: -6px; right: -6px; cursor: se-resize; }
.crop-handle.n { top: -6px; left: 50%; transform: translateX(-50%); cursor: n-resize; }
.crop-handle.s { bottom: -6px; left: 50%; transform: translateX(-50%); cursor: s-resize; }
.crop-handle.e { right: -6px; top: 50%; transform: translateY(-50%); cursor: e-resize; }
.crop-handle.w { left: -6px; top: 50%; transform: translateY(-50%); cursor: w-resize; }

.crop-handle:hover {
    background: var(--secondary-color);
}

/* Crop Dimensions Display */
.crop-dimensions {
    text-align: center;
    padding: 0.5rem;
    margin-top: 0.5rem;
    background: var(--card-hover-bg, #252837);
    border-radius: 6px;
    font-size: 0.9rem;
    color: var(--light-text);
}

/* Thumbnails for Individual Mode */
.thumbnails-container {
    background: var(--card-bg, #1e2130);
    border-radius: 10px;
    padding: 1rem;
    border: 1px solid var(--border-color);
}

.thumbnails-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.thumbnail {
    width: 45px;
    height: 45px;
    border-radius: 6px;
    background: var(--card-hover-bg, #252837);
    border: 2px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-color);
}

.thumbnail:hover {
    border-color: var(--primary-color);
}

.thumbnail.active {
    border-color: var(--primary-color);
    background: rgba(91, 141, 239, 0.2);
}

.thumbnail.saved {
    border-color: var(--success-color);
    background: rgba(40, 167, 69, 0.2);
}

.thumbnail .thumb-status {
    font-size: 0.65rem;
    color: var(--success-color);
}

/* Progress Section */
.progress-container {
    background: var(--card-bg, #1e2130);
    border-radius: 10px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    text-align: center;
}

.progress-container h5 {
    margin-bottom: 1rem;
}


.progress-status {
    color: var(--light-text);
    font-size: 0.9rem;
    margin-bottom: 0;
}

/* Crop Controls - uses tool-group from styles.css */
.crop-controls {
    width: 100%;
    display: block;
    clear: both;
    position: relative;
    text-align: center;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .mode-buttons {
        flex-direction: column;
    }
    
    .mode-btn {
        max-width: 100%;
        flex-direction: row;
        justify-content: flex-start;
        text-align: left;
        gap: 1rem;
    }
    
    .mode-btn i {
        font-size: 1.25rem;
    }
    
    .page-nav {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .page-nav .nav-btn {
        padding: 0.4rem 0.75rem;
        font-size: 0.85rem;
    }
    
    .crop-handle {
        width: 16px;
        height: 16px;
    }
    
    .crop-handle.nw { top: -8px; left: -8px; }
    .crop-handle.ne { top: -8px; right: -8px; }
    .crop-handle.sw { bottom: -8px; left: -8px; }
    .crop-handle.se { bottom: -8px; right: -8px; }
    .crop-handle.n { top: -8px; }
    .crop-handle.s { bottom: -8px; }
    .crop-handle.e { right: -8px; }
    .crop-handle.w { left: -8px; }
}

@media (min-width: 1280px) {
    .crop-editor-shell.crop-editor-shell--active .page-nav {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.75rem;
        padding: 0.85rem;
    }

    .crop-editor-shell.crop-editor-shell--active .page-nav .page-info {
        grid-column: 1 / -1;
        order: -1;
        text-align: center;
    }

    .crop-editor-shell.crop-editor-shell--active .page-nav .nav-btn {
        justify-content: center;
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
        min-width: 0;
    }
}
