:root {
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(148, 163, 184, 0.1);
    --glass-border: rgba(255, 255, 255, 0.1);
    --shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    --font-family: 'Outfit', sans-serif;
}

/* Light Theme */
[data-theme="light"] {
    --bg-color: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.9);
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: rgba(148, 163, 184, 0.2);
    --glass-border: rgba(0, 0, 0, 0.1);
    --shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
}

/* Theme transitions */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Prevent transitions for specific elements */
.theme-toggle svg,
input[type=range]::-webkit-slider-thumb,
canvas {
    transition: none;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-main);
    font-size: 1.1rem;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background-image: 
        radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.15) 0px, transparent 50%);
    transition: background-color 0.3s ease, color 0.3s ease;
}

[data-theme="light"] {
    background-image: 
        radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.05) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.05) 0px, transparent 50%);
}

.app-container {
    width: 100%;
    max-width: 800px;
    padding: 2rem;
}

header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInDown 0.8s ease-out;
}

header h1 {
    font-size: 3.5rem;
    font-weight: 700;
    background: linear-gradient(to right, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

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

/* Theme Toggle Button */
.theme-toggle {
    position: fixed;
    top: 2rem;
    right: 2rem;
    background: var(--card-bg);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: var(--shadow);
    z-index: 1000;
}

.theme-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.theme-toggle svg {
    width: 24px;
    height: 24px;
    color: var(--primary);
    transition: transform 0.3s ease;
}

.theme-toggle:hover svg {
    transform: rotate(180deg);
}

[data-theme="light"] .sun-icon {
    display: none;
}

[data-theme="dark"] .moon-icon {
    display: none;
}

.sun-icon, .moon-icon {
    transition: opacity 0.3s ease;
}



/* Upload Section */
.upload-box {
    background: var(--card-bg);
    border: 2px dashed var(--border);
    border-radius: 1.5rem;
    padding: 4rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.upload-box:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.upload-box .icon {
    color: var(--primary);
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 50%;
    transition: transform 0.3s ease;
}

.upload-box:hover .icon {
    transform: scale(1.1);
}

.upload-box span {
    font-size: 1.5rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.upload-box small {
    color: var(--text-muted);
    font-size: 1rem;
}

/* Editor Section */
.editor-section {
    background: var(--card-bg);
    border-radius: 1.5rem;
    padding: 2rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    animation: fadeInUp 0.6s ease-out;
}

.preview-container {
    width: 100%;
    min-height: 300px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 1rem;
    margin-bottom: 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
}

[data-theme="light"] .preview-container {
    background: rgba(0, 0, 0, 0.05);
}

canvas {
    max-width: 100%;
    max-height: 500px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.controls-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.info-panel {
    display: flex;
    justify-content: space-around;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

[data-theme="light"] .info-panel {
    background: rgba(0, 0, 0, 0.05);
}

@media (max-width: 600px) {
    .info-panel {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .info-item {
        flex-direction: row;
        justify-content: space-between;
        text-align: left;
    }
}

.info-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    min-width: 120px;
}





.slider-control {
    padding: 0 1rem;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    font-weight: 500;
    font-size: 1.1rem;
}

input[type=range] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
}

[data-theme="light"] input[type=range] {
    background: rgba(0, 0, 0, 0.1);
}

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

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

.actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-family: inherit;
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: none;
}

.btn.primary {
    background: var(--primary);
    color: white;
}

.btn.primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn.secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.btn.secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.hidden {
    display: none;
}

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

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 600px) {
    header h1 { font-size: 3rem; }
    .app-container { padding: 1rem; }
    .actions { flex-direction: column; }
    .btn { width: 100%; justify-content: center; }
    .info-item { min-width: auto; }
    
    .theme-toggle {
        top: 1rem;
        right: 1rem;
        width: 50px;
        height: 50px;
    }
    
    .theme-toggle svg {
        width: 20px;
        height: 20px;
    }
    
    .editor-section {
        padding: 1rem;
    }
}
