@import url('https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,300;14..32,400;14..32,500;14..32,600;14..32,700;14..32,800&display=swap');

:root {
    /* Light theme */
    --bg-light: #faf9fc;
    --surface-light: rgba(255, 255, 255, 0.85);
    --glass-border-light: rgba(255, 255, 255, 0.5);
    --text-light: #1a1a2e;
    --text-secondary-light: #4a4a6a;
    --accent: #6366f1;
    --accent-glow: rgba(99, 102, 241, 0.4);
    --accent-secondary: #ec489a;
    --success: #10b981;
    --danger: #ef4444;
    --shadow-sm: 0 8px 20px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 20px 35px -12px rgba(0, 0, 0, 0.15);
    --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.3);
    --radius-xl: 28px;
    --radius-lg: 20px;
    --radius-md: 16px;
}

[data-theme="dark"] {
    --bg-light: #0a0a0f;
    --surface-light: rgba(20, 20, 30, 0.85);
    --glass-border-light: rgba(255, 255, 255, 0.08);
    --text-light: #f0f0ff;
    --text-secondary-light: #a0a0c0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg-light);
    color: var(--text-light);
    min-height: 100vh;
    padding: 20px;
    transition: background 0.4s ease;
    position: relative;
    overflow-x: hidden;
}

/* Animated gradient background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 20% 50%, rgba(99, 102, 241, 0.08), transparent 50%),
                radial-gradient(circle at 80% 80%, rgba(236, 72, 153, 0.08), transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* Floating particles animation */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.particle {
    position: absolute;
    background: radial-gradient(circle, var(--accent), transparent);
    border-radius: 50%;
    opacity: 0.3;
    animation: float 20s infinite ease-in-out;
}

@keyframes float {
    0%, 100% { transform: translateY(0) translateX(0); }
    25% { transform: translateY(-30px) translateX(15px); }
    75% { transform: translateY(30px) translateX(-15px); }
}

.app-container {
    max-width: 900px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

/* Header with glow */
header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 12px;
    backdrop-filter: blur(10px);
    padding: 8px 0;
}

h1 {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent), var(--accent-secondary), var(--accent));
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: gradientShift 3s ease infinite;
    letter-spacing: -0.02em;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.subtitle {
    color: var(--text-secondary-light);
    margin-bottom: 48px;
    font-size: 1.1rem;
    font-weight: 400;
    backdrop-filter: blur(5px);
    width: fit-content;
}

.theme-toggle {
    background: var(--surface-light);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border-light);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 10px 16px;
    border-radius: 60px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
}

.theme-toggle:hover {
    transform: scale(1.05) rotate(8deg);
    box-shadow: var(--shadow-glow);
}

/* Upload Zone - 3D Tilt Card */
.upload-zone {
    background: var(--surface-light);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border-light);
    border-radius: var(--radius-xl);
    padding: 60px 32px;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    margin-bottom: 28px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.upload-zone::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transition: left 0.6s;
}

.upload-zone:hover::before {
    left: 100%;
}

.upload-zone:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-glow);
    border-color: var(--accent);
}

.upload-zone.drag-over {
    border-color: var(--accent);
    transform: scale(0.98);
    background: rgba(99, 102, 241, 0.1);
}

.upload-icon {
    font-size: 64px;
    margin-bottom: 20px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.upload-zone h3 {
    font-size: 1.6rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.upload-zone p {
    color: var(--text-secondary-light);
    margin-bottom: 28px;
}

.upload-btn {
    background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
    color: white;
    border: none;
    padding: 14px 36px;
    border-radius: 60px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 15px var(--accent-glow);
    position: relative;
    overflow: hidden;
}

.upload-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.upload-btn:hover::after {
    width: 300px;
    height: 300px;
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--accent-glow);
}

/* Preview Card */
.preview-container {
    background: var(--surface-light);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border-light);
    border-radius: var(--radius-xl);
    padding: 24px;
    margin-bottom: 28px;
    animation: slideInUp 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-md);
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.preview-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
}

.clear-btn {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 8px 18px;
    border-radius: 40px;
    cursor: pointer;
    color: var(--danger);
    font-weight: 500;
    transition: all 0.3s;
}

.clear-btn:hover {
    background: var(--danger);
    color: white;
    transform: scale(1.02);
}

#preview img {
    width: 100%;
    max-height: 320px;
    object-fit: contain;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

/* Loading Card */
.loading-card {
    background: var(--surface-light);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border-light);
    border-radius: var(--radius-xl);
    padding: 48px;
    text-align: center;
    animation: pulse 1.5s ease infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.9; transform: scale(0.99); }
}

.spinner {
    width: 56px;
    height: 56px;
    border: 3px solid rgba(99, 102, 241, 0.2);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 20px;
}

.loading-card p {
    font-size: 1.1rem;
    font-weight: 500;
}

/* Result Card */
.result-card {
    background: var(--surface-light);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border-light);
    border-radius: var(--radius-xl);
    padding: 28px;
    animation: slideInUp 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-md);
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}

.result-header h3 {
    font-size: 1.3rem;
    font-weight: 700;
}

.stats {
    font-size: 0.8rem;
    font-weight: 500;
    background: rgba(99, 102, 241, 0.15);
    padding: 6px 14px;
    border-radius: 40px;
    backdrop-filter: blur(5px);
}

#outputText {
    width: 100%;
    padding: 18px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
    border: 1px solid var(--glass-border-light);
    border-radius: var(--radius-md);
    background: rgba(0, 0, 0, 0.2);
    color: var(--text-light);
    resize: vertical;
    margin-bottom: 20px;
    transition: all 0.3s;
}

#outputText:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.action-btn {
    flex: 1;
    padding: 14px 24px;
    border: none;
    border-radius: 60px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.action-btn.primary {
    background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
    color: white;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.action-btn.primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px var(--accent-glow);
}

.action-btn.secondary {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border-light);
    color: var(--text-light);
}

.action-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--text-light);
    color: var(--bg-light);
    padding: 14px 28px;
    border-radius: 60px;
    font-weight: 500;
    z-index: 1000;
    animation: toastIn 0.3s forwards;
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(10px);
}

@keyframes toastIn {
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--accent);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-secondary);
}

.hidden {
    display: none;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Mobile Responsive */
@media (max-width: 600px) {
    body {
        padding: 16px;
    }
    
    h1 {
        font-size: 2rem;
    }
    
    .upload-zone {
        padding: 40px 20px;
    }
    
    .upload-icon {
        font-size: 48px;
    }
    
    .upload-zone h3 {
        font-size: 1.3rem;
    }
    
    .result-card {
        padding: 20px;
    }
    
    .action-buttons {
        flex-direction: column;
    }
}



