* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    min-height: 100vh;
    color: #e2e8f0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

header h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    text-shadow: 0 0 20px rgba(102, 126, 234, 0.5), 2px 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* Upload Section */
.upload-section {
    margin-bottom: 40px;
}

.upload-zone {
    background: rgba(255, 255, 255, 0.05);
    border: 3px dashed #4a5568;
    border-radius: 15px;
    padding: 60px 20px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.25);
}

.upload-content i {
    font-size: 4rem;
    color: #667eea;
    margin-bottom: 20px;
}

.upload-content h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: #f7fafc;
}

.upload-content p {
    color: #a0aec0;
    font-size: 1rem;
}

#fileInput {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* Files Section */
.files-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

.section-header h2 {
    color: #f7fafc;
    font-size: 1.8rem;
}

/* File Item */
.file-item {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s ease;
    cursor: grab;
}

.file-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.25);
    background: rgba(255, 255, 255, 0.12);
}

.file-item.dragging {
    opacity: 0.5;
    transform: rotate(5deg);
}

.file-info {
    display: flex;
    align-items: center;
    flex: 1;
}

.file-icon {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    font-size: 1.5rem;
    color: white;
}

.file-icon.image {
    background: linear-gradient(45deg, #ff6b6b, #ee5a24);
}

.file-icon.pdf {
    background: linear-gradient(45deg, #e74c3c, #c0392b);
}

.file-icon.word {
    background: linear-gradient(45deg, #2b579a, #1e3a5f);
}

.file-icon.excel {
    background: linear-gradient(45deg, #217346, #0f5132);
}

.file-details h4 {
    margin-bottom: 5px;
    color: #f7fafc;
    font-size: 1.1rem;
}

.file-details p {
    color: #a0aec0;
    font-size: 0.9rem;
}

.page-select-inline {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-right: 10px;
    position: relative;
    min-width: 200px;
}

.page-input-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    position: relative;
}

.page-select-input {
    width: 140px;
    padding: 10px 14px;
    border-radius: 10px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    color: #f7fafc;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    outline: none;
    font-family: inherit;
    flex: 1;
}

.page-validate-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
    outline: none;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.page-validate-btn:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.page-validate-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
}

.page-validate-btn:focus {
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

/* Remove the icon from before pseudo-element if it exists */
.page-select-inline::before {
    display: none;
}

/* Update input padding since we removed the icon */
.page-select-input {
    padding-left: 14px;
}

/* Keep existing warning styles */
.page-warning {
    margin-top: 6px;
    font-size: 0.75rem;
    color: #e2e8f0;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    border-left: 3px solid rgba(255, 255, 255, 0.2);
    width: 100%;
    line-height: 1.4;
    animation: slideDown 0.3s ease;
}

.page-warning-valid {
    color: #48bb78;
    background: rgba(72, 187, 120, 0.1);
    border-left-color: #48bb78;
}

.page-input-invalid {
    border-color: #e74c3c !important;
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.2) 0%, rgba(231, 76, 60, 0.1) 100%) !important;
    box-shadow: 0 0 0 4px rgba(231, 76, 60, 0.2), 
                0 4px 12px rgba(231, 76, 60, 0.3) !important;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Ensure file-controls aligns properly */
.file-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.file-controls button {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 1.1rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    outline: none;
}

.file-controls button:focus {
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.3);
    transform: translateY(-1px);
}

.file-controls button:active {
    transform: translateY(0);
}

.rotate-btn {
    background: #3498db;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.rotate-btn:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.remove-btn {
    background: #e74c3c;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.remove-btn:hover {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.remove-btn:focus {
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.3);
}

/* Processing Controls */
.processing-controls {
    display: flex;
    gap: 30px;
    margin-top: 30px;
    padding-top: 25px;
    border-top: 2px solid rgba(255, 255, 255, 0.1);
}

.options-panel {
    flex: 1;
}

