/* ===== Генератор градиентов ===== */
.gradient-generator {
    padding-bottom: var(--spacing-2xl);
}

.preview-fullwidth {
    width: 100%;
    border-radius: var(--border-radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    position: relative;
    margin: 2rem 0 2rem;
}

.gradient-preview {
    width: 100%;
    height: 200px;
    position: relative;
    background-color: #fff;
    background-image: 
        linear-gradient(45deg, #ccc 25%, transparent 25%),
        linear-gradient(-45deg, #ccc 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #ccc 75%),
        linear-gradient(-45deg, transparent 75%, #ccc 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}

.gradient-preview::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient, linear-gradient(90deg, #4f46e5, #f97316, #10b981));
}

.preview-overlay {
    position: absolute;
    bottom: 16px;
    right: 16px;
    z-index: 10;
}

.preview-overlay .btn {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: var(--gray-800);
    padding: 8px 16px;
    font-size: 0.9rem;
    box-shadow: var(--shadow-md);
}

.preview-overlay .btn:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-2px);
}

/* Редактор */
.editor-container {
    background: var(--white);
    border-radius: var(--border-radius-xl);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
    margin-top: var(--spacing-lg);
}

.editor-section {
    margin-bottom: var(--spacing-xl);
    border-bottom: 1px solid var(--gray-200);
    padding-bottom: var(--spacing-lg);
}

.editor-section:last-of-type {
    border-bottom: none;
    padding-bottom: 0;
}

.section-label {
    display: block;
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: var(--spacing-sm);
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Селектор типа градиента */
.gradient-type-selector {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
}

.type-btn {
    flex: 1;
    min-width: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius-full);
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--gray-700);
    cursor: pointer;
    transition: var(--transition);
}

.type-btn ion-icon {
    font-size: 1.2rem;
}

.type-btn:hover {
    background: var(--gray-200);
    border-color: var(--gray-300);
}

.type-btn.active {
    background: var(--primary-600);
    border-color: var(--primary-600);
    color: white;
    box-shadow: 0 4px 10px rgba(79, 70, 229, 0.3);
}

.type-btn.active ion-icon {
    color: white;
}

/* Управление углом */
.angle-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-sm);
}

.angle-value {
    font-weight: 600;
    color: var(--primary-600);
    background: var(--primary-50);
    padding: 4px 12px;
    border-radius: var(--border-radius-full);
    font-size: 0.9rem;
}

.angle-slider {
    width: 100%;
    height: 6px;
    background: linear-gradient(90deg, #ff0000 0%, #ffff00 17%, #00ff00 33%, #00ffff 50%, #0000ff 67%, #ff00ff 83%, #ff0000 100%);
    border-radius: 3px;
    -webkit-appearance: none;
    appearance: none;
}

.angle-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: white;
    border: 2px solid var(--primary-600);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    transition: var(--transition);
}

.angle-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.angle-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: white;
    border: 2px solid var(--primary-600);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    transition: var(--transition);
}

/* Цветовые стопы */
.stops-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-md);
}

.add-stop-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--primary-50);
    color: var(--primary-700);
    border: 1px solid var(--primary-200);
    padding: 8px 16px;
    border-radius: var(--border-radius-full);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.add-stop-btn:hover {
    background: var(--primary-100);
    border-color: var(--primary-300);
    transform: translateY(-1px);
}

.add-stop-btn ion-icon {
    font-size: 1.1rem;
}

.color-stops {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.color-stop-item {
    background: var(--gray-100);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-md);
    border: 1px solid var(--gray-200);
    transition: var(--transition);
    animation: fadeIn 0.3s ease;
}

.color-stop-item:hover {
    border-color: var(--primary-300);
    box-shadow: var(--shadow-sm);
}

.stop-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-sm);
}

