/*
 * File: css/split-pdf.css
 * Description: Specific styles for PDF Splitter tool interface
 */

/* 1. File Info Bar (Shows loaded file name) */
.file-info {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    background: linear-gradient(135deg, #f8f9ff 0%, #ffffff 100%);
    border-radius: 12px;
    margin-bottom: 30px;
    border: 1px solid rgba(147, 112, 219, 0.2);
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
}

.file-icon {
    font-size: 2rem;
    margin-right: 15px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.file-details {
    flex: 1;
    overflow: hidden;
}

.file-name {
    font-weight: 600;
    color: var(--text-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-meta {
    font-size: 0.85rem;
    color: #666;
}

/* 2. Split Mode Selection Cards */
.split-modes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.mode-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 20px 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
}

.mode-card:hover {
    border-color: var(--primary-light);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.mode-card.active {
    border-color: var(--primary-color);
    background: rgba(147, 112, 219, 0.05);
    box-shadow: 0 0 0 3px rgba(147, 112, 219, 0.15);
}

/* Checkmark indicator for active card */
.mode-card.active::after {
    content: '✓';
    position: absolute;
    top: 5px;
    right: 5px;
    width: 20px;
    height: 20px;
    background: var(--primary-color);
    color: white;
    border-radius: 50%;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.mode-icon {
    font-size: 2rem;
    margin-bottom: 10px;
    display: block;
}

.mode-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-dark);
    margin-bottom: 5px;
    line-height: 1.2;
}

.mode-desc {
    font-size: 0.75rem;
    color: #777;
    line-height: 1.3;
}

/* 3. Configuration Panels (Range inputs, etc) */
.mode-config {
    display: none; /* Hidden by default */
    background: #f8f9fa;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    border: 1px solid #e0e0e0;
    animation: fadeIn 0.3s ease;
}

.mode-config.active {
    display: block; /* Show when active */
}

.form-group {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-dark);
}

.form-group input[type="text"],
.form-group input[type="number"] {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'Poppins', sans-serif;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(147, 112, 219, 0.1);
}

.help-text {
    margin-top: 8px;
    font-size: 0.85rem;
    color: #666;
    font-style: italic;
}

/* 4. Thumbnails Container (For 'Extract Selected' mode) */
.thumbnails-container {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    background: #ffffff;
}

.thumbnails {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 15px;
}

.thumbnail {
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.2s ease;
    border: 3px solid transparent; /* Reserve space for border */
    position: relative;
    background: #f5f5f5;
}

.thumbnail:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

/* Selected State for Thumbnails */
.thumbnail.selected {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(147, 112, 219, 0.2);
}

.thumbnail.selected::before {
    content: '✓';
    position: absolute;
    top: 5px;
    right: 5px;
    background: var(--primary-color);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: bold;
    z-index: 2;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* Overlay to darken selected items slightly */
.thumbnail.selected::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(147, 112, 219, 0.1);
    pointer-events: none;
}

.thumbnail-canvas {
    width: 100%;
    height: 140px; /* Fixed height for consistency */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.thumbnail-canvas canvas {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.thumbnail-number {
    text-align: center;
    padding: 5px;
    background: #f8f9fa;
    font-size: 0.8rem;
    color: var(--text-dark);
    border-top: 1px solid #f0f0f0;
    font-weight: 500;
}

.thumbnail.selected .thumbnail-number {
    background: var(--primary-color);
    color: white;
}

/* 5. Results Section */
.results {
    margin-top: 40px;
    padding: 30px;
    background: linear-gradient(135deg, #f8f9ff 0%, #ffffff 100%);
    border-radius: 15px;
    border: 1px solid #f0f0f0;
    display: none;
}

.results h2 {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 25px;
    color: var(--text-dark);
}

.result-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background: #ffffff;
    border-radius: 10px;
    margin-bottom: 12px;
    border: 1px solid #e0e0e0;
    transition: all 0.3s ease;
}

.result-item:hover {
    border-color: var(--primary-light);
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

.result-icon {
    font-size: 1.5rem;
    margin-right: 15px;
    color: var(--primary-color);
}

.result-details {
    flex: 1;
}

.result-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-dark);
}

.result-meta {
    font-size: 0.85rem;
    color: #888;
}

.download-single {
    padding: 6px 15px;
    font-size: 0.85rem;
    border-radius: 6px;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .split-modes {
        grid-template-columns: 1fr 1fr;
    }
    
    .result-item {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .result-icon {
        margin-right: 0;
    }
    
    .download-single {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .split-modes {
        grid-template-columns: 1fr; /* Stack modes on very small screens */
    }
    
    .thumbnails {
        grid-template-columns: repeat(2, 1fr);
    }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}