.options-panel h3 {
    margin-bottom: 20px;
    color: #f7fafc;
}

.option-group {
    margin-bottom: 15px;
}

.option-group label {
    display: block;
    margin-bottom: 5px;
    color: #e2e8f0;
    font-weight: 500;
}

.option-group input[type="checkbox"] {
    margin-right: 8px;
}

.option-group input[type="text"],
.option-group select {
    width: 100%;
    padding: 10px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    background: rgba(255, 255, 255, 0.1);
    color: #f7fafc;
}

.option-group input[type="text"]:focus,
.option-group select:focus {
    outline: none;
    border-color: #667eea;
    background: rgba(255, 255, 255, 0.15);
}

.option-group select option {
    background: #2d3748;
    color: #f7fafc;
}

/* Buttons */
.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    min-height: 48px;
    line-height: 1.2;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    outline: none;
}

.btn:focus {
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn i {
    font-size: 1.2rem;
}

.btn-primary {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-primary:hover {
    background: linear-gradient(45deg, #5a67d8, #6b46c1);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(108, 117, 125, 0.3);
}

.btn-success {
    background: #28a745;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.btn-success:hover {
    background: #218838;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.3);
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 18px;
    justify-content: center;
    align-items: stretch;
    min-width: 200px;
}

/* Progress Section */
.progress-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    margin-bottom: 30px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.progress-container h3 {
    margin-bottom: 20px;
    color: #f7fafc;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 15px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(45deg, #667eea, #764ba2);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.progress-text {
    color: #a0aec0;
    font-size: 1rem;
}

/* Result Section */
.result-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 15px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.result-content i {
    font-size: 4rem;
    color: #48bb78;
    margin-bottom: 20px;
}

.result-content h3 {
    margin-bottom: 10px;
    color: #f7fafc;
}

.result-content p {
    margin-bottom: 30px;
    color: #a0aec0;
}

.result-content .btn {
    margin: 0 10px 10px 0;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.loading-spinner {
    text-align: center;
    color: #f7fafc;
}

.loading-spinner i {
    font-size: 3rem;
    margin-bottom: 20px;
    color: #667eea;
}

.loading-spinner p {
    font-size: 1.2rem;
    color: #e2e8f0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .upload-zone {
        padding: 40px 20px;
    }
    
    .upload-content i {
        font-size: 3rem;
    }
    
    .file-item {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .file-info {
        justify-content: center;
    }
    
    .processing-controls {
        flex-direction: column;
        gap: 20px;
    }
    
    .result-content .btn {
        display: block;
        margin: 0 0 15px 0;
        width: 100%;
        padding: 16px 20px;
        font-size: 1.2rem;
        min-height: 52px;
    }
    
    .file-controls button {
        width: 48px;
        height: 48px;
        font-size: 1.2rem;
    }
    
    .btn {
        padding: 16px 24px;
        font-size: 1.2rem;
        min-height: 52px;
    }
}

/* Animation keyframes */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.files-section,
.progress-section,
.result-section {
    animation: fadeInUp 0.5s ease;
}

/* Sortable placeholder */
.sortable-placeholder {
    background: rgba(102, 126, 234, 0.1);
    border: 2px dashed #667eea;
    border-radius: 10px;
    height: 90px;
    opacity: 0.5;
}

/* Update/add these styles */

.page-input-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    position: relative;
}

.page-status-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    font-size: 0.9rem;
}

.page-status-icon.page-status-valid {
    background: rgba(72, 187, 120, 0.2);
    color: #48bb78;
}

.page-status-icon.page-status-valid:hover {
    background: rgba(72, 187, 120, 0.3);
    transform: scale(1.1);
}

.page-status-icon.page-status-invalid {
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
}

.page-status-icon.page-status-invalid:hover {
    background: rgba(231, 76, 60, 0.3);
    transform: scale(1.1);
}

.page-warning-invalid {
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
    border-left-color: #e74c3c;
}
