:root {
    /* Light theme colors */
    --primary: #4a6cff;
    --primary-dark: #3a56d4;
    --secondary: #6c3dd9;
    --accent: #e056fd;
    --text: #2a2f45;
    --text-light: #6b7280;
    --background: #f9faff;
    --card-bg: rgba(255, 255, 255, 0.95);
    --error: #ef4444;
    --success: #10b981;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* Transition durations - optimize for performance */
    --transition-fast: 100ms;
    --transition-normal: 200ms;
    --transition-slow: 300ms;
}

/* Improved theme transition optimization */
.theme-transition {
    /* Transition only essential properties for better performance */
    transition-property: background-color, color, border-color !important;
    transition-duration: var(--transition-normal);
    transition-timing-function: ease;
}

.theme-transition * {
    /* Stop all transitions during theme change for better performance */
    transition-property: none !important;
}

.dark-mode {
    /* Dark theme colors */
    --primary: #6d8dff;
    --primary-dark: #5a76f4;
    --secondary: #8c5df9;
    --accent: #f076fd;
    --text: #e2e8f0;
    --text-light: #a0aec0;
    --background: #111827;
    --card-bg: rgba(30, 41, 59, 0.95);
    --error: #f87171;
    --success: #34d399;
    --border: #334155;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.15);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -1px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.25), 0 4px 6px -2px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.14);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    /* Only transition specific properties instead of all */
    transition-property: transform, opacity, box-shadow;
    transition-duration: var(--transition-normal);
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--background);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
    /* Add hardware acceleration for smoother scrolling */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Theme toggle - optimized for better performance */
.theme-toggle-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
    will-change: transform;
    transform: translateZ(0);
}

.theme-switch {
    display: inline-block;
    position: relative;
    width: 60px;
    height: 30px;
    /* Add hardware acceleration */
    will-change: transform;
    transform: translateZ(0);
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 5px;
    /* Add hardware acceleration */
    will-change: background-color;
}

.slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: transform 0.2s ease;
    z-index: 2;
    /* Add hardware acceleration */
    will-change: transform;
}

.fa-moon, .fa-sun {
    font-size: 0.8rem;
    color: white;
    z-index: 1;
}

.fa-sun {
    margin-left: auto;
}

input:checked + .slider {
    background-color: var(--secondary);
}

input:focus + .slider {
    box-shadow: 0 0 1px var(--secondary);
}

input:checked + .slider:before {
    transform: translateX(30px);
}

.slider.round {
    border-radius: 30px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Optimized Background Animation */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.bg-shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5; /* Reduce opacity for less visual intensity */
    transition: background-color var(--transition-slow) ease;
    will-change: transform, opacity;
    /* Make animation less CPU intensive */
    animation-duration: 30s; /* Slower animations use less CPU */
}

.shape1 {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    width: 600px;
    height: 600px;
    top: -200px;
    left: -200px;
    animation: float 30s ease-in-out infinite alternate; /* Slower animation */
    will-change: transform;
}

.shape2 {
    background: linear-gradient(135deg, var(--accent), var(--secondary));
    width: 500px;
    height: 500px;
    bottom: -200px;
    right: -100px;
    animation: float 25s ease-in-out infinite alternate-reverse; /* Slower animation */
    will-change: transform;
}

.shape3 {
    background: linear-gradient(135deg, var(--primary-dark), var(--accent));
    width: 300px;
    height: 300px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: pulse 15s ease-in-out infinite; /* Slower animation */
    will-change: transform, opacity;
}

/* Optimize animations with transform instead of top/left properties */
@keyframes float {
    0% {
        transform: translate(0, 0) rotate(0deg);
    }
    100% {
        transform: translate(50px, 50px) rotate(10deg);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.6;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0.4;
    }
}

.container {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}

.card {
    background: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--shadow-xl);
    padding: 2.5rem;
    position: relative;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    /* Remove hover animation that causes lag */
    transition: box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    will-change: box-shadow;
    transform: translateZ(0);
}

/* Remove card hover animation that triggers on body movement */
.card:hover {
    /* Remove transform that causes lag during cursor movement */
    transform: none;
    /* Keep subtle shadow change for feedback without motion */
    box-shadow: var(--shadow-xl), 0 0 10px rgba(74, 108, 255, 0.2);
}

.logo-container {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.logo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    box-shadow: var(--shadow-lg);
    color: white;
    font-size: 2.5rem;
    animation: logo-pulse 2s ease-in-out infinite;
    transition: background 0.3s ease;
    will-change: transform, box-shadow;
}

@keyframes logo-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.header {
    text-align: center;
    margin-bottom: 2rem;
}

.header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
    transition: background 0.3s ease;
}

.header p {
    color: var(--text-light);
    font-size: 0.95rem;
    line-height: 1.5;
}

.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.input-container {
    position: relative;
    display: flex;
    align-items: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    will-change: transform;
}

.input-container:focus-within {
    transform: translateY(-2px);
}

.input-icon {
    position: absolute;
    left: 1rem;
    color: var(--text-light);
    font-size: 1rem;
}

.input-field {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text);
}

.input-field:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(74, 108, 255, 0.2);
}

.input-field::placeholder {
    color: var(--text-light);
    opacity: 0.6;
}

