:root {
    --background: #111827;
    --card-bg: rgba(17, 24, 39, 0.7);
    --text: #f3f4f6;
    --border: rgba(255, 255, 255, 0.1);
    --shadow: rgba(0, 0, 0, 0.25);
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --slider-bg: #4b5563;
    --card-radius: 16px;
}

.light-theme {
    --background: #f3f4f6;
    --card-bg: rgba(243, 244, 246, 0.7);
    --text: #111827;
    --border: rgba(0, 0, 0, 0.1);
    --shadow: rgba(0, 0, 0, 0.1);
    --slider-bg: #d1d5db;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: all 0.3s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--background);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    background-image:
        radial-gradient(circle at 20% 35%, rgba(76, 29, 149, 0.15) 0%, transparent 30%),
        radial-gradient(circle at 75% 44%, rgba(59, 130, 246, 0.15) 0%, transparent 30%),
        radial-gradient(circle at 46% 80%, rgba(236, 72, 153, 0.15) 0%, transparent 30%);
    background-size: 100% 100%;
    background-attachment: fixed;
}

.container {
    width: 100%;
    max-width: 1200px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-controls {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

@media (min-width: 640px) {
    h1 {
        font-size: 2rem;
    }

    body {
        padding: 2rem;
    }

    .container {
        gap: 2rem;
    }
}

.theme-toggle {
    position: relative;
    width: 60px;
    height: 30px;
    border-radius: 15px;
    background: var(--slider-bg);
    cursor: pointer;
}

.toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent);
    transition: transform 0.3s ease;
}

.light-theme .toggle-thumb {
    transform: translateX(30px);
}

main {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    main {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }
}

