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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

h1 {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
    font-size: 2.5em;
    margin-bottom: 0;
}

section {
    padding: 30px;
    border-bottom: 1px solid #e0e0e0;
}

section:last-child {
    border-bottom: none;
}

h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.5em;
    border-bottom: 3px solid #667eea;
    padding-bottom: 10px;
}

h3 {
    color: #555;
    font-size: 1em;
    margin-bottom: 8px;
}

/* Upload Section */
.upload-section {
    background: #f9f9f9;
}

.upload-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

#fileInput {
    padding: 10px 15px;
    border: 2px solid #ddd;
    border-radius: 6px;
    flex: 1;
    min-width: 200px;
    font-size: 1em;
    cursor: pointer;
}

.source-display,
.output-display {
    margin-top: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 600;
    font-size: 0.95em;
}

textarea {
    width: 100%;
    height: 250px;
    padding: 15px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
    resize: vertical;
    background: #f5f5f5;
    transition: all 0.3s ease;
}

textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.2);
    background: white;
}

textarea[readonly] {
    background: #f0f0f0;
    color: #555;
}

/* Configuration Section */
.config-section {
    background: white;
}

.config-tools {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.config-btn {
    padding: 10px 20px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-size: 0.95em;
    transition: all 0.3s ease;
    min-width: 120px;
}

.config-btn:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.config-btn:active {
    transform: translateY(-1px);
}

.config-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.config-group {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.config-group h3 {
    margin-bottom: 12px;
    color: #667eea;
    font-size: 1.05em;
}

.sort-select {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 0.95em;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sort-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 8px rgba(102, 126, 234, 0.2);
}

.sort-select:hover {
    border-color: #667eea;
}

/* Cleanup Options */
.cleanup-options {
    margin-bottom: 20px;
    padding: 15px;
    background: #f0f0f0;
    border-radius: 6px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
    color: #333;
    font-weight: 500;
}

.checkbox-label input[type="checkbox"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
    accent-color: #667eea;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.primary-btn,
.secondary-btn,
.download-btn,
.copy-btn {
    padding: 12px 30px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
    font-size: 1em;
    transition: all 0.3s ease;
    min-width: 140px;
}

.primary-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.primary-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

.primary-btn:active {
    transform: translateY(-1px);
}

.secondary-btn {
    background: #e0e0e0;
    color: #333;
}

.secondary-btn:hover {
    background: #d0d0d0;
    transform: translateY(-2px);
}

.download-btn {
    background: #4caf50;
    color: white;
}

.download-btn:hover {
    background: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(76, 175, 80, 0.4);
}

.copy-btn {
    background: #2196f3;
    color: white;
}

.copy-btn:hover {
    background: #0b7dda;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(33, 150, 243, 0.4);
}

/* Output Section */
.output-section {
    background: #f9f9f9;
}

.output-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

/* Status Messages */
.status-message {
    padding: 15px;
    margin: 15px 0;
    border-radius: 6px;
    display: none;
    animation: slideIn 0.3s ease;
}

.status-message.success {
    background: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
    display: block;
}

.status-message.error {
    background: #f8d7da;
    color: #721c24;
    border-left: 4px solid #f5c6cb;
    display: block;
}

.status-message.info {
    background: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid #bee5eb;
    display: block;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        border-radius: 0;
    }

    h1 {
        font-size: 1.8em;
        padding: 20px;
    }

    section {
        padding: 20px;
    }

    h2 {
        font-size: 1.2em;
    }

    .config-container {
        grid-template-columns: 1fr;
    }

    .upload-controls {
        flex-direction: column;
    }

    #uploadBtn,
    .primary-btn,
    .secondary-btn,
    .download-btn,
    .copy-btn {
        width: 100%;
    }

    textarea {
        height: 200px;
    }

    .action-buttons {
        flex-direction: column;
    }

    .output-controls {
        flex-direction: column;
    }
}

/* Accessibility */
button:focus,
select:focus,
input:focus,
textarea:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

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

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #5568d3;
}