:root {
    --bg-color: #0f172a;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --primary: #8b5cf6;
    --primary-hover: #7c3aed;
    --secondary: #10b981;
    --secondary-hover: #059669;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --drop-active: rgba(139, 92, 246, 0.2);
    --danger: #ef4444;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
}

/* Background Animated Shapes */
.background-shapes {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
}

.shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
    animation: float 20s infinite ease-in-out alternate;
}

.shape-1 {
    width: 400px;
    height: 400px;
    background: #4c1d95;
    top: -10%;
    left: -10%;
}

.shape-2 {
    width: 300px;
    height: 300px;
    background: #047857;
    bottom: 10%;
    right: -5%;
    animation-delay: -5s;
}

.shape-3 {
    width: 500px;
    height: 500px;
    background: #1e3a8a;
    top: 40%;
    left: 40%;
    animation-delay: -10s;
}

@keyframes float {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(50px, 50px) scale(1.1);
    }
}

/* Main Container - Glassmorphism */
.app-container {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 40px;
    width: 100%;
    max-width: 600px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    z-index: 1;
    transition: all 0.3s ease;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #c4b5fd 0%, #a78bfa 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

header p {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Drop Zone */
.drop-zone {
    border: 2px dashed rgba(139, 92, 246, 0.4);
    border-radius: 16px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(15, 23, 42, 0.4);
}

.drop-zone:hover,
.drop-zone.active {
    border-color: var(--primary);
    background: var(--drop-active);
    transform: translateY(-2px);
}

.upload-icon {
    width: 64px;
    height: 64px;
    color: var(--primary);
    margin-bottom: 16px;
    transition: transform 0.3s ease;
}

.drop-zone:hover .upload-icon {
    transform: translateY(-5px);
}

.drop-text {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.sub-text {
    color: var(--text-muted);
    margin-bottom: 12px;
}

.browse-link {
    color: var(--primary);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.formats-text {
    font-size: 0.875rem;
    color: var(--text-muted);
    opacity: 0.8;
}

/* Preview Section */
.preview-section {
    margin-top: 24px;
    animation: fadeIn 0.4s ease-out;
}

.hidden {
    display: none !important;
}

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

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

.image-preview-container {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 24px;
    border: 1px solid var(--glass-border);
    text-align: center;
}

#image-preview {
    max-width: 100%;
    max-height: 300px;
    object-fit: contain;
    border-radius: 8px;
    margin-bottom: 12px;
}

.file-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: var(--text-muted);
    padding: 0 4px;
    margin-top: 10px;
}

/* Controls Section */
.controls-section {
    background: rgba(15, 23, 42, 0.4);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid var(--glass-border);
}

.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

label {
    font-weight: 600;
}

#quality-value {
    background: var(--primary);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
}

input[type=range] {
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    height: 8px;
    border-radius: 4px;
    margin-bottom: 24px;
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 20px;
    width: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    margin-top: -6px;
    box-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
    transition: transform 0.1s;
}

input[type=range]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Buttons */
.action-buttons {
    display: flex;
    gap: 16px;
}

.btn {
    flex: 1;
    padding: 14px 24px;
    border-radius: 12px;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn svg {
    width: 20px;
    height: 20px;
}

.primary-btn {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 14px 0 rgba(139, 92, 246, 0.39);
}

.primary-btn:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.23);
}

.primary-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.secondary-btn {
    background: var(--secondary);
    color: white;
    box-shadow: 0 4px 14px 0 rgba(16, 185, 129, 0.39);
}

.secondary-btn:hover {
    background: var(--secondary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.23);
}

.reset-action {
    display: flex;
    justify-content: center;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--glass-border);
}

.text-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s ease, transform 0.2s ease;
}

.text-btn svg {
    width: 16px;
    height: 16px;
}

.text-btn:hover {
    color: var(--primary);
    transform: translateY(-1px);
}

/* Animation for loading/converting */
@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.spinner {
    animation: spin 1s linear infinite;
}

/* Responsive */
@media (max-width: 640px) {
    .app-container {
        padding: 24px;
        border-radius: 0;
        min-height: 100vh;
        border: none;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

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