.controls {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: var(--card-radius);
    padding: 1.25rem;
    box-shadow: 0 4px 30px var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

@media (min-width: 640px) {
    .controls {
        padding: 1.5rem;
        gap: 1.5rem;
    }
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    /* Firefox */
}

.control-tabs::-webkit-scrollbar {
    display: none;
    /* Chrome, Safari, Edge */
}

.control-tab {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}

@media (min-width: 640px) {
    .control-tab {
        padding: 0.5rem 1rem;
    }
}

.control-tab.active {
    border-bottom: 2px solid var(--accent);
    color: var(--accent);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

@media (min-width: 640px) {
    .tab-content.active {
        gap: 1.5rem;
    }
}

label {
    font-weight: 500;
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
}

@media (min-width: 640px) {
    label {
        font-size: 1rem;
    }
}

.value {
    font-family: monospace;
    opacity: 0.8;
}

input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    appearance: none;
    background: var(--slider-bg);
    outline: none;
    margin-top: 0.25rem;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
}

.color-picker-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.color-picker {
    appearance: none;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
    background: transparent;
    cursor: pointer;
}

.preview-container {
    position: relative;
    height: 300px;
    border-radius: var(--card-radius);
    overflow: hidden;
    background-image:
        url('/api/placeholder/400/400'),
        linear-gradient(45deg, rgba(59, 130, 246, 0.1), rgba(236, 72, 153, 0.1));
    background-size: cover;
    display: flex;
    justify-content: center;
    align-items: center;
}

@media (min-width: 640px) {
    .preview-container {
        height: 400px;
    }
}

.background-controls {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
}

.bg-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.preview {
    width: 70%;
    height: 60%;
    border-radius: var(--card-radius);
    border: 1px solid var(--border);
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 500;
    text-align: center;
    padding: 1rem;
    font-size: 0.9rem;
}

@media (min-width: 640px) {
    .preview {
        width: 60%;
        font-size: 1rem;
    }
}

.code-container {
    grid-column: 1 / -1;
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: var(--card-radius);
    padding: 1.25rem;
    box-shadow: 0 4px 30px var(--shadow);
}

@media (min-width: 640px) {
    .code-container {
        padding: 1.5rem;
    }
}

.code-tabs {
    display: flex;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.code-tabs::-webkit-scrollbar {
    display: none;
}

.code-tab {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
}

@media (min-width: 640px) {
    .code-tab {
        padding: 0.5rem 1rem;
    }
}

.code-tab.active {
    border-bottom: 2px solid var(--accent);
    color: var(--accent);
}

.code-content {
    display: none;
}

.code-content.active {
    display: block;
}

pre {
    background: rgba(0, 0, 0, 0.2);
    padding: 0.75rem;
    border-radius: 8px;
    overflow-x: auto;
    font-family: Consolas, Monaco, 'Andale Mono', monospace;
    line-height: 1.5;
    font-size: 13px;
}

@media (min-width: 640px) {
    pre {
        padding: 1rem;
        font-size: 14px;
    }
}

code {
    font-size: inherit;
}

.copy-btn {
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    margin-top: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    align-self: flex-start;
}

@media (min-width: 640px) {
    .copy-btn {
        padding: 0.5rem 1rem;
        font-size: 1rem;
    }
}

.copy-btn:hover {
    background: var(--accent-hover);
}

.preset-selector {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.preset {
    padding: 0.4rem 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.8rem;
    border: 1px solid var(--border);
}

@media (min-width: 640px) {
    .preset {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }
}

.preset:hover {
    background: var(--accent);
    color: white;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    padding: 1rem;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: var(--card-radius);
    padding: 1.5rem;
    box-shadow: 0 4px 30px var(--shadow);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

@media (min-width: 640px) {
    .modal {
        padding: 2rem;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.modal-header h2 {
    font-size: 1.25rem;
}

@media (min-width: 640px) {
    .modal-header h2 {
        font-size: 1.5rem;
    }
}

.close-modal {
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 1.5rem;
    cursor: pointer;
}

.preview-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

@media (min-width: 640px) {
    .preview-gallery {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1rem;
    }
}

.gallery-item {
    height: 100px;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
}

@media (min-width: 640px) {
    .gallery-item {
        height: 120px;
    }
}

.gallery-card {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    height: 60%;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.7rem;
    font-weight: 500;
}

@media (min-width: 640px) {
    .gallery-card {
        font-size: 0.75rem;
    }
}

#animationDemo {
    position: absolute;
    width: 70px;
    height: 70px;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 500;
    animation: float 3s ease-in-out infinite;
    font-size: 0.8rem;
}

@media (min-width: 640px) {
    #animationDemo {
        width: 80px;
        height: 80px;
        font-size: 1rem;
    }
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-15px);
    }

    100% {
        transform: translateY(0px);
    }
}

.animation-controls {
    position: absolute;
    bottom: 1rem;
    left: 1rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.animation-btn {
    background: rgba(0, 0, 0, 0.3);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    cursor: pointer;
}

@media (min-width: 640px) {
    .animation-btn {
        font-size: 0.8rem;
    }
}

.animation-btn:hover {
    background: var(--accent);
}

footer {
    margin-top: 1.5rem;
    text-align: center;
    opacity: 0.7;
    font-size: 0.8rem;
    padding-bottom: 1rem;
}

@media (min-width: 640px) {
    footer {
        margin-top: 2rem;
        font-size: 0.9rem;
    }
}

.help-btn {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    cursor: pointer;
}

.help-btn:hover {
    background: var(--accent);
    color: white;
}

/* Add styling for modal content on mobile */
.modal ul {
    padding-left: 1.5rem;
    margin: 1rem 0;
}

.modal h3 {
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

@media (min-width: 640px) {
    .modal h3 {
        font-size: 1.25rem;
    }
}

.modal p {
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

@media (min-width: 640px) {
    .modal p {
        font-size: 1rem;
    }
}

.modal li {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    line-height: 1.5;
}

@media (min-width: 640px) {
    .modal li {
        font-size: 1rem;
    }
}