/* CSS Gradient Generator Styles */

:root {
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-tertiary: #252542;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --accent-primary: #6366f1;
    --accent-secondary: #8b5cf6;
    --accent-hover: #4f46e5;
    --border-color: #3a3a5c;
    --success-color: #22c55e;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
header {
    text-align: center;
    padding: 30px 0 40px;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Main Content */
main {
    flex: 1;
    display: grid;
    gap: 24px;
}

/* Preview Section */
.preview-section {
    width: 100%;
}

.gradient-preview {
    width: 100%;
    height: 300px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
    transition: all 0.3s ease;
}

/* Controls Section */
.controls-section {
    display: grid;
    gap: 24px;
}

.control-group {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.control-group h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

/* Radio Buttons */
.radio-group {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-secondary);
    transition: color 0.2s ease;
}

.radio-label:hover {
    color: var(--text-primary);
}

.radio-label input[type="radio"] {
    display: none;
}

.radio-custom {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.radio-custom::after {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-primary);
    transform: scale(0);
    transition: transform 0.2s ease;
}

.radio-label input[type="radio"]:checked + .radio-custom {
    border-color: var(--accent-primary);
}

.radio-label input[type="radio"]:checked + .radio-custom::after {
    transform: scale(1);
}

/* Slider */
.slider {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-tertiary);
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    background: var(--accent-primary);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

.slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    background: var(--accent-primary);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.slider::-moz-range-thumb:hover {
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
}

/* Angle Presets */
.angle-presets {
    display: flex;
    gap: 8px;
    margin-top: 16px;
    flex-wrap: wrap;
}

.preset-btn {
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.2s ease;
}

.preset-btn:hover {
    background: var(--accent-primary);
    border-color: var(--accent-primary);
}

/* Color Stops */
.color-stops {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.color-stop {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    flex-wrap: wrap;
}

.color-stop input[type="color"] {
    width: 50px;
    height: 40px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: none;
    padding: 0;
}

.color-stop input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-stop input[type="color"]::-webkit-color-swatch {
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
}

.color-stop input[type="number"] {
    width: 70px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.color-stop input[type="number"]:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.color-stop .position-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.color-stop .remove-btn {
    margin-left: auto;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s ease;
}

.color-stop .remove-btn:hover {
    background: #ef4444;
    color: white;
}

.color-stop .remove-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

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

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

/* Preset Gradients */
.preset-gradients {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 10px;
}

.preset-gradient {
    width: 100%;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s ease;
}

.preset-gradient:hover {
    transform: scale(1.05);
    border-color: var(--accent-primary);
}

/* Output Section */
.output-section {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.output-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.code-container {
    position: relative;
}

.css-output {
    background: var(--bg-primary);
    padding: 16px;
    border-radius: var(--radius-sm);
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.85rem;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
    line-height: 1.8;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.copy-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 8px 16px;
    font-size: 0.85rem;
}

.copy-btn .copied-text {
    display: none;
}

.copy-btn.copied {
    background: var(--success-color);
}

.copy-btn.copied .copy-text {
    display: none;
}

.copy-btn.copied .copied-text {
    display: inline;
}

/* Footer */
footer {
    text-align: center;
    padding: 30px 0 20px;
    margin-top: auto;
    border-top: 1px solid var(--border-color);
}

footer p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

footer a {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

footer a:hover {
    color: var(--accent-secondary);
    text-decoration: underline;
}

/* Responsive Design */
@media (min-width: 768px) {
    .app-container {
        padding: 30px 40px;
    }

    header h1 {
        font-size: 3rem;
    }

    .gradient-preview {
        height: 350px;
    }

    main {
        grid-template-columns: 1fr 1fr;
    }

    .preview-section {
        grid-column: 1 / -1;
    }

    .output-section {
        grid-column: 1 / -1;
    }
}

@media (min-width: 1024px) {
    main {
        grid-template-columns: 1fr 400px;
    }

    .preview-section {
        grid-column: 1;
        grid-row: 1 / 3;
    }

    .gradient-preview {
        height: 100%;
        min-height: 400px;
    }

    .controls-section {
        grid-column: 2;
        grid-row: 1;
    }

    .output-section {
        grid-column: 1 / -1;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.color-stop {
    animation: fadeIn 0.3s ease;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-primary);
}