.stop-color-preview {
    width: 24px;
    height: 24px;
    border-radius: 8px;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stop-number {
    font-weight: 600;
    color: var(--gray-600);
    margin-left: var(--spacing-xs);
}

.remove-stop {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: white;
    border: 1px solid var(--gray-300);
    color: var(--gray-500);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    margin-left: auto;
}

.remove-stop:hover {
    background: var(--error-50);
    border-color: var(--error-500);
    color: var(--error-500);
}

.remove-stop ion-icon {
    font-size: 1.1rem;
}

.stop-controls {
    display: grid;
    grid-template-columns: 1fr 1fr 2fr;
    gap: var(--spacing-sm);
    align-items: center;
}

.stop-color-input {
    width: 100%;
    height: 40px;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius-md);
    padding: 0 4px;
    cursor: pointer;
    background: white;
}

.stop-color-text {
    width: 100%;
    height: 40px;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius-md);
    padding: 0 12px;
    font-family: monospace;
    font-size: 0.9rem;
}

.stop-color-text:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px var(--primary-100);
}

.stop-position {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
}

.stop-position input[type="range"] {
    flex: 1;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-300), var(--primary-600));
    border-radius: 2px;
    -webkit-appearance: none;
}

.stop-position input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: white;
    border: 2px solid var(--primary-600);
    border-radius: 50%;
    cursor: pointer;
}

.stop-position-value {
    min-width: 45px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary-600);
    text-align: right;
}

/* Прозрачность */
.stop-opacity {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: var(--spacing-xs);
}

.stop-opacity input[type="range"] {
    flex: 1;
    height: 4px;
    background: linear-gradient(90deg, transparent, currentColor);
    border-radius: 2px;
    -webkit-appearance: none;
}

.stop-opacity input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: white;
    border: 2px solid currentColor;
    border-radius: 50%;
    cursor: pointer;
}

.opacity-value {
    min-width: 45px;
    font-size: 0.9rem;
    color: var(--gray-600);
    text-align: right;
}

/* Дополнительные настройки */
.setting-item {
    margin-bottom: var(--spacing-md);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--gray-700);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-600);
    border-radius: 4px;
}

.setting-label {
    display: block;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.position-select,
.shape-select {
    width: 100%;
    padding: 10px 16px;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius-md);
    background: white;
    font-size: 0.95rem;
    color: var(--gray-800);
    cursor: pointer;
    transition: var(--transition);
}

.position-select:hover,
.shape-select:hover {
    border-color: var(--primary-400);
}

.position-select:focus,
.shape-select:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px var(--primary-100);
}

/* CSS код */
.css-output {
    background: var(--gray-900);
    border-radius: var(--border-radius-lg);
    padding: var(--spacing-md);
    margin-top: var(--spacing-lg);
}

.css-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-sm);
}

.css-header .section-label {
    color: var(--gray-400);
    margin-bottom: 0;
}

.css-code-block {
    background: var(--gray-800);
    border-radius: var(--border-radius-md);
    padding: var(--spacing-md);
    overflow-x: auto;
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #e2e8f0;
    /*white-space: pre-wrap;*/
    word-wrap: break-word;
    border: 1px solid var(--gray-700);
}

/* Анимации */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Адаптивность */
@media (max-width: 768px) {
    .editor-container {
        padding: var(--spacing-lg);
    }
    
    .stop-controls {
        grid-template-columns: 1fr;
        gap: var(--spacing-sm);
    }
    
    .stop-color-text {
        width: 100%;
    }
    
    .gradient-type-selector {
        flex-direction: column;
    }
    
    .type-btn {
        width: 100%;
    }
    
    .preview-overlay {
        bottom: 8px;
        right: 8px;
    }
    
    .preview-overlay .btn {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
    
    .gradient-preview {
        height: 150px;
    }
}

@media (max-width: 480px) {
    .editor-container {
        padding: var(--spacing-md);
    }
    
    .add-stop-btn {
        width: 100%;
        justify-content: center;
    }
    
    .stops-header {
        flex-direction: column;
        gap: var(--spacing-sm);
        align-items: flex-start;
    }
    
    .css-header {
        flex-direction: column;
        gap: var(--spacing-xs);
        align-items: flex-start;
    }
}

.css-output .btn-outline {
    color: white;
}

.css-output .btn-outline:hover {
    color: var(--gray-900);
    border: 1px solid var(--gray-900);
}