:root {
    --primary: #4361ee;
    --secondary: #3a0ca3;
    --dark: #1a1a2e;
    --light: #f8f9fa;
    --success: #4cc9f0;
    --danger: #f72585;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--light);
    color: var(--dark);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

h1 {
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-weight: 300;
    opacity: 0.9;
}

.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1.5rem;
    flex: 1;
    width: 100%;
}

.app-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

@media (max-width: 768px) {
    .app-container {
        grid-template-columns: 1fr;
    }
}

.preview-container {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    height: 400px;
}

.gradient-preview {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
}

.preview-text {
    background-color: rgba(255, 255, 255, 0.8);
    padding: 1rem 2rem;
    border-radius: 8px;
    font-size: 1.2rem;
    font-weight: 600;
    backdrop-filter: blur(5px);
}

.controls-container {
    background-color: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.control-group {
    margin-bottom: 1.5rem;
}

.control-group h3 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    color: var(--secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.color-pickers {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.color-picker {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.color-picker label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--dark);
}

.color-input {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.color-input input[type="color"] {
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.color-input input[type="text"] {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
}

.slider-control {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.slider-control label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--dark);
}

.slider-control input[type="range"] {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: #ddd;
    outline: none;
    -webkit-appearance: none;
    margin-bottom: 15px;
}

.slider-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
}

.gradient-type {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.gradient-type button {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    background-color: #eee;
    color: var(--dark);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.gradient-type button.active {
    background-color: var(--primary);
    color: white;
}

.gradient-type button:hover {
    background-color: #ddd;
}

.gradient-type button.active:hover {
    background-color: var(--secondary);
}

.buttons {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--secondary);
    transform: translateY(-2px);
}

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background-color: rgba(67, 97, 238, 0.1);
    transform: translateY(-2px);
}

.btn-danger {
    background-color: var(--danger);
    color: white;
}

.btn-danger:hover {
    background-color: #d1146e;
    transform: translateY(-2px);
}

.code-container {
    margin-top: 2rem;
    background-color: #1e1e2e;
    border-radius: 12px;
    padding: 1.5rem;
    color: #f8f8f2;
    font-family: 'Courier New', Courier, monospace;
    position: relative;
    overflow: hidden;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.code-header h3 {
    color: #f8f8f2;
    font-size: 1rem;
}

.copy-btn {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.copy-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.code-content {
    overflow-x: auto;
}

.presets {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.preset {
    height: 80px;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.preset:hover {
    transform: scale(1.05);
}

.animation-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.animation-toggle {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.animation-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--success);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: var(--success);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

footer {
    text-align: center;
    padding: 1.5rem;
    background-color: var(--dark);
    color: white;
    margin-top: 2rem;
}

footer a {
    color: var(--success);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}