:root {
    --primary-gradient: linear-gradient(45deg, #6a11cb 0%, #2575fc 100%);
    --success-color: #10b981;
    --error-color: #ef4444;
    --background-color: #f8f9fa;
    --card-bg: #ffffff;
    --text-color: #212529;
    --text-light: #6c757d;
    --border-color: #dee2e6;
    --font-family: 'Poppins', sans-serif;
    --drag-over-color: #f3e5f5;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--card-bg);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-size: 1.75rem;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.install-button {
    background: transparent;
    border: 1px solid #6a11cb;
    color: #6a11cb;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-family: var(--font-family);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.install-button:hover {
    background: #6a11cb;
    color: white;
}

main {
    padding: 2rem 1rem;
    max-width: 500px;
    margin: 0 auto;
}

.card {
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: all 0.3s ease;
}

/* --- Upload Area --- */
.upload-area {
    padding: 2rem;
    text-align: center;
    border: 2px dashed var(--border-color);
    border-radius: 10px;
    margin: 1rem;
    transition: all 0.2s ease-in-out;
}

.upload-area.drag-over,
.upload-label.drag-over {
    border-color: #6a11cb;
    background-color: var(--drag-over-color);
}

.upload-label {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.upload-icon {
    color: #6a11cb;
    transition: transform 0.2s ease;
}

.upload-area:hover .upload-icon {
    transform: translateY(-2px);
}

.upload-title {
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--text-color);
}

.upload-subtitle {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* --- File List --- */
.file-list-container {
    padding: 0 1rem 1rem 1rem;
    border-top: 1px solid var(--border-color);
    max-height: 300px;
    overflow-y: auto;
}

#fileList {
    list-style: none;
    margin-top: 1rem;
}

.file-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    background-color: #fdfdfd;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-bottom: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.03);
    user-select: none;
    transition: transform 0.1s ease;
}

.file-item:hover {
    transform: translateY(-1px);
}

.file-item .drag-handle {
    cursor: grab;
    color: var(--text-light);
    margin-right: 0.75rem;
    font-size: 1.2rem;
}

.file-item .thumbnail {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    margin-right: 1rem;
    object-fit: cover;
    background-color: var(--background-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    overflow: hidden;
}

.file-item .thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-item .file-info {
    flex-grow: 1;
    overflow: hidden;
}

.file-item .file-name {
    display: block;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-item .file-size {
    font-size: 0.8rem;
    color: var(--text-light);
}

.file-item .remove-btn {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0 0.5rem;
    transition: color 0.2s;
    line-height: 1;
}

.file-item .remove-btn:hover {
    color: var(--error-color);
}

/* Sortable.js classes */
.sortable-ghost {
    opacity: 0.5;
    background: #f8f9fa;
}

.sortable-chosen {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* --- Action Buttons --- */
.actions {
    margin-top: 1.5rem;
    text-align: center;
}

.cta-button {
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 0.9rem 2.5rem;
    font-family: var(--font-family);
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.cta-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none !important;
}

.cta-button.success {
    background: var(--success-color);
}

/* --- Results View --- */
#results-container {
    text-align: center;
    padding: 2.5rem 1.5rem;
}

.success-icon {
    color: var(--success-color);
    margin-bottom: 1rem;
}

#results-container h2 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

#results-container p {
    color: var(--text-light);
    margin-bottom: 1.5rem;
}

#results-container .cta-button {
    width: 100%;
    margin-bottom: 1rem;
}

.secondary-button {
    background: none;
    border: none;
    color: var(--text-light);
    font-family: var(--font-family);
    font-weight: 500;
    cursor: pointer;
    text-decoration: underline;
    padding: 0.5rem;
    transition: color 0.2s;
}

.secondary-button:hover {
    color: var(--text-color);
}

/* --- Loader --- */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loader-overlay p {
    margin-top: 1rem;
    font-weight: 500;
    color: var(--text-light);
}

.spinner {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: conic-gradient(#0000 10%, #6a11cb);
    -webkit-mask: radial-gradient(farthest-side, #0000 calc(100% - 9px), #000 0);
    animation: spinner-spin 1s infinite linear;
}

@keyframes spinner-spin {
    100% { transform: rotate(1turn); }
}

/* Responsive adjustments */
@media (max-width: 480px) {
    main {
        padding: 1rem;
    }
    
    .upload-area {
        padding: 1.5rem;
    }
    
    .file-item {
        padding: 0.5rem;
    }
}