.error-message {
    font-size: 0.85rem;
    color: var(--error);
    margin-top: 0.5rem;
    height: 1.2rem;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    will-change: transform, opacity;
}

.error-message.visible {
    opacity: 1;
    transform: translateY(0);
}

.generate-btn {
    width: 100%;
    padding: 0.875rem;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow), 0 0 0 0 rgba(74, 108, 255, 0.5);
    will-change: transform, box-shadow;
}

/* Optimize button hover states to be less intensive */
.generate-btn:hover {
    /* Remove transform that causes lag on hover */
    transform: none;
    /* Keep color/shadow changes for feedback without motion */
    box-shadow: var(--shadow), 0 0 0 3px rgba(74, 108, 255, 0.2);
}

.generate-btn:active {
    transform: translateY(0);
}

.generate-btn:disabled {
    background: linear-gradient(135deg, #a0a8d1, #9b93cd);
    cursor: not-allowed;
    transform: translateY(0);
    box-shadow: var(--shadow);
}

.loading-spinner {
    display: none;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    position: absolute;
    right: calc(50% - 40px);
    animation: spin 0.8s linear infinite;
    will-change: transform, opacity;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.result-card {
    margin-top: 2rem;
    border-radius: 12px;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border);
    padding: 1.5rem;
    display: none;
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    will-change: transform, opacity;
}

.result-card.visible {
    display: block;
    transform: translateY(0);
    opacity: 1;
    animation: card-appear 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes card-appear {
    0% {
        transform: translateY(20px);
        opacity: 0;
    }
    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.result-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
}

.success-checkmark {
    color: var(--success);
    font-size: 1.5rem;
    animation: scale-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    will-change: transform, opacity;
}

@keyframes scale-in {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.result-line {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    font-size: 0.95rem;
    gap: 8px; /* Add gap for better spacing */
    flex-wrap: wrap;
}

.result-line:last-child {
    margin-bottom: 0;
}

.license-key-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.result-label {
    font-weight: 600;
    color: var(--text);
    min-width: 100px;
}

.result-value {
    color: var(--text);
    font-weight: 400;
    flex: 1;
    word-break: break-all;
    flex-grow: 1;
    flex-shrink: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.code-font {
    font-family: 'Fira Code', monospace;
    background-color: rgba(0, 0, 0, 0.05);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    letter-spacing: 1px;
}

.dark-mode .code-font {
    background-color: rgba(255, 255, 255, 0.1);
}

.copy-btn {
    background-color: rgba(74, 108, 255, 0.05);
    margin-left: 8px;
    padding: 6px 8px;
    border-radius: 4px;
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform, box-shadow;
}

/* Optimize button hover states to be less intensive */
.copy-btn:hover {
    background-color: var(--primary);
    color: white;
    /* Remove transform on hover */
    transform: none;
}

.copy-btn:active {
    transform: translateY(0);
}

.copy-message, .download-message {
    font-size: 0.85rem;
    color: var(--success);
    margin-top: 0.5rem;
    text-align: right;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    will-change: transform, opacity;
}

.copy-message.visible, .download-message.visible {
    opacity: 1;
    transform: translateY(0);
}

.result-actions {
    display: flex;
    justify-content: center;
    margin-top: 1.5rem;
    gap: 1rem;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    background-color: rgba(74, 108, 255, 0.1);
    color: var(--primary);
    border: none;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform, box-shadow;
}

/* Optimize button hover states to be less intensive */
.action-btn:hover {
    background-color: var(--primary);
    color: white;
    /* Remove transform on hover */
    transform: none;
}

.footer {
    text-align: center;
    margin-top: 2rem;
    color: var(--text-light);
    font-size: 0.85rem;
}

/* Responsive styling */
@media (max-width: 600px) {
    .card {
        padding: 1.5rem;
        border-radius: 12px;
    }
    
    .header h1 {
        font-size: 1.5rem;
    }
    
    .logo {
        width: 60px;
        height: 60px;
        font-size: 2rem;
    }
    
    .result-label {
        min-width: 80px;
    }
    
    .theme-toggle-container {
        top: 10px;
        right: 10px;
    }
    
    /* Reduce animation complexity on mobile */
    .bg-shape {
        filter: blur(40px); /* Less blur is less CPU intensive */
        animation-play-state: paused; /* Pause animations on mobile */
    }
    
    @keyframes float {
        0% {
            transform: translate(0, 0) rotate(0deg);
        }
        100% {
            transform: translate(30px, 30px) rotate(5deg);
        }
    }
}

/* Add pulse animation for better feedback */
@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

.copied {
    animation: pulse 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: var(--success) !important;
    color: white !important;
}

/* Optimize GPU acceleration for smoother animations */
.loading-spinner,
.success-checkmark,
.error-message,
.copy-message {
    will-change: transform, opacity;
}

/* Remove will-change from non-animating elements */
.card,
.logo,
.result-card,
.copy-btn,
.action-btn,
.input-container,
.theme-switch,
.slider,
.slider:before,
.generate-btn {
    /* Remove will-change to reduce GPU memory usage */
    will-change: auto;
    /* Keep hardware acceleration for smoother rendering */
    transform: translateZ(0